mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 18:32:49 -06:00
gl_state_tracker: Implement dirty flags for primitive restart
This commit is contained in:
parent
37536d7a49
commit
46a1888e02
3 changed files with 19 additions and 5 deletions
|
@ -1017,10 +1017,19 @@ void RasterizerOpenGL::SyncCullMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
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);
|
if (gpu.regs.primitive_restart.enabled) {
|
||||||
glPrimitiveRestartIndex(regs.primitive_restart.index);
|
glEnable(GL_PRIMITIVE_RESTART);
|
||||||
|
glPrimitiveRestartIndex(gpu.regs.primitive_restart.index);
|
||||||
|
} else {
|
||||||
|
glDisable(GL_PRIMITIVE_RESTART);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncDepthTestState() {
|
void RasterizerOpenGL::SyncDepthTestState() {
|
||||||
|
|
|
@ -164,6 +164,10 @@ void SetupDirtyBlend(Tables& tables) {
|
||||||
FillBlock(tables[1], OFF(blend), NUM(blend), BlendStates);
|
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) {
|
void SetupDirtyMisc(Tables& tables) {
|
||||||
auto& table = tables[0];
|
auto& table = tables[0];
|
||||||
|
|
||||||
|
@ -192,6 +196,7 @@ void StateTracker::Initialize() {
|
||||||
SetupDirtyDepthTest(tables);
|
SetupDirtyDepthTest(tables);
|
||||||
SetupDirtyStencilTest(tables);
|
SetupDirtyStencilTest(tables);
|
||||||
SetupDirtyBlend(tables);
|
SetupDirtyBlend(tables);
|
||||||
|
SetupDirtyPrimitiveRestart(tables);
|
||||||
SetupDirtyMisc(tables);
|
SetupDirtyMisc(tables);
|
||||||
|
|
||||||
auto& store = dirty.on_write_stores;
|
auto& store = dirty.on_write_stores;
|
||||||
|
|
|
@ -56,13 +56,13 @@ enum : u8 {
|
||||||
Shaders,
|
Shaders,
|
||||||
ClipDistances,
|
ClipDistances,
|
||||||
|
|
||||||
|
ColorMask,
|
||||||
FrontFace,
|
FrontFace,
|
||||||
CullTest,
|
CullTest,
|
||||||
DepthMask,
|
DepthMask,
|
||||||
DepthTest,
|
DepthTest,
|
||||||
PrimitiveRestart,
|
|
||||||
StencilTest,
|
StencilTest,
|
||||||
ColorMask,
|
PrimitiveRestart,
|
||||||
PolygonOffset,
|
PolygonOffset,
|
||||||
|
|
||||||
Last
|
Last
|
||||||
|
|
Loading…
Reference in a new issue