diff options
author | bunnei <bunneidev@gmail.com> | 2015-11-17 02:56:28 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2016-02-05 23:17:31 +0100 |
commit | 603b619cbe81ba1fc4dda83dfd88d99e53c95270 (patch) | |
tree | 020f89f4060b5bf819aaca9c9ea3d190d080dfab /src/video_core/renderer_opengl/gl_shader_gen.cpp | |
parent | renderer_opengl: Use textures for fragment shader LUTs instead of UBOs. (diff) | |
download | yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.tar yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.tar.gz yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.tar.bz2 yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.tar.lz yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.tar.xz yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.tar.zst yuzu-603b619cbe81ba1fc4dda83dfd88d99e53c95270.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_gen.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index cb570c4d2..73de94457 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -368,19 +368,19 @@ vec4 secondary_fragment_color = vec4(0.0); out += "vec3 specular_sum = vec3(0.0);\n"; out += "vec3 fragment_position = -view;\n"; out += "vec3 light_vector = vec3(0.0);\n"; + out += "vec3 half_angle_vector = vec3(0.0);\n"; out += "float dist_atten = 1.0;\n"; // Gets the index into the specified lookup table for specular lighting auto GetLutIndex = [&](unsigned light_num, Regs::LightingLutInput input, bool abs) { - const std::string half_angle = "normalize(view + light_vector)"; std::string index; switch (input) { case Regs::LightingLutInput::NH: - index = "dot(normal, " + half_angle + ")"; + index = "dot(normal, half_angle_vector)"; break; case Regs::LightingLutInput::VH: - index = std::string("dot(view, " + half_angle + ")"); + index = std::string("dot(view, half_angle_vector)"); break; case Regs::LightingLutInput::NV: @@ -441,6 +441,7 @@ vec4 secondary_fragment_color = vec4(0.0); out += "diffuse_sum += ((light_src[" + std::to_string(num) + "].diffuse * " + dot_product + ") + light_src[" + std::to_string(num) + "].ambient) * dist_atten;\n"; // Compute secondary fragment color (specular lighting) function + out += "half_angle_vector = normalize(normalize(view) + light_vector);\n"; std::string clamped_lut_index = GetLutIndex(num, config.lighting_lut.d0_type, config.lighting_lut.d0_abs); const unsigned lut_num = (unsigned)Regs::LightingSampler::Distribution0; std::string lut_lookup = "texture(lut[" + std::to_string(lut_num / 4) + "], " + clamped_lut_index + ")[" + std::to_string(lut_num & 3) + "]"; |