gl_state: Remove depth clamp tracking

This commit is contained in:
ReinUsesLisp 2019-12-25 21:57:10 -03:00
parent e1a16a52fa
commit 2a662fea36
4 changed files with 13 additions and 25 deletions

View File

@ -977,8 +977,6 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) {
viewport.depth_range_far = src.depth_range_far;
viewport.depth_range_near = src.depth_range_near;
}
state.depth_clamp.far_plane = regs.view_volume_clip_control.depth_clamp_far != 0;
state.depth_clamp.near_plane = regs.view_volume_clip_control.depth_clamp_near != 0;
bool flip_y = false;
if (regs.viewport_transform[0].scale_y < 0.0) {
@ -994,6 +992,16 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) {
: GL_NEGATIVE_ONE_TO_ONE;
}
void RasterizerOpenGL::SyncDepthClamp() {
const auto& regs = system.GPU().Maxwell3D().regs;
const auto& state = regs.view_volume_clip_control;
UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near,
"Unimplemented Depth clamp separation!");
oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near);
}
void RasterizerOpenGL::SyncClipEnabled(
const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) {

View File

@ -132,6 +132,9 @@ private:
/// Syncs the viewport and depth range to match the guest state
void SyncViewport(OpenGLState& current_state);
/// Syncs the depth clamp state
void SyncDepthClamp();
/// Syncs the clip enabled status to match the guest state
void SyncClipEnabled(
const std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances>& clip_mask);

View File

@ -87,9 +87,6 @@ OpenGLState::OpenGLState() = default;
void OpenGLState::SetDefaultViewports() {
viewports.fill(Viewport{});
depth_clamp.far_plane = false;
depth_clamp.near_plane = false;
}
void OpenGLState::ApplyFramebufferState() {
@ -140,19 +137,6 @@ void OpenGLState::ApplyMultisample() {
multisample_control.alpha_to_one);
}
void OpenGLState::ApplyDepthClamp() {
if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane &&
depth_clamp.near_plane == cur_state.depth_clamp.near_plane) {
return;
}
cur_state.depth_clamp = depth_clamp;
UNIMPLEMENTED_IF_MSG(depth_clamp.far_plane != depth_clamp.near_plane,
"Unimplemented Depth Clamp Separation!");
Enable(GL_DEPTH_CLAMP, depth_clamp.far_plane || depth_clamp.near_plane);
}
void OpenGLState::ApplySRgb() {
if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled)
return;
@ -362,7 +346,6 @@ void OpenGLState::Apply() {
ApplyMultisample();
ApplyRasterizerDiscard();
ApplyColorMask();
ApplyDepthClamp();
ApplyViewport();
ApplyStencilTest();
ApplySRgb();

View File

@ -26,11 +26,6 @@ public:
bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB
} fragment_color_clamp;
struct {
bool far_plane = false;
bool near_plane = false;
} depth_clamp; // GL_DEPTH_CLAMP
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
struct ColorMask {
@ -139,7 +134,6 @@ public:
void ApplyTextures();
void ApplySamplers();
void ApplyImages();
void ApplyDepthClamp();
void ApplyClipControl();
void ApplyRenderBuffer();