summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-18 23:26:52 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-12-18 23:28:23 +0100
commitda0aa4da6bc853c7afcc735a1cb68917feeefd42 (patch)
tree62a52db6d684ed7acbbb065c33193a0b382ddacb /src/video_core/renderer_opengl
parentMerge pull request #3173 from yuzu-emu/bunnei-spscqueue (diff)
downloadyuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.tar
yuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.tar.gz
yuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.tar.bz2
yuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.tar.lz
yuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.tar.xz
yuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.tar.zst
yuzu-da0aa4da6bc853c7afcc735a1cb68917feeefd42.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_state.h4
4 files changed, 19 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index f20967d85..dbb08dd80 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -514,6 +514,7 @@ void RasterizerOpenGL::Clear() {
ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
SyncViewport(clear_state);
+ SyncRasterizeEnable(clear_state);
if (regs.clear_flags.scissor) {
SyncScissorTest(clear_state);
}
@@ -541,6 +542,7 @@ void RasterizerOpenGL::Clear() {
void RasterizerOpenGL::DrawPrelude() {
auto& gpu = system.GPU().Maxwell3D();
+ SyncRasterizeEnable(state);
SyncColorMask();
SyncFragmentColorClampState();
SyncMultiSampleState();
@@ -1133,6 +1135,11 @@ void RasterizerOpenGL::SyncStencilTestState() {
}
}
+void RasterizerOpenGL::SyncRasterizeEnable(OpenGLState& current_state) {
+ const auto& regs = system.GPU().Maxwell3D().regs;
+ current_state.rasterizer_discard = regs.rasterize_enable == 0;
+}
+
void RasterizerOpenGL::SyncColorMask() {
auto& maxwell3d = system.GPU().Maxwell3D();
if (!maxwell3d.dirty.color_mask) {
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 04c1ca551..6a27cf497 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -168,6 +168,9 @@ private:
/// Syncs the point state to match the guest state
void SyncPointState();
+ /// Syncs the rasterizer enable state to match the guest state
+ void SyncRasterizeEnable(OpenGLState& current_state);
+
/// Syncs Color Mask
void SyncColorMask();
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index ccc1e050a..df2e2395a 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -182,6 +182,10 @@ void OpenGLState::ApplyCulling() {
}
}
+void OpenGLState::ApplyRasterizerDiscard() {
+ Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
+}
+
void OpenGLState::ApplyColorMask() {
if (!dirty.color_mask) {
return;
@@ -455,6 +459,7 @@ void OpenGLState::Apply() {
ApplyPointSize();
ApplyFragmentColorClamp();
ApplyMultisample();
+ ApplyRasterizerDiscard();
ApplyColorMask();
ApplyDepthClamp();
ApplyViewport();
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 0b5895084..fb180f302 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -48,6 +48,8 @@ public:
GLuint index = 0;
} primitive_restart; // GL_PRIMITIVE_RESTART
+ bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
+
struct ColorMask {
GLboolean red_enabled = GL_TRUE;
GLboolean green_enabled = GL_TRUE;
@@ -56,6 +58,7 @@ public:
};
std::array<ColorMask, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets>
color_mask; // GL_COLOR_WRITEMASK
+
struct {
bool test_enabled = false; // GL_STENCIL_TEST
struct {
@@ -174,6 +177,7 @@ public:
void ApplyMultisample();
void ApplySRgb();
void ApplyCulling();
+ void ApplyRasterizerDiscard();
void ApplyColorMask();
void ApplyDepth();
void ApplyPrimitiveRestart();