mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
gl_state: Remove framebuffer sRGB tracking
This commit is contained in:
parent
d5ab0358b6
commit
04d1134191
6 changed files with 25 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -13,10 +13,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
|
||||
|
@ -121,7 +117,6 @@ public:
|
|||
void ApplyClipDistances();
|
||||
void ApplyFragmentColorClamp();
|
||||
void ApplyMultisample();
|
||||
void ApplySRgb();
|
||||
void ApplyRasterizerDiscard();
|
||||
void ApplyColorMask();
|
||||
void ApplyStencilTest();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue