summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-04-21 23:03:22 +0200
committerGitHub <noreply@github.com>2017-04-21 23:03:22 +0200
commitea53d6085a454215b4279e1c365273ef0b0202c8 (patch)
tree541a9579b76d955a5a543cd6c8451e489424c20c /src/video_core/renderer_opengl
parentMerge pull request #2666 from yuriks/gl-cleanups (diff)
parentgl_shader_gen: remove TODO about Lerp behaviour verification. The implementation is verified against hardware (diff)
downloadyuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.tar
yuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.tar.gz
yuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.tar.bz2
yuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.tar.lz
yuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.tar.xz
yuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.tar.zst
yuzu-ea53d6085a454215b4279e1c365273ef0b0202c8.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 54a8dde15..0f889b172 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -306,8 +306,6 @@ static void AppendColorCombiner(std::string& out, TevStageConfig::Operation oper
out += variable_name + "[0] + " + variable_name + "[1] - vec3(0.5)";
break;
case Operation::Lerp:
- // TODO(bunnei): Verify if HW actually does this per-component, otherwise we can just use
- // builtin lerp
out += variable_name + "[0] * " + variable_name + "[2] + " + variable_name +
"[1] * (vec3(1.0) - " + variable_name + "[2])";
break;
@@ -322,6 +320,7 @@ static void AppendColorCombiner(std::string& out, TevStageConfig::Operation oper
variable_name + "[2]";
break;
case Operation::Dot3_RGB:
+ case Operation::Dot3_RGBA:
out += "vec3(dot(" + variable_name + "[0] - vec3(0.5), " + variable_name +
"[1] - vec3(0.5)) * 4.0)";
break;
@@ -421,17 +420,25 @@ static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsi
AppendColorCombiner(out, stage.color_op, "color_results_" + index_name);
out += ";\n";
- out += "float alpha_results_" + index_name + "[3] = float[3](";
- AppendAlphaModifier(out, config, stage.alpha_modifier1, stage.alpha_source1, index_name);
- out += ", ";
- AppendAlphaModifier(out, config, stage.alpha_modifier2, stage.alpha_source2, index_name);
- out += ", ";
- AppendAlphaModifier(out, config, stage.alpha_modifier3, stage.alpha_source3, index_name);
- out += ");\n";
-
- out += "float alpha_output_" + index_name + " = ";
- AppendAlphaCombiner(out, stage.alpha_op, "alpha_results_" + index_name);
- out += ";\n";
+ if (stage.color_op == TevStageConfig::Operation::Dot3_RGBA) {
+ // result of Dot3_RGBA operation is also placed to the alpha component
+ out += "float alpha_output_" + index_name + " = color_output_" + index_name + "[0];\n";
+ } else {
+ out += "float alpha_results_" + index_name + "[3] = float[3](";
+ AppendAlphaModifier(out, config, stage.alpha_modifier1, stage.alpha_source1,
+ index_name);
+ out += ", ";
+ AppendAlphaModifier(out, config, stage.alpha_modifier2, stage.alpha_source2,
+ index_name);
+ out += ", ";
+ AppendAlphaModifier(out, config, stage.alpha_modifier3, stage.alpha_source3,
+ index_name);
+ out += ");\n";
+
+ out += "float alpha_output_" + index_name + " = ";
+ AppendAlphaCombiner(out, stage.alpha_op, "alpha_results_" + index_name);
+ out += ";\n";
+ }
out += "last_tex_env_out = vec4("
"clamp(color_output_" +