summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2020-04-30 13:07:31 -0400
committerGravatar GitHub2020-04-30 13:07:31 -0400
commitbf3f030a0dca67b744b595f70fbf71c3a22967b7 (patch)
tree8e71eab7a1e019aca4055f6053414fe1b453cf8c /src
parentMerge pull request #3799 from ReinUsesLisp/iadd-cc (diff)
parentmaxwell_3d: Fix depth clamping register (diff)
downloadyuzu-bf3f030a0dca67b744b595f70fbf71c3a22967b7.tar.gz
yuzu-bf3f030a0dca67b744b595f70fbf71c3a22967b7.tar.xz
yuzu-bf3f030a0dca67b744b595f70fbf71c3a22967b7.zip
Merge pull request #3807 from ReinUsesLisp/fix-depth-clamp
maxwell_3d: Fix depth clamping register
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.h1
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp6
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.cpp2
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp2
5 files changed, 5 insertions, 8 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 3dfba8197..5e522e0d2 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1179,6 +1179,7 @@ public:
1179 BitField<0, 1, u32> depth_range_0_1; 1179 BitField<0, 1, u32> depth_range_0_1;
1180 BitField<3, 1, u32> depth_clamp_near; 1180 BitField<3, 1, u32> depth_clamp_near;
1181 BitField<4, 1, u32> depth_clamp_far; 1181 BitField<4, 1, u32> depth_clamp_far;
1182 BitField<11, 1, u32> depth_clamp_disabled;
1182 } view_volume_clip_control; 1183 } view_volume_clip_control;
1183 1184
1184 INSERT_UNION_PADDING_WORDS(0x1F); 1185 INSERT_UNION_PADDING_WORDS(0x1F);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 69a74449c..f33c4a8f9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1022,11 +1022,7 @@ void RasterizerOpenGL::SyncDepthClamp() {
1022 } 1022 }
1023 flags[Dirty::DepthClampEnabled] = false; 1023 flags[Dirty::DepthClampEnabled] = false;
1024 1024
1025 const auto& state = gpu.regs.view_volume_clip_control; 1025 oglEnable(GL_DEPTH_CLAMP, gpu.regs.view_volume_clip_control.depth_clamp_disabled == 0);
1026 UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near,
1027 "Unimplemented depth clamp separation!");
1028
1029 oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near);
1030} 1026}
1031 1027
1032void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) { 1028void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) {
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp
index a7f256ff9..648b1e71b 100644
--- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp
+++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp
@@ -81,7 +81,7 @@ void FixedPipelineState::Rasterizer::Fill(const Maxwell& regs) noexcept {
81 primitive_restart_enable.Assign(regs.primitive_restart.enabled != 0 ? 1 : 0); 81 primitive_restart_enable.Assign(regs.primitive_restart.enabled != 0 ? 1 : 0);
82 cull_enable.Assign(regs.cull_test_enabled != 0 ? 1 : 0); 82 cull_enable.Assign(regs.cull_test_enabled != 0 ? 1 : 0);
83 depth_bias_enable.Assign(enabled_lut[POLYGON_OFFSET_ENABLE_LUT[topology_index]] != 0 ? 1 : 0); 83 depth_bias_enable.Assign(enabled_lut[POLYGON_OFFSET_ENABLE_LUT[topology_index]] != 0 ? 1 : 0);
84 depth_clamp_enable.Assign(clip.depth_clamp_near == 1 || clip.depth_clamp_far == 1 ? 1 : 0); 84 depth_clamp_disabled.Assign(regs.view_volume_clip_control.depth_clamp_disabled.Value());
85 ndc_minus_one_to_one.Assign(regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1 : 0); 85 ndc_minus_one_to_one.Assign(regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1 : 0);
86 cull_face.Assign(PackCullFace(regs.cull_face)); 86 cull_face.Assign(PackCullFace(regs.cull_face));
87 front_face.Assign(packed_front_face); 87 front_face.Assign(packed_front_face);
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
index 77188b862..8652067a7 100644
--- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h
+++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
@@ -153,7 +153,7 @@ struct FixedPipelineState {
153 BitField<4, 1, u32> primitive_restart_enable; 153 BitField<4, 1, u32> primitive_restart_enable;
154 BitField<5, 1, u32> cull_enable; 154 BitField<5, 1, u32> cull_enable;
155 BitField<6, 1, u32> depth_bias_enable; 155 BitField<6, 1, u32> depth_bias_enable;
156 BitField<7, 1, u32> depth_clamp_enable; 156 BitField<7, 1, u32> depth_clamp_disabled;
157 BitField<8, 1, u32> ndc_minus_one_to_one; 157 BitField<8, 1, u32> ndc_minus_one_to_one;
158 BitField<9, 2, u32> cull_face; 158 BitField<9, 2, u32> cull_face;
159 BitField<11, 1, u32> front_face; 159 BitField<11, 1, u32> front_face;
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index 45bd1fc6c..852a17a70 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -249,7 +249,7 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa
249 rasterization_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; 249 rasterization_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
250 rasterization_ci.pNext = nullptr; 250 rasterization_ci.pNext = nullptr;
251 rasterization_ci.flags = 0; 251 rasterization_ci.flags = 0;
252 rasterization_ci.depthClampEnable = rs.depth_clamp_enable; 252 rasterization_ci.depthClampEnable = rs.depth_clamp_disabled == 0 ? VK_TRUE : VK_FALSE;
253 rasterization_ci.rasterizerDiscardEnable = VK_FALSE; 253 rasterization_ci.rasterizerDiscardEnable = VK_FALSE;
254 rasterization_ci.polygonMode = VK_POLYGON_MODE_FILL; 254 rasterization_ci.polygonMode = VK_POLYGON_MODE_FILL;
255 rasterization_ci.cullMode = 255 rasterization_ci.cullMode =