Shader tev combiner buffer color initialization

This commit is contained in:
tfarley 2015-05-13 02:18:30 -07:00
parent 96bb4f4cf9
commit d0a0630a82
3 changed files with 15 additions and 0 deletions

View File

@ -57,6 +57,8 @@ void RasterizerOpenGL::InitObjects() {
uniform_tex = glGetUniformLocation(shader.GetHandle(), "tex"); uniform_tex = glGetUniformLocation(shader.GetHandle(), "tex");
uniform_tev_combiner_buffer_color = glGetUniformLocation(shader.GetHandle(), "tev_combiner_buffer_color");
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
auto& uniform_tev = uniform_tev_cfgs[i]; auto& uniform_tev = uniform_tev_cfgs[i];
@ -491,6 +493,14 @@ void RasterizerOpenGL::SyncDrawState() {
} }
} }
// Sync intial combiner buffer color
GLfloat initial_combiner_color[4] = { Pica::registers.tev_combiner_buffer_color.r / 255.0f,
Pica::registers.tev_combiner_buffer_color.g / 255.0f,
Pica::registers.tev_combiner_buffer_color.b / 255.0f,
Pica::registers.tev_combiner_buffer_color.a / 255.0f };
glUniform4fv(uniform_tev_combiner_buffer_color, 1, initial_combiner_color);
// Sync texture environment configurations to hw shader // Sync texture environment configurations to hw shader
const auto tev_stages = Pica::registers.GetTevStages(); const auto tev_stages = Pica::registers.GetTevStages();
for (unsigned tev_stage_idx = 0; tev_stage_idx < tev_stages.size(); ++tev_stage_idx) { for (unsigned tev_stage_idx = 0; tev_stage_idx < tev_stages.size(); ++tev_stage_idx) {

View File

@ -146,6 +146,7 @@ private:
GLuint uniform_alphatest_func; GLuint uniform_alphatest_func;
GLuint uniform_alphatest_ref; GLuint uniform_alphatest_ref;
GLuint uniform_tex; GLuint uniform_tex;
GLuint uniform_tev_combiner_buffer_color;
TEVConfigUniforms uniform_tev_cfgs[6]; TEVConfigUniforms uniform_tev_cfgs[6];
GLuint uniform_out_maps; GLuint uniform_out_maps;
GLuint uniform_tex_envs; GLuint uniform_tex_envs;

View File

@ -140,6 +140,8 @@ uniform float alphatest_ref;
uniform sampler2D tex[3]; uniform sampler2D tex[3];
uniform vec4 tev_combiner_buffer_color;
struct TEVConfig struct TEVConfig
{ {
ivec3 color_sources; ivec3 color_sources;
@ -309,6 +311,8 @@ void ProcessTexEnv(int tex_env_idx) {
} }
void main(void) { void main(void) {
g_combiner_buffer = tev_combiner_buffer_color;
for (int i = 0; i < NUM_TEV_STAGES; ++i) { for (int i = 0; i < NUM_TEV_STAGES; ++i) {
ProcessTexEnv(i); ProcessTexEnv(i);
} }