summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-10-27 19:25:00 +0200
committerGitHub <noreply@github.com>2018-10-27 19:25:00 +0200
commited95ce6bb7ae91eb294ab044959eef91bf6dd975 (patch)
treec800613b85c3e7bd33baf86f58e1c071e205e73e /src/video_core/renderer_opengl
parentMerge pull request #1599 from FernandoS27/stalemate (diff)
parentgl_rasterizer: Implement primitive restart. (diff)
downloadyuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.tar
yuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.tar.gz
yuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.tar.bz2
yuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.tar.lz
yuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.tar.xz
yuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.tar.zst
yuzu-ed95ce6bb7ae91eb294ab044959eef91bf6dd975.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp15
-rw-r--r--src/video_core/renderer_opengl/gl_state.h5
4 files changed, 31 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index b472f421f..cd4216c4e 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -570,6 +570,7 @@ void RasterizerOpenGL::DrawArrays() {
SyncBlendState();
SyncLogicOpState();
SyncCullMode();
+ SyncPrimitiveRestart();
SyncDepthRange();
SyncScissorTest();
// Alpha Testing is synced on shaders.
@@ -924,6 +925,13 @@ void RasterizerOpenGL::SyncCullMode() {
}
}
+void RasterizerOpenGL::SyncPrimitiveRestart() {
+ const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
+
+ state.primitive_restart.enabled = regs.primitive_restart.enabled;
+ state.primitive_restart.index = regs.primitive_restart.index;
+}
+
void RasterizerOpenGL::SyncDepthRange() {
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 731a336d5..5020a5392 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -144,6 +144,9 @@ private:
/// Syncs the cull mode to match the guest state
void SyncCullMode();
+ /// Syncs the primitve restart to match the guest state
+ void SyncPrimitiveRestart();
+
/// Syncs the depth range to match the guest state
void SyncDepthRange();
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index ba6c6919a..f9d41ca24 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -24,6 +24,9 @@ OpenGLState::OpenGLState() {
depth.depth_range_near = 0.0f;
depth.depth_range_far = 1.0f;
+ primitive_restart.enabled = false;
+ primitive_restart.index = 0;
+
color_mask.red_enabled = GL_TRUE;
color_mask.green_enabled = GL_TRUE;
color_mask.blue_enabled = GL_TRUE;
@@ -127,6 +130,18 @@ void OpenGLState::Apply() const {
glDepthRange(depth.depth_range_near, depth.depth_range_far);
}
+ // Primitive restart
+ if (primitive_restart.enabled != cur_state.primitive_restart.enabled) {
+ if (primitive_restart.enabled) {
+ glEnable(GL_PRIMITIVE_RESTART);
+ } else {
+ glDisable(GL_PRIMITIVE_RESTART);
+ }
+ }
+ if (primitive_restart.index != cur_state.primitive_restart.index) {
+ glPrimitiveRestartIndex(primitive_restart.index);
+ }
+
// Color mask
if (color_mask.red_enabled != cur_state.color_mask.red_enabled ||
color_mask.green_enabled != cur_state.color_mask.green_enabled ||
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index daf7eb533..4334b0d35 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -50,6 +50,11 @@ public:
} depth;
struct {
+ bool enabled;
+ GLuint index;
+ } primitive_restart; // GL_PRIMITIVE_RESTART
+
+ struct {
GLboolean red_enabled;
GLboolean green_enabled;
GLboolean blue_enabled;