gl_state_tracker: Implement dirty flags for front face and culling
This commit is contained in:
parent
b01dd7d1c8
commit
b910a83a47
4 changed files with 38 additions and 7 deletions
|
@ -995,12 +995,25 @@ void RasterizerOpenGL::SyncClipCoef() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncCullMode() {
|
void RasterizerOpenGL::SyncCullMode() {
|
||||||
const auto& regs = system.GPU().Maxwell3D().regs;
|
auto& gpu = system.GPU().Maxwell3D();
|
||||||
|
auto& flags = gpu.dirty.flags;
|
||||||
|
const auto& regs = gpu.regs;
|
||||||
|
|
||||||
oglEnable(GL_CULL_FACE, regs.cull_test_enabled);
|
if (flags[Dirty::CullTest]) {
|
||||||
glCullFace(MaxwellToGL::CullFace(regs.cull_face));
|
flags[Dirty::CullTest] = false;
|
||||||
|
|
||||||
glFrontFace(MaxwellToGL::FrontFace(regs.front_face));
|
if (regs.cull_test_enabled) {
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
glCullFace(MaxwellToGL::CullFace(regs.cull_face));
|
||||||
|
} else {
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags[Dirty::FrontFace]) {
|
||||||
|
flags[Dirty::FrontFace] = false;
|
||||||
|
glFrontFace(MaxwellToGL::FrontFace(regs.front_face));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
||||||
|
|
|
@ -145,7 +145,14 @@ void SetupDirtyBlend(Tables& tables) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDirtyMisc(Tables& tables) {
|
void SetupDirtyMisc(Tables& tables) {
|
||||||
tables[0][OFF(clip_distance_enabled)] = ClipDistances;
|
auto& table = tables[0];
|
||||||
|
|
||||||
|
table[OFF(clip_distance_enabled)] = ClipDistances;
|
||||||
|
|
||||||
|
table[OFF(front_face)] = FrontFace;
|
||||||
|
|
||||||
|
table[OFF(cull_test_enabled)] = CullTest;
|
||||||
|
table[OFF(cull_face)] = CullTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
|
@ -56,9 +56,8 @@ enum : u8 {
|
||||||
Shaders,
|
Shaders,
|
||||||
ClipDistances,
|
ClipDistances,
|
||||||
|
|
||||||
CullTestEnable,
|
|
||||||
FrontFace,
|
FrontFace,
|
||||||
CullFace,
|
CullTest,
|
||||||
PrimitiveRestart,
|
PrimitiveRestart,
|
||||||
DepthTest,
|
DepthTest,
|
||||||
StencilTest,
|
StencilTest,
|
||||||
|
@ -120,6 +119,16 @@ public:
|
||||||
flags[VideoCommon::Dirty::RenderTargets] = true;
|
flags[VideoCommon::Dirty::RenderTargets] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotifyFrontFace() {
|
||||||
|
auto& flags = system.GPU().Maxwell3D().dirty.flags;
|
||||||
|
flags[OpenGL::Dirty::FrontFace] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotifyCullTest() {
|
||||||
|
auto& flags = system.GPU().Maxwell3D().dirty.flags;
|
||||||
|
flags[OpenGL::Dirty::CullTest] = true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
|
@ -582,6 +582,8 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
||||||
state_tracker.NotifyColorMask0();
|
state_tracker.NotifyColorMask0();
|
||||||
state_tracker.NotifyBlend0();
|
state_tracker.NotifyBlend0();
|
||||||
state_tracker.NotifyFramebuffer();
|
state_tracker.NotifyFramebuffer();
|
||||||
|
state_tracker.NotifyFrontFace();
|
||||||
|
state_tracker.NotifyCullTest();
|
||||||
|
|
||||||
program_manager.UseVertexShader(vertex_program.handle);
|
program_manager.UseVertexShader(vertex_program.handle);
|
||||||
program_manager.UseGeometryShader(0);
|
program_manager.UseGeometryShader(0);
|
||||||
|
|
Loading…
Reference in a new issue