mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-27 12:00:05 +00:00
gl_state: Remove depth clamp tracking
This commit is contained in:
parent
e1a16a52fa
commit
2a662fea36
@ -977,8 +977,6 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) {
|
|||||||
viewport.depth_range_far = src.depth_range_far;
|
viewport.depth_range_far = src.depth_range_far;
|
||||||
viewport.depth_range_near = src.depth_range_near;
|
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;
|
bool flip_y = false;
|
||||||
if (regs.viewport_transform[0].scale_y < 0.0) {
|
if (regs.viewport_transform[0].scale_y < 0.0) {
|
||||||
@ -994,6 +992,16 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) {
|
|||||||
: GL_NEGATIVE_ONE_TO_ONE;
|
: 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(
|
void RasterizerOpenGL::SyncClipEnabled(
|
||||||
const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) {
|
const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) {
|
||||||
|
|
||||||
|
@ -132,6 +132,9 @@ private:
|
|||||||
/// Syncs the viewport and depth range to match the guest state
|
/// Syncs the viewport and depth range to match the guest state
|
||||||
void SyncViewport(OpenGLState& current_state);
|
void SyncViewport(OpenGLState& current_state);
|
||||||
|
|
||||||
|
/// Syncs the depth clamp state
|
||||||
|
void SyncDepthClamp();
|
||||||
|
|
||||||
/// Syncs the clip enabled status to match the guest state
|
/// Syncs the clip enabled status to match the guest state
|
||||||
void SyncClipEnabled(
|
void SyncClipEnabled(
|
||||||
const std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances>& clip_mask);
|
const std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances>& clip_mask);
|
||||||
|
@ -87,9 +87,6 @@ OpenGLState::OpenGLState() = default;
|
|||||||
|
|
||||||
void OpenGLState::SetDefaultViewports() {
|
void OpenGLState::SetDefaultViewports() {
|
||||||
viewports.fill(Viewport{});
|
viewports.fill(Viewport{});
|
||||||
|
|
||||||
depth_clamp.far_plane = false;
|
|
||||||
depth_clamp.near_plane = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::ApplyFramebufferState() {
|
void OpenGLState::ApplyFramebufferState() {
|
||||||
@ -140,19 +137,6 @@ void OpenGLState::ApplyMultisample() {
|
|||||||
multisample_control.alpha_to_one);
|
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() {
|
void OpenGLState::ApplySRgb() {
|
||||||
if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled)
|
if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled)
|
||||||
return;
|
return;
|
||||||
@ -362,7 +346,6 @@ void OpenGLState::Apply() {
|
|||||||
ApplyMultisample();
|
ApplyMultisample();
|
||||||
ApplyRasterizerDiscard();
|
ApplyRasterizerDiscard();
|
||||||
ApplyColorMask();
|
ApplyColorMask();
|
||||||
ApplyDepthClamp();
|
|
||||||
ApplyViewport();
|
ApplyViewport();
|
||||||
ApplyStencilTest();
|
ApplyStencilTest();
|
||||||
ApplySRgb();
|
ApplySRgb();
|
||||||
|
@ -26,11 +26,6 @@ public:
|
|||||||
bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB
|
bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB
|
||||||
} fragment_color_clamp;
|
} fragment_color_clamp;
|
||||||
|
|
||||||
struct {
|
|
||||||
bool far_plane = false;
|
|
||||||
bool near_plane = false;
|
|
||||||
} depth_clamp; // GL_DEPTH_CLAMP
|
|
||||||
|
|
||||||
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
|
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
|
||||||
|
|
||||||
struct ColorMask {
|
struct ColorMask {
|
||||||
@ -139,7 +134,6 @@ public:
|
|||||||
void ApplyTextures();
|
void ApplyTextures();
|
||||||
void ApplySamplers();
|
void ApplySamplers();
|
||||||
void ApplyImages();
|
void ApplyImages();
|
||||||
void ApplyDepthClamp();
|
|
||||||
void ApplyClipControl();
|
void ApplyClipControl();
|
||||||
void ApplyRenderBuffer();
|
void ApplyRenderBuffer();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user