diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 9f1537345..37b346f62 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -57,6 +57,8 @@ void RasterizerOpenGL::InitObjects() { 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) { 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 const auto tev_stages = Pica::registers.GetTevStages(); for (unsigned tev_stage_idx = 0; tev_stage_idx < tev_stages.size(); ++tev_stage_idx) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 301233227..e41950ffa 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -146,6 +146,7 @@ private: GLuint uniform_alphatest_func; GLuint uniform_alphatest_ref; GLuint uniform_tex; + GLuint uniform_tev_combiner_buffer_color; TEVConfigUniforms uniform_tev_cfgs[6]; GLuint uniform_out_maps; GLuint uniform_tex_envs; diff --git a/src/video_core/renderer_opengl/gl_shaders.h b/src/video_core/renderer_opengl/gl_shaders.h index 517396021..e58c8fdc2 100644 --- a/src/video_core/renderer_opengl/gl_shaders.h +++ b/src/video_core/renderer_opengl/gl_shaders.h @@ -140,6 +140,8 @@ uniform float alphatest_ref; uniform sampler2D tex[3]; +uniform vec4 tev_combiner_buffer_color; + struct TEVConfig { ivec3 color_sources; @@ -309,6 +311,8 @@ void ProcessTexEnv(int tex_env_idx) { } void main(void) { + g_combiner_buffer = tev_combiner_buffer_color; + for (int i = 0; i < NUM_TEV_STAGES; ++i) { ProcessTexEnv(i); }