yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

gl_state_tracker: Implement dirty flags for sRGB

This commit is contained in:
ReinUsesLisp 2019-12-30 00:53:53 -03:00
parent d8f5c45051
commit 13afd0e5b0
5 changed files with 21 additions and 2 deletions

View File

@ -1301,8 +1301,14 @@ void RasterizerOpenGL::SyncAlphaTest() {
} }
void RasterizerOpenGL::SyncFramebufferSRGB() { void RasterizerOpenGL::SyncFramebufferSRGB() {
const auto& regs = system.GPU().Maxwell3D().regs; auto& gpu = system.GPU().Maxwell3D();
oglEnable(GL_FRAMEBUFFER_SRGB, regs.framebuffer_srgb); auto& flags = gpu.dirty.flags;
if (!flags[Dirty::FramebufferSRGB]) {
return;
}
flags[Dirty::FramebufferSRGB] = false;
oglEnable(GL_FRAMEBUFFER_SRGB, gpu.regs.framebuffer_srgb);
} }
} // namespace OpenGL } // namespace OpenGL

View File

@ -193,6 +193,10 @@ void SetupDirtyRasterizeEnable(Tables& tables) {
tables[0][OFF(rasterize_enable)] = RasterizeEnable; tables[0][OFF(rasterize_enable)] = RasterizeEnable;
} }
void SetupDirtyFramebufferSRGB(Tables& tables) {
tables[0][OFF(framebuffer_srgb)] = FramebufferSRGB;
}
void SetupDirtyMisc(Tables& tables) { void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0]; auto& table = tables[0];
@ -226,6 +230,7 @@ void StateTracker::Initialize() {
SetupDirtyPolygonOffset(tables); SetupDirtyPolygonOffset(tables);
SetupDirtyMultisampleControl(tables); SetupDirtyMultisampleControl(tables);
SetupDirtyRasterizeEnable(tables); SetupDirtyRasterizeEnable(tables);
SetupDirtyFramebufferSRGB(tables);
SetupDirtyMisc(tables); SetupDirtyMisc(tables);
auto& store = dirty.on_write_stores; auto& store = dirty.on_write_stores;

View File

@ -67,6 +67,7 @@ enum : u8 {
PolygonOffset, PolygonOffset,
MultisampleControl, MultisampleControl,
RasterizeEnable, RasterizeEnable,
FramebufferSRGB,
Last Last
}; };
@ -153,6 +154,11 @@ public:
flags[OpenGL::Dirty::RasterizeEnable] = true; flags[OpenGL::Dirty::RasterizeEnable] = true;
} }
void NotifyFramebufferSRGB() {
auto& flags = system.GPU().Maxwell3D().dirty.flags;
flags[OpenGL::Dirty::FramebufferSRGB] = true;
}
private: private:
Core::System& system; Core::System& system;
}; };

View File

@ -523,6 +523,7 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
state_tracker.NotifyBlend0(); state_tracker.NotifyBlend0();
state_tracker.NotifyFramebuffer(); state_tracker.NotifyFramebuffer();
state_tracker.NotifyRasterizeEnable(); state_tracker.NotifyRasterizeEnable();
state_tracker.NotifyFramebufferSRGB();
if (dst_params.srgb_conversion) { if (dst_params.srgb_conversion) {
glEnable(GL_FRAMEBUFFER_SRGB); glEnable(GL_FRAMEBUFFER_SRGB);

View File

@ -588,6 +588,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
state_tracker.NotifyStencilTest(); state_tracker.NotifyStencilTest();
state_tracker.NotifyPolygonOffset(); state_tracker.NotifyPolygonOffset();
state_tracker.NotifyRasterizeEnable(); state_tracker.NotifyRasterizeEnable();
state_tracker.NotifyFramebufferSRGB();
program_manager.UseVertexShader(vertex_program.handle); program_manager.UseVertexShader(vertex_program.handle);
program_manager.UseGeometryShader(0); program_manager.UseGeometryShader(0);