forked from ShuriZma/suyu
1
0
Fork 0

gl_state_tracker: Implement dirty flags for rasterize enable

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

View File

@ -1090,8 +1090,14 @@ void RasterizerOpenGL::SyncStencilTestState() {
} }
void RasterizerOpenGL::SyncRasterizeEnable() { void RasterizerOpenGL::SyncRasterizeEnable() {
const auto& regs = system.GPU().Maxwell3D().regs; auto& gpu = system.GPU().Maxwell3D();
oglEnable(GL_RASTERIZER_DISCARD, regs.rasterize_enable == 0); auto& flags = gpu.dirty.flags;
if (!flags[Dirty::RasterizeEnable]) {
return;
}
flags[Dirty::RasterizeEnable] = false;
oglEnable(GL_RASTERIZER_DISCARD, gpu.regs.rasterize_enable == 0);
} }
void RasterizerOpenGL::SyncColorMask() { void RasterizerOpenGL::SyncColorMask() {

View File

@ -189,6 +189,10 @@ void SetupDirtyMultisampleControl(Tables& tables) {
FillBlock(tables[0], OFF(multisample_control), NUM(multisample_control), MultisampleControl); FillBlock(tables[0], OFF(multisample_control), NUM(multisample_control), MultisampleControl);
} }
void SetupDirtyRasterizeEnable(Tables& tables) {
tables[0][OFF(rasterize_enable)] = RasterizeEnable;
}
void SetupDirtyMisc(Tables& tables) { void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0]; auto& table = tables[0];
@ -221,6 +225,7 @@ void StateTracker::Initialize() {
SetupDirtyPrimitiveRestart(tables); SetupDirtyPrimitiveRestart(tables);
SetupDirtyPolygonOffset(tables); SetupDirtyPolygonOffset(tables);
SetupDirtyMultisampleControl(tables); SetupDirtyMultisampleControl(tables);
SetupDirtyRasterizeEnable(tables);
SetupDirtyMisc(tables); SetupDirtyMisc(tables);
auto& store = dirty.on_write_stores; auto& store = dirty.on_write_stores;

View File

@ -66,6 +66,7 @@ enum : u8 {
PrimitiveRestart, PrimitiveRestart,
PolygonOffset, PolygonOffset,
MultisampleControl, MultisampleControl,
RasterizeEnable,
Last Last
}; };
@ -147,6 +148,11 @@ public:
flags[OpenGL::Dirty::PolygonOffset] = true; flags[OpenGL::Dirty::PolygonOffset] = true;
} }
void NotifyRasterizeEnable() {
auto& flags = system.GPU().Maxwell3D().dirty.flags;
flags[OpenGL::Dirty::RasterizeEnable] = true;
}
private: private:
Core::System& system; Core::System& system;
}; };

View File

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

View File

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