diff options
author | bunnei <bunneidev@gmail.com> | 2015-10-02 00:34:10 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-10-22 03:51:23 +0200 |
commit | 82f3e6dc69d23c3e70c1ad2805e2e15397cd9156 (patch) | |
tree | f12443b88d9f95d6bf2bbc1599ba4da47438df24 /src | |
parent | Initial implementation of fragment shader generation with caching. (diff) | |
download | yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.tar yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.tar.gz yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.tar.bz2 yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.tar.lz yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.tar.xz yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.tar.zst yuzu-82f3e6dc69d23c3e70c1ad2805e2e15397cd9156.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_util.cpp | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 45329d561..38d184ae2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -195,7 +195,7 @@ void RasterizerOpenGL::RegenerateShaders() { // Sync alpha reference if (current_shader->uniform_alphatest_ref != -1) - glUniform1f(current_shader->uniform_alphatest_ref, regs.output_merger.alpha_test.ref / 255.0f); + glUniform1i(current_shader->uniform_alphatest_ref, regs.output_merger.alpha_test.ref); // Sync combiner buffer color if (current_shader->uniform_tev_combiner_buffer_color != -1) { @@ -655,7 +655,7 @@ void RasterizerOpenGL::SyncBlendColor() { void RasterizerOpenGL::SyncAlphaTest() { const auto& regs = Pica::g_state.regs; if (current_shader->uniform_alphatest_ref != -1) - glUniform1f(current_shader->uniform_alphatest_ref, regs.output_merger.alpha_test.ref / 255.0f); + glUniform1i(current_shader->uniform_alphatest_ref, regs.output_merger.alpha_test.ref); } void RasterizerOpenGL::SyncLogicOp() { diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index ee32f6a31..2c049e940 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -336,22 +336,22 @@ void AppendAlphaTestCondition(std::string& shader, Pica::Regs::CompareFunc func) shader += "false"; break; case CompareFunc::Equal: - shader += "g_last_tex_env_out.a != alphatest_ref"; + shader += "int(g_last_tex_env_out.a * 255.0f) != alphatest_ref"; break; case CompareFunc::NotEqual: - shader += "g_last_tex_env_out.a == alphatest_ref"; + shader += "int(g_last_tex_env_out.a * 255.0f) == alphatest_ref"; break; case CompareFunc::LessThan: - shader += "g_last_tex_env_out.a >= alphatest_ref"; + shader += "int(g_last_tex_env_out.a * 255.0f) >= alphatest_ref"; break; case CompareFunc::LessThanOrEqual: - shader += "g_last_tex_env_out.a > alphatest_ref"; + shader += "int(g_last_tex_env_out.a * 255.0f) > alphatest_ref"; break; case CompareFunc::GreaterThan: - shader += "g_last_tex_env_out.a <= alphatest_ref"; + shader += "int(g_last_tex_env_out.a * 255.0f) <= alphatest_ref"; break; case CompareFunc::GreaterThanOrEqual: - shader += "g_last_tex_env_out.a < alphatest_ref"; + shader += "int(g_last_tex_env_out.a * 255.0f) < alphatest_ref"; break; default: shader += "false"; @@ -370,7 +370,7 @@ std::string GenerateFragmentShader(const ShaderCacheKey& config) { in vec4 o[NUM_VTX_ATTR]; out vec4 color; -uniform float alphatest_ref; +uniform int alphatest_ref; uniform vec4 const_color[NUM_TEV_STAGES]; uniform sampler2D tex[3]; |