1
0
Fork 0
forked from suyu/suyu

gl_state_tracker: Implement dirty flags for primitive restart

This commit is contained in:
ReinUsesLisp 2019-12-29 23:25:53 -03:00
parent 37536d7a49
commit 46a1888e02
3 changed files with 19 additions and 5 deletions

View file

@ -1017,10 +1017,19 @@ void RasterizerOpenGL::SyncCullMode() {
}
void RasterizerOpenGL::SyncPrimitiveRestart() {
const auto& regs = system.GPU().Maxwell3D().regs;
auto& gpu = system.GPU().Maxwell3D();
auto& flags = gpu.dirty.flags;
if (!flags[Dirty::PrimitiveRestart]) {
return;
}
flags[Dirty::PrimitiveRestart] = false;
oglEnable(GL_PRIMITIVE_RESTART, regs.primitive_restart.enabled);
glPrimitiveRestartIndex(regs.primitive_restart.index);
if (gpu.regs.primitive_restart.enabled) {
glEnable(GL_PRIMITIVE_RESTART);
glPrimitiveRestartIndex(gpu.regs.primitive_restart.index);
} else {
glDisable(GL_PRIMITIVE_RESTART);
}
}
void RasterizerOpenGL::SyncDepthTestState() {

View file

@ -164,6 +164,10 @@ void SetupDirtyBlend(Tables& tables) {
FillBlock(tables[1], OFF(blend), NUM(blend), BlendStates);
}
void SetupDirtyPrimitiveRestart(Tables& tables) {
FillBlock(tables[0], OFF(primitive_restart), NUM(primitive_restart), PrimitiveRestart);
}
void SetupDirtyMisc(Tables& tables) {
auto& table = tables[0];
@ -192,6 +196,7 @@ void StateTracker::Initialize() {
SetupDirtyDepthTest(tables);
SetupDirtyStencilTest(tables);
SetupDirtyBlend(tables);
SetupDirtyPrimitiveRestart(tables);
SetupDirtyMisc(tables);
auto& store = dirty.on_write_stores;

View file

@ -56,13 +56,13 @@ enum : u8 {
Shaders,
ClipDistances,
ColorMask,
FrontFace,
CullTest,
DepthMask,
DepthTest,
PrimitiveRestart,
StencilTest,
ColorMask,
PrimitiveRestart,
PolygonOffset,
Last