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

gl_state_tracker: Implement dirty flags for front face and culling

This commit is contained in:
ReinUsesLisp 2019-12-29 19:23:40 -03:00
parent b01dd7d1c8
commit b910a83a47
4 changed files with 38 additions and 7 deletions

View File

@ -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);
if (flags[Dirty::CullTest]) {
flags[Dirty::CullTest] = false;
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() {

View File

@ -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

View File

@ -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;
};

View File

@ -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);