Shader multiplier int and clamp correction

This commit is contained in:
tfarley 2015-05-12 16:55:24 -07:00
parent abd79abefa
commit 96bb4f4cf9
2 changed files with 4 additions and 4 deletions

View File

@ -511,7 +511,7 @@ void RasterizerOpenGL::SyncDrawState() {
glUniform3iv(uniform_tev_cfg.color_modifiers, 1, color_mods); glUniform3iv(uniform_tev_cfg.color_modifiers, 1, color_mods);
glUniform3iv(uniform_tev_cfg.alpha_modifiers, 1, alpha_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()); 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); glUniform4fv(uniform_tev_cfg.const_color, 1, const_color);
glUniform2i(uniform_tev_cfg.updates_combiner_buffer_color_alpha, glUniform2i(uniform_tev_cfg.updates_combiner_buffer_color_alpha,
Pica::registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferColor(tev_stage_idx), Pica::registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferColor(tev_stage_idx),

View File

@ -147,7 +147,7 @@ struct TEVConfig
ivec3 color_modifiers; ivec3 color_modifiers;
ivec3 alpha_modifiers; ivec3 alpha_modifiers;
ivec2 color_alpha_op; ivec2 color_alpha_op;
vec2 color_alpha_multiplier; ivec2 color_alpha_multiplier;
vec4 const_color; vec4 const_color;
bvec2 updates_combiner_buffer_color_alpha; bvec2 updates_combiner_buffer_color_alpha;
}; };
@ -248,7 +248,7 @@ vec3 ColorCombine(int op, vec3 color[3]) {
} else if (op == OPERATION_ADD) { } else if (op == OPERATION_ADD) {
return min(color[0] + color[1], 1.0); return min(color[0] + color[1], 1.0);
} else if (op == OPERATION_ADDSIGNED) { } 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) { } else if (op == OPERATION_LERP) {
return color[0] * color[2] + color[1] * (vec3(1.0, 1.0, 1.0) - color[2]); return color[0] * color[2] + color[1] * (vec3(1.0, 1.0, 1.0) - color[2]);
} else if (op == OPERATION_SUBTRACT) { } else if (op == OPERATION_SUBTRACT) {
@ -270,7 +270,7 @@ float AlphaCombine(int op, float alpha[3]) {
} else if (op == OPERATION_ADD) { } else if (op == OPERATION_ADD) {
return min(alpha[0] + alpha[1], 1.0); return min(alpha[0] + alpha[1], 1.0);
} else if (op == OPERATION_ADDSIGNED) { } 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) { } else if (op == OPERATION_LERP) {
return alpha[0] * alpha[2] + alpha[1] * (1.0 - alpha[2]); return alpha[0] * alpha[2] + alpha[1] * (1.0 - alpha[2]);
} else if (op == OPERATION_SUBTRACT) { } else if (op == OPERATION_SUBTRACT) {