summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2018-10-12 02:29:11 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2018-10-22 21:35:45 +0200
commit8e1239fbc59325f5a9898329af869ae575ec983f (patch)
treecf0f76b28c1c67a800c723136c7e6000d9e380f6 /src/video_core
parentUse standard UBO and fix/stylize the code (diff)
downloadyuzu-8e1239fbc59325f5a9898329af869ae575ec983f.tar
yuzu-8e1239fbc59325f5a9898329af869ae575ec983f.tar.gz
yuzu-8e1239fbc59325f5a9898329af869ae575ec983f.tar.bz2
yuzu-8e1239fbc59325f5a9898329af869ae575ec983f.tar.lz
yuzu-8e1239fbc59325f5a9898329af869ae575ec983f.tar.xz
yuzu-8e1239fbc59325f5a9898329af869ae575ec983f.tar.zst
yuzu-8e1239fbc59325f5a9898329af869ae575ec983f.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp5
3 files changed, 17 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index d93681813..be51c5215 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -574,6 +574,7 @@ void RasterizerOpenGL::DrawArrays() {
// Alpha Testing is synced on shaders.
SyncTransformFeedback();
SyncPointState();
+ CheckAlphaTests();
// TODO(bunnei): Sync framebuffer_scale uniform here
// TODO(bunnei): Sync scissorbox uniform(s) here
@@ -1041,4 +1042,15 @@ void RasterizerOpenGL::SyncPointState() {
state.point.size = regs.point_size == 0 ? 1 : regs.point_size;
}
+void RasterizerOpenGL::CheckAlphaTests() {
+ const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
+
+ if (regs.alpha_test_enabled != 0 && regs.rt_control.count > 1) {
+ LOG_CRITICAL(
+ Render_OpenGL,
+ "Alpha Testing is enabled with Multiple Render Targets, this behavior is undefined.");
+ UNREACHABLE();
+ }
+}
+
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index ece5cb2c4..0e90a31f5 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -171,6 +171,9 @@ private:
/// Syncs the point state to match the guest state
void SyncPointState();
+ /// Check asserts for alpha testing.
+ void CheckAlphaTests();
+
bool has_ARB_direct_state_access = false;
bool has_ARB_multi_bind = false;
bool has_ARB_separate_shader_objects = false;
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 6fdfc742b..f224cb5b2 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1276,9 +1276,8 @@ private:
header.ps.IsColorComponentOutputEnabled(render_target, 1) ||
header.ps.IsColorComponentOutputEnabled(render_target, 2) ||
header.ps.IsColorComponentOutputEnabled(render_target, 3)) {
- shader.AddLine(fmt::format(
- "if (AlphaFunc({})) discard;",
- regs.GetRegisterAsFloat(current_reg)));
+ shader.AddLine(fmt::format("if (!AlphaFunc({})) discard;",
+ regs.GetRegisterAsFloat(current_reg)));
current_reg += 4;
}
}