gl_state_tracker: Implement dirty flags for front face and culling
This commit is contained in:
parent
b01dd7d1c8
commit
b910a83a47
|
@ -995,12 +995,25 @@ void RasterizerOpenGL::SyncClipCoef() {
|
|||
}
|
||||
|
||||
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);
|
||||
glCullFace(MaxwellToGL::CullFace(regs.cull_face));
|
||||
if (flags[Dirty::CullTest]) {
|
||||
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() {
|
||||
|
|
|
@ -145,7 +145,14 @@ void SetupDirtyBlend(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
|
||||
|
|
|
@ -56,9 +56,8 @@ enum : u8 {
|
|||
Shaders,
|
||||
ClipDistances,
|
||||
|
||||
CullTestEnable,
|
||||
FrontFace,
|
||||
CullFace,
|
||||
CullTest,
|
||||
PrimitiveRestart,
|
||||
DepthTest,
|
||||
StencilTest,
|
||||
|
@ -120,6 +119,16 @@ public:
|
|||
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:
|
||||
Core::System& system;
|
||||
};
|
||||
|
|
|
@ -582,6 +582,8 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
|||
state_tracker.NotifyColorMask0();
|
||||
state_tracker.NotifyBlend0();
|
||||
state_tracker.NotifyFramebuffer();
|
||||
state_tracker.NotifyFrontFace();
|
||||
state_tracker.NotifyCullTest();
|
||||
|
||||
program_manager.UseVertexShader(vertex_program.handle);
|
||||
program_manager.UseGeometryShader(0);
|
||||
|
|
Loading…
Reference in a new issue