summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jannik Vogel2016-12-25 20:56:42 +0100
committerGravatar Jannik Vogel2016-12-25 21:38:10 +0100
commit6ed4206f878da69bbd71e018eb6c82872a1f328b (patch)
tree67f4d248d80e59002a751cf40c50cbdd395e31c3 /src
parentOffset lighting LUT samples correctly (diff)
downloadyuzu-6ed4206f878da69bbd71e018eb6c82872a1f328b.tar.gz
yuzu-6ed4206f878da69bbd71e018eb6c82872a1f328b.tar.xz
yuzu-6ed4206f878da69bbd71e018eb6c82872a1f328b.zip
Minor cleanup in GLSL code
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp5
1 files changed, 2 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 d485ddacf..4c4f98ac9 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -293,7 +293,7 @@ static void AppendAlphaTestCondition(std::string& out, Regs::CompareFunc func) {
293 case CompareFunc::GreaterThanOrEqual: { 293 case CompareFunc::GreaterThanOrEqual: {
294 static const char* op[] = {"!=", "==", ">=", ">", "<=", "<"}; 294 static const char* op[] = {"!=", "==", ">=", ">", "<=", "<"};
295 unsigned index = (unsigned)func - (unsigned)CompareFunc::Equal; 295 unsigned index = (unsigned)func - (unsigned)CompareFunc::Equal;
296 out += "int(last_tex_env_out.a * 255.0f) " + std::string(op[index]) + " alphatest_ref"; 296 out += "int(last_tex_env_out.a * 255.0) " + std::string(op[index]) + " alphatest_ref";
297 break; 297 break;
298 } 298 }
299 299
@@ -422,7 +422,7 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) {
422 if (abs) { 422 if (abs) {
423 // LUT index is in the range of (0.0, 1.0) 423 // LUT index is in the range of (0.0, 1.0)
424 index = lighting.light[light_num].two_sided_diffuse ? "abs(" + index + ")" 424 index = lighting.light[light_num].two_sided_diffuse ? "abs(" + index + ")"
425 : "max(" + index + ", 0.f)"; 425 : "max(" + index + ", 0.0)";
426 } else { 426 } else {
427 // LUT index is in the range of (-1.0, 1.0) 427 // LUT index is in the range of (-1.0, 1.0)
428 index = "((" + index + " < 0) ? " + index + " + 2.0 : " + index + ") / 2.0"; 428 index = "((" + index + " < 0) ? " + index + " + 2.0 : " + index + ") / 2.0";
@@ -577,7 +577,6 @@ std::string GenerateFragmentShader(const PicaShaderConfig& config) {
577#version 330 core 577#version 330 core
578#define NUM_TEV_STAGES 6 578#define NUM_TEV_STAGES 6
579#define NUM_LIGHTS 8 579#define NUM_LIGHTS 8
580#define LIGHTING_LUT_SIZE 256
581 580
582// Texture coordinate offsets and scales 581// Texture coordinate offsets and scales
583#define OFFSET_256 (0.5 / 256.0) 582#define OFFSET_256 (0.5 / 256.0)