mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-23 18:02:46 -06:00
gl_state_tracker: Implement dirty flags for polygon offsets
This commit is contained in:
parent
46a1888e02
commit
9e46953580
4 changed files with 24 additions and 2 deletions
|
@ -1249,9 +1249,14 @@ void RasterizerOpenGL::SyncPointState() {
|
|||
}
|
||||
|
||||
void RasterizerOpenGL::SyncPolygonOffset() {
|
||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
||||
const auto& regs = maxwell3d.regs;
|
||||
auto& gpu = system.GPU().Maxwell3D();
|
||||
auto& flags = gpu.dirty.flags;
|
||||
if (!flags[Dirty::PolygonOffset]) {
|
||||
return;
|
||||
}
|
||||
flags[Dirty::PolygonOffset] = false;
|
||||
|
||||
const auto& regs = gpu.regs;
|
||||
oglEnable(GL_POLYGON_OFFSET_FILL, regs.polygon_offset_fill_enable);
|
||||
oglEnable(GL_POLYGON_OFFSET_LINE, regs.polygon_offset_line_enable);
|
||||
oglEnable(GL_POLYGON_OFFSET_POINT, regs.polygon_offset_point_enable);
|
||||
|
|
|
@ -168,6 +168,16 @@ void SetupDirtyPrimitiveRestart(Tables& tables) {
|
|||
FillBlock(tables[0], OFF(primitive_restart), NUM(primitive_restart), PrimitiveRestart);
|
||||
}
|
||||
|
||||
void SetupDirtyPolygonOffset(Tables& tables) {
|
||||
auto& table = tables[0];
|
||||
table[OFF(polygon_offset_fill_enable)] = PolygonOffset;
|
||||
table[OFF(polygon_offset_line_enable)] = PolygonOffset;
|
||||
table[OFF(polygon_offset_point_enable)] = PolygonOffset;
|
||||
table[OFF(polygon_offset_factor)] = PolygonOffset;
|
||||
table[OFF(polygon_offset_units)] = PolygonOffset;
|
||||
table[OFF(polygon_offset_clamp)] = PolygonOffset;
|
||||
}
|
||||
|
||||
void SetupDirtyMisc(Tables& tables) {
|
||||
auto& table = tables[0];
|
||||
|
||||
|
@ -197,6 +207,7 @@ void StateTracker::Initialize() {
|
|||
SetupDirtyStencilTest(tables);
|
||||
SetupDirtyBlend(tables);
|
||||
SetupDirtyPrimitiveRestart(tables);
|
||||
SetupDirtyPolygonOffset(tables);
|
||||
SetupDirtyMisc(tables);
|
||||
|
||||
auto& store = dirty.on_write_stores;
|
||||
|
|
|
@ -140,6 +140,11 @@ public:
|
|||
flags[OpenGL::Dirty::StencilTest] = true;
|
||||
}
|
||||
|
||||
void NotifyPolygonOffset() {
|
||||
auto& flags = system.GPU().Maxwell3D().dirty.flags;
|
||||
flags[OpenGL::Dirty::PolygonOffset] = true;
|
||||
}
|
||||
|
||||
private:
|
||||
Core::System& system;
|
||||
};
|
||||
|
|
|
@ -586,6 +586,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
|||
state_tracker.NotifyCullTest();
|
||||
state_tracker.NotifyDepthTest();
|
||||
state_tracker.NotifyStencilTest();
|
||||
state_tracker.NotifyPolygonOffset();
|
||||
|
||||
program_manager.UseVertexShader(vertex_program.handle);
|
||||
program_manager.UseGeometryShader(0);
|
||||
|
|
Loading…
Reference in a new issue