mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
gl_state: Remove polygon offset tracking
This commit is contained in:
parent
f646321dd0
commit
a0321b984f
4 changed files with 7 additions and 39 deletions
|
@ -1210,14 +1210,13 @@ void RasterizerOpenGL::SyncPolygonOffset() {
|
||||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
auto& maxwell3d = system.GPU().Maxwell3D();
|
||||||
const auto& regs = maxwell3d.regs;
|
const auto& regs = maxwell3d.regs;
|
||||||
|
|
||||||
state.polygon_offset.fill_enable = regs.polygon_offset_fill_enable != 0;
|
oglEnable(GL_POLYGON_OFFSET_FILL, regs.polygon_offset_fill_enable);
|
||||||
state.polygon_offset.line_enable = regs.polygon_offset_line_enable != 0;
|
oglEnable(GL_POLYGON_OFFSET_LINE, regs.polygon_offset_line_enable);
|
||||||
state.polygon_offset.point_enable = regs.polygon_offset_point_enable != 0;
|
oglEnable(GL_POLYGON_OFFSET_POINT, regs.polygon_offset_point_enable);
|
||||||
|
|
||||||
// Hardware divides polygon offset units by two
|
// Hardware divides polygon offset units by two
|
||||||
state.polygon_offset.units = regs.polygon_offset_units / 2.0f;
|
glPolygonOffsetClamp(regs.polygon_offset_factor, regs.polygon_offset_units / 2.0f,
|
||||||
state.polygon_offset.factor = regs.polygon_offset_factor;
|
regs.polygon_offset_clamp);
|
||||||
state.polygon_offset.clamp = regs.polygon_offset_clamp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncAlphaTest() {
|
void RasterizerOpenGL::SyncAlphaTest() {
|
||||||
|
|
|
@ -347,27 +347,6 @@ void OpenGLState::ApplyLogicOp() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::ApplyPolygonOffset() {
|
|
||||||
Enable(GL_POLYGON_OFFSET_FILL, cur_state.polygon_offset.fill_enable,
|
|
||||||
polygon_offset.fill_enable);
|
|
||||||
Enable(GL_POLYGON_OFFSET_LINE, cur_state.polygon_offset.line_enable,
|
|
||||||
polygon_offset.line_enable);
|
|
||||||
Enable(GL_POLYGON_OFFSET_POINT, cur_state.polygon_offset.point_enable,
|
|
||||||
polygon_offset.point_enable);
|
|
||||||
|
|
||||||
if (UpdateTie(std::tie(cur_state.polygon_offset.factor, cur_state.polygon_offset.units,
|
|
||||||
cur_state.polygon_offset.clamp),
|
|
||||||
std::tie(polygon_offset.factor, polygon_offset.units, polygon_offset.clamp))) {
|
|
||||||
if (GLAD_GL_EXT_polygon_offset_clamp && polygon_offset.clamp != 0) {
|
|
||||||
glPolygonOffsetClamp(polygon_offset.factor, polygon_offset.units, polygon_offset.clamp);
|
|
||||||
} else {
|
|
||||||
UNIMPLEMENTED_IF_MSG(polygon_offset.clamp != 0,
|
|
||||||
"Unimplemented Depth polygon offset clamp.");
|
|
||||||
glPolygonOffset(polygon_offset.factor, polygon_offset.units);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenGLState::ApplyClipControl() {
|
void OpenGLState::ApplyClipControl() {
|
||||||
if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
|
if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
|
||||||
std::tie(clip_control.origin, clip_control.depth_mode))) {
|
std::tie(clip_control.origin, clip_control.depth_mode))) {
|
||||||
|
@ -432,7 +411,6 @@ void OpenGLState::Apply() {
|
||||||
ApplyTextures();
|
ApplyTextures();
|
||||||
ApplySamplers();
|
ApplySamplers();
|
||||||
ApplyImages();
|
ApplyImages();
|
||||||
ApplyPolygonOffset();
|
|
||||||
ApplyClipControl();
|
ApplyClipControl();
|
||||||
ApplyRenderBuffer();
|
ApplyRenderBuffer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,15 +124,6 @@ public:
|
||||||
};
|
};
|
||||||
std::array<Viewport, Tegra::Engines::Maxwell3D::Regs::NumViewports> viewports;
|
std::array<Viewport, Tegra::Engines::Maxwell3D::Regs::NumViewports> viewports;
|
||||||
|
|
||||||
struct {
|
|
||||||
bool point_enable = false;
|
|
||||||
bool line_enable = false;
|
|
||||||
bool fill_enable = false;
|
|
||||||
GLfloat units = 0.0f;
|
|
||||||
GLfloat factor = 0.0f;
|
|
||||||
GLfloat clamp = 0.0f;
|
|
||||||
} polygon_offset;
|
|
||||||
|
|
||||||
std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
|
std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -175,7 +166,6 @@ public:
|
||||||
void ApplySamplers();
|
void ApplySamplers();
|
||||||
void ApplyImages();
|
void ApplyImages();
|
||||||
void ApplyDepthClamp();
|
void ApplyDepthClamp();
|
||||||
void ApplyPolygonOffset();
|
|
||||||
void ApplyClipControl();
|
void ApplyClipControl();
|
||||||
void ApplyRenderBuffer();
|
void ApplyRenderBuffer();
|
||||||
|
|
||||||
|
|
|
@ -573,8 +573,9 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
|
||||||
state.Apply();
|
state.Apply();
|
||||||
|
|
||||||
// TODO: Signal state tracker about these changes
|
// TODO: Signal state tracker about these changes
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
glFrontFace(GL_CW);
|
glFrontFace(GL_CW);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue