summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-07-14 21:00:37 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-07-17 23:29:54 +0200
commit8cdbfe69b1211431536414e375f0fd49222d9a29 (patch)
treedac0320358b55acc6a431c07e38d7da4fb156ec2 /src/video_core
parentMaxwell3D: Correct marking dirtiness on CB upload (diff)
downloadyuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.gz
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.bz2
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.lz
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.xz
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.zst
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp20
-rw-r--r--src/video_core/renderer_opengl/gl_state.h6
4 files changed, 28 insertions, 12 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 0c4e72dfe..97422e700 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -568,7 +568,7 @@ void Maxwell3D::FinishCBData() {
const u32 id = cb_data_state.id;
memory_manager.WriteBlock(address, cb_data_state.buff[id].data(), size);
- dirty.ResetVertexArrays();
+ dirty.OnMemoryWrite();
cb_data_state.id = null_cb_data;
cb_data_state.current = null_cb_data;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 4aa3d6548..77195ad93 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -604,7 +604,8 @@ void RasterizerOpenGL::Clear() {
prev_state.Apply();
});
- OpenGLState clear_state;
+ OpenGLState clear_state{OpenGLState::GetCurState()};
+ clear_state.DefaultViewports();
if (regs.clear_buffers.R || regs.clear_buffers.G || regs.clear_buffers.B ||
regs.clear_buffers.A) {
use_color = true;
@@ -624,6 +625,7 @@ void RasterizerOpenGL::Clear() {
// true.
clear_state.depth.test_enabled = true;
clear_state.depth.test_func = GL_ALWAYS;
+ clear_state.depth.write_mask = GL_TRUE;
}
if (regs.clear_buffers.S) {
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
@@ -661,6 +663,7 @@ void RasterizerOpenGL::Clear() {
}
ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
+
SyncViewport(clear_state);
if (regs.clear_flags.scissor) {
SyncScissorTest(clear_state);
@@ -670,11 +673,8 @@ void RasterizerOpenGL::Clear() {
clear_state.EmulateViewportWithScissor();
}
- clear_state.ApplyColorMask();
- clear_state.ApplyDepth();
- clear_state.ApplyStencilTest();
- clear_state.ApplyViewport();
- clear_state.ApplyFramebufferState();
+ clear_state.AllDirty();
+ clear_state.Apply();
if (use_color) {
glClearBufferfv(GL_COLOR, 0, regs.clear_color);
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index cac03dc31..8d62045b0 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -165,6 +165,26 @@ OpenGLState::OpenGLState() {
alpha_test.ref = 0.0f;
}
+void OpenGLState::DefaultViewports() {
+ for (auto& item : viewports) {
+ item.x = 0;
+ item.y = 0;
+ item.width = 0;
+ item.height = 0;
+ item.depth_range_near = 0.0f;
+ item.depth_range_far = 1.0f;
+ item.scissor.enabled = false;
+ item.scissor.x = 0;
+ item.scissor.y = 0;
+ item.scissor.width = 0;
+ item.scissor.height = 0;
+ }
+
+ depth_clamp.far_plane = false;
+ depth_clamp.near_plane = false;
+
+}
+
void OpenGLState::ApplyDefaultState() {
glEnable(GL_BLEND);
glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 3d0f6747f..2860a2c82 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -195,6 +195,7 @@ public:
s_rgb_used = false;
}
+ void DefaultViewports();
/// Apply this state as the current OpenGL state
void Apply();
@@ -245,10 +246,6 @@ public:
dirty.stencil_state = is_dirty;
}
- void MarkDirtyViewportState(const bool is_dirty) {
- dirty.viewport_state = is_dirty;
- }
-
void MarkDirtyPolygonOffset(const bool is_dirty) {
dirty.polygon_offset = is_dirty;
}
@@ -260,7 +257,6 @@ public:
void AllDirty() {
dirty.blend_state = true;
dirty.stencil_state = true;
- dirty.viewport_state = true;
dirty.polygon_offset = true;
dirty.color_mask = true;
}