From 96bb4f4cf99661cf85da4a7cd259bcbfc777d876 Mon Sep 17 00:00:00 2001 From: tfarley Date: Tue, 12 May 2015 16:55:24 -0700 Subject: [PATCH] Shader multiplier int and clamp correction --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- src/video_core/renderer_opengl/gl_shaders.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 3b25b530f..9f1537345 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -511,7 +511,7 @@ void RasterizerOpenGL::SyncDrawState() { glUniform3iv(uniform_tev_cfg.color_modifiers, 1, color_mods); glUniform3iv(uniform_tev_cfg.alpha_modifiers, 1, alpha_mods); glUniform2i(uniform_tev_cfg.color_alpha_op, (GLint)stage.color_op.Value(), (GLint)stage.alpha_op.Value()); - glUniform2f(uniform_tev_cfg.color_alpha_multiplier, (GLfloat)stage.GetColorMultiplier(), (GLfloat)stage.GetAlphaMultiplier()); + glUniform2i(uniform_tev_cfg.color_alpha_multiplier, stage.GetColorMultiplier(), stage.GetAlphaMultiplier()); glUniform4fv(uniform_tev_cfg.const_color, 1, const_color); glUniform2i(uniform_tev_cfg.updates_combiner_buffer_color_alpha, Pica::registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferColor(tev_stage_idx), diff --git a/src/video_core/renderer_opengl/gl_shaders.h b/src/video_core/renderer_opengl/gl_shaders.h index 6ccf3fe03..517396021 100644 --- a/src/video_core/renderer_opengl/gl_shaders.h +++ b/src/video_core/renderer_opengl/gl_shaders.h @@ -147,7 +147,7 @@ struct TEVConfig ivec3 color_modifiers; ivec3 alpha_modifiers; ivec2 color_alpha_op; - vec2 color_alpha_multiplier; + ivec2 color_alpha_multiplier; vec4 const_color; bvec2 updates_combiner_buffer_color_alpha; }; @@ -248,7 +248,7 @@ vec3 ColorCombine(int op, vec3 color[3]) { } else if (op == OPERATION_ADD) { return min(color[0] + color[1], 1.0); } else if (op == OPERATION_ADDSIGNED) { - return color[0] + color[1] - vec3(0.5, 0.5, 0.5); + return clamp(color[0] + color[1] - vec3(0.5, 0.5, 0.5), 0.0, 1.0); } else if (op == OPERATION_LERP) { return color[0] * color[2] + color[1] * (vec3(1.0, 1.0, 1.0) - color[2]); } else if (op == OPERATION_SUBTRACT) { @@ -270,7 +270,7 @@ float AlphaCombine(int op, float alpha[3]) { } else if (op == OPERATION_ADD) { return min(alpha[0] + alpha[1], 1.0); } else if (op == OPERATION_ADDSIGNED) { - return alpha[0] + alpha[1] - 0.5; + return clamp(alpha[0] + alpha[1] - 0.5, 0.0, 1.0); } else if (op == OPERATION_LERP) { return alpha[0] * alpha[2] + alpha[1] * (1.0 - alpha[2]); } else if (op == OPERATION_SUBTRACT) {