diff options
| author | 2015-11-25 20:30:27 -0500 | |
|---|---|---|
| committer | 2016-02-05 17:20:17 -0500 | |
| commit | 449902b5583d6a2dbb1e4aea9802da5ad2493981 (patch) | |
| tree | de843ac8fb02db3d909a2ecf399c545b8a3ff569 /src | |
| parent | gl_shader_gen: Implement lighting red, green, and blue reflection. (diff) | |
| download | yuzu-449902b5583d6a2dbb1e4aea9802da5ad2493981.tar.gz yuzu-449902b5583d6a2dbb1e4aea9802da5ad2493981.tar.xz yuzu-449902b5583d6a2dbb1e4aea9802da5ad2493981.zip | |
gl_shader_gen: Fix bug in LUT range (should within range [0, 255] not [0, 256]).
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 6 |
1 files changed, 3 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 984aef586..d59f2054b 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp | |||
| @@ -362,11 +362,11 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) { | |||
| 362 | if (abs) { | 362 | if (abs) { |
| 363 | // LUT index is in the range of (0.0, 1.0) | 363 | // LUT index is in the range of (0.0, 1.0) |
| 364 | index = config.lighting.light[light_num].two_sided_diffuse ? "abs(" + index + ")" : "max(" + index + ", 0.f)"; | 364 | index = config.lighting.light[light_num].two_sided_diffuse ? "abs(" + index + ")" : "max(" + index + ", 0.f)"; |
| 365 | return "clamp(" + index + ", 0.0, FLOAT_255)"; | 365 | return "(FLOAT_255 * clamp(" + index + ", 0.0, 1.0))"; |
| 366 | } else { | 366 | } else { |
| 367 | // LUT index is in the range of (-1.0, 1.0) | 367 | // LUT index is in the range of (-1.0, 1.0) |
| 368 | index = "clamp(" + index + ", -1.0, 1.0)"; | 368 | index = "clamp(" + index + ", -1.0, 1.0)"; |
| 369 | return "clamp(((" + index + " < 0) ? " + index + " + 2.0 : " + index + ") / 2.0, 0.0, FLOAT_255)"; | 369 | return "(FLOAT_255 * ((" + index + " < 0) ? " + index + " + 2.0 : " + index + ") / 2.0)"; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | return std::string(); | 372 | return std::string(); |
| @@ -487,7 +487,7 @@ std::string GenerateFragmentShader(const PicaShaderConfig& config) { | |||
| 487 | #define NUM_TEV_STAGES 6 | 487 | #define NUM_TEV_STAGES 6 |
| 488 | #define NUM_LIGHTS 8 | 488 | #define NUM_LIGHTS 8 |
| 489 | #define LIGHTING_LUT_SIZE 256 | 489 | #define LIGHTING_LUT_SIZE 256 |
| 490 | #define FLOAT_255 0.99609375 | 490 | #define FLOAT_255 (255.0 / 256.0) |
| 491 | 491 | ||
| 492 | in vec4 primary_color; | 492 | in vec4 primary_color; |
| 493 | in vec2 texcoord[3]; | 493 | in vec2 texcoord[3]; |