summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-26 05:01:41 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 20:55:23 +0100
commit04d11341911a0c9ed3558fc6084d305ae262399a (patch)
tree914f6193fce38f2fd52dce46442fb21254e5ea57 /src
parentgl_state: Remove VAO cache and tracking (diff)
downloadyuzu-04d11341911a0c9ed3558fc6084d305ae262399a.tar
yuzu-04d11341911a0c9ed3558fc6084d305ae262399a.tar.gz
yuzu-04d11341911a0c9ed3558fc6084d305ae262399a.tar.bz2
yuzu-04d11341911a0c9ed3558fc6084d305ae262399a.tar.lz
yuzu-04d11341911a0c9ed3558fc6084d305ae262399a.tar.xz
yuzu-04d11341911a0c9ed3558fc6084d305ae262399a.tar.zst
yuzu-04d11341911a0c9ed3558fc6084d305ae262399a.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_state.h5
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp8
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp8
6 files changed, 25 insertions, 21 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 9658d379c..f5aa84a16 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -332,7 +332,6 @@ void RasterizerOpenGL::ConfigureFramebuffers() {
View depth_surface = texture_cache.GetDepthBufferSurface(true);
const auto& regs = gpu.regs;
- state.framebuffer_srgb.enabled = regs.framebuffer_srgb != 0;
UNIMPLEMENTED_IF(regs.rt_separate_frag_data == 0);
// Bind the framebuffer surfaces
@@ -455,6 +454,9 @@ void RasterizerOpenGL::Clear() {
}
}
+ // TODO: Signal state tracker about these changes
+ SyncFramebufferSRGB();
+
if (!use_color && !use_depth && !use_stencil) {
// No color surface nor depth/stencil surface are enabled
return;
@@ -511,6 +513,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
SyncPointState();
SyncPolygonOffset();
SyncAlphaTest();
+ SyncFramebufferSRGB();
buffer_cache.Acquire();
@@ -1198,4 +1201,9 @@ void RasterizerOpenGL::SyncAlphaTest() {
}
}
+void RasterizerOpenGL::SyncFramebufferSRGB() {
+ const auto& regs = system.GPU().Maxwell3D().regs;
+ oglEnable(GL_FRAMEBUFFER_SRGB, regs.framebuffer_srgb);
+}
+
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index b97f9f518..91179323d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -187,6 +187,9 @@ private:
/// Syncs the alpha test state to match the guest state
void SyncAlphaTest();
+ /// Syncs the framebuffer sRGB state to match the guest state
+ void SyncFramebufferSRGB();
+
/// Check for extension that are not strictly required but are needed for correct emulation
void CheckExtensions();
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 1c39e7fba..e67db758d 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -131,17 +131,6 @@ void OpenGLState::ApplyMultisample() {
multisample_control.alpha_to_one);
}
-void OpenGLState::ApplySRgb() {
- if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled)
- return;
- cur_state.framebuffer_srgb.enabled = framebuffer_srgb.enabled;
- if (framebuffer_srgb.enabled) {
- glEnable(GL_FRAMEBUFFER_SRGB);
- } else {
- glDisable(GL_FRAMEBUFFER_SRGB);
- }
-}
-
void OpenGLState::ApplyRasterizerDiscard() {
Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
}
@@ -341,7 +330,6 @@ void OpenGLState::Apply() {
ApplyColorMask();
ApplyViewport();
ApplyStencilTest();
- ApplySRgb();
ApplyBlending();
ApplyTextures();
ApplySamplers();
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index f7c722b36..6c5126687 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -14,10 +14,6 @@ namespace OpenGL {
class OpenGLState {
public:
struct {
- bool enabled = false; // GL_FRAMEBUFFER_SRGB
- } framebuffer_srgb;
-
- struct {
bool alpha_to_coverage = false; // GL_ALPHA_TO_COVERAGE
bool alpha_to_one = false; // GL_ALPHA_TO_ONE
} multisample_control;
@@ -121,7 +117,6 @@ public:
void ApplyClipDistances();
void ApplyFragmentColorClamp();
void ApplyMultisample();
- void ApplySRgb();
void ApplyRasterizerDiscard();
void ApplyColorMask();
void ApplyStencilTest();
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 942cc6c0a..0bdbb70a4 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -528,9 +528,15 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
OpenGLState state;
state.draw.read_framebuffer = src_framebuffer.handle;
state.draw.draw_framebuffer = dst_framebuffer.handle;
- state.framebuffer_srgb.enabled = dst_params.srgb_conversion;
state.Apply();
+ // TODO: Signal state tracker about these changes
+ if (dst_params.srgb_conversion) {
+ glEnable(GL_FRAMEBUFFER_SRGB);
+ } else {
+ glDisable(GL_FRAMEBUFFER_SRGB);
+ }
+
u32 buffers{};
UNIMPLEMENTED_IF(src_params.target == SurfaceTarget::Texture3D);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 2fb5938e2..4d41ac7b4 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -555,11 +555,15 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
};
state.textures[0] = screen_info.display_texture;
- state.framebuffer_srgb.enabled = screen_info.display_srgb;
state.Apply();
// TODO: Signal state tracker about these changes
glEnable(GL_CULL_FACE);
+ if (screen_info.display_srgb) {
+ glEnable(GL_FRAMEBUFFER_SRGB);
+ } else {
+ glDisable(GL_FRAMEBUFFER_SRGB);
+ }
glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
@@ -577,8 +581,8 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), std::data(vertices));
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
// Restore default state
- state.framebuffer_srgb.enabled = false;
state.textures[0] = 0;
state.Apply();
}