diff options
Diffstat (limited to 'src')
6 files changed, 19 insertions, 11 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 1cbe8fe67..b0d9559d0 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -755,7 +755,11 @@ public: | |||
| 755 | 755 | ||
| 756 | u32 data_upload; | 756 | u32 data_upload; |
| 757 | 757 | ||
| 758 | INSERT_UNION_PADDING_WORDS(0x44); | 758 | INSERT_UNION_PADDING_WORDS(0x16); |
| 759 | |||
| 760 | u32 force_early_fragment_tests; | ||
| 761 | |||
| 762 | INSERT_UNION_PADDING_WORDS(0x2D); | ||
| 759 | 763 | ||
| 760 | struct { | 764 | struct { |
| 761 | union { | 765 | union { |
| @@ -1572,6 +1576,7 @@ ASSERT_REG_POSITION(shadow_ram_control, 0x49); | |||
| 1572 | ASSERT_REG_POSITION(upload, 0x60); | 1576 | ASSERT_REG_POSITION(upload, 0x60); |
| 1573 | ASSERT_REG_POSITION(exec_upload, 0x6C); | 1577 | ASSERT_REG_POSITION(exec_upload, 0x6C); |
| 1574 | ASSERT_REG_POSITION(data_upload, 0x6D); | 1578 | ASSERT_REG_POSITION(data_upload, 0x6D); |
| 1579 | ASSERT_REG_POSITION(force_early_fragment_tests, 0x84); | ||
| 1575 | ASSERT_REG_POSITION(sync_info, 0xB2); | 1580 | ASSERT_REG_POSITION(sync_info, 0xB2); |
| 1576 | ASSERT_REG_POSITION(tess_mode, 0xC8); | 1581 | ASSERT_REG_POSITION(tess_mode, 0xC8); |
| 1577 | ASSERT_REG_POSITION(tess_level_outer, 0xC9); | 1582 | ASSERT_REG_POSITION(tess_level_outer, 0xC9); |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index fffae528e..5ec43db11 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | |||
| @@ -46,7 +46,7 @@ void FixedPipelineState::Fill(const Maxwell& regs, bool has_extended_dynamic_sta | |||
| 46 | regs.polygon_offset_fill_enable}; | 46 | regs.polygon_offset_fill_enable}; |
| 47 | const u32 topology_index = static_cast<u32>(regs.draw.topology.Value()); | 47 | const u32 topology_index = static_cast<u32>(regs.draw.topology.Value()); |
| 48 | 48 | ||
| 49 | raw = 0; | 49 | raw1 = 0; |
| 50 | primitive_restart_enable.Assign(regs.primitive_restart.enabled != 0 ? 1 : 0); | 50 | primitive_restart_enable.Assign(regs.primitive_restart.enabled != 0 ? 1 : 0); |
| 51 | depth_bias_enable.Assign(enabled_lut[POLYGON_OFFSET_ENABLE_LUT[topology_index]] != 0 ? 1 : 0); | 51 | depth_bias_enable.Assign(enabled_lut[POLYGON_OFFSET_ENABLE_LUT[topology_index]] != 0 ? 1 : 0); |
| 52 | depth_clamp_disabled.Assign(regs.view_volume_clip_control.depth_clamp_disabled.Value()); | 52 | depth_clamp_disabled.Assign(regs.view_volume_clip_control.depth_clamp_disabled.Value()); |
| @@ -61,12 +61,13 @@ void FixedPipelineState::Fill(const Maxwell& regs, bool has_extended_dynamic_sta | |||
| 61 | rasterize_enable.Assign(regs.rasterize_enable != 0 ? 1 : 0); | 61 | rasterize_enable.Assign(regs.rasterize_enable != 0 ? 1 : 0); |
| 62 | topology.Assign(regs.draw.topology); | 62 | topology.Assign(regs.draw.topology); |
| 63 | 63 | ||
| 64 | alpha_raw = 0; | 64 | raw2 = 0; |
| 65 | const auto test_func = | 65 | const auto test_func = |
| 66 | regs.alpha_test_enabled == 1 ? regs.alpha_test_func : Maxwell::ComparisonOp::Always; | 66 | regs.alpha_test_enabled == 1 ? regs.alpha_test_func : Maxwell::ComparisonOp::Always; |
| 67 | alpha_test_func.Assign(PackComparisonOp(test_func)); | 67 | alpha_test_func.Assign(PackComparisonOp(test_func)); |
| 68 | alpha_test_ref = Common::BitCast<u32>(regs.alpha_test_ref); | 68 | early_z.Assign(regs.force_early_fragment_tests != 0 ? 1 : 0); |
| 69 | 69 | ||
| 70 | alpha_test_ref = Common::BitCast<u32>(regs.alpha_test_ref); | ||
| 70 | point_size = Common::BitCast<u32>(regs.point_size); | 71 | point_size = Common::BitCast<u32>(regs.point_size); |
| 71 | 72 | ||
| 72 | for (std::size_t index = 0; index < Maxwell::NumVertexArrays; ++index) { | 73 | for (std::size_t index = 0; index < Maxwell::NumVertexArrays; ++index) { |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index 42480e8d0..c26b77790 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h | |||
| @@ -171,7 +171,7 @@ struct FixedPipelineState { | |||
| 171 | }; | 171 | }; |
| 172 | 172 | ||
| 173 | union { | 173 | union { |
| 174 | u32 raw; | 174 | u32 raw1; |
| 175 | BitField<0, 1, u32> no_extended_dynamic_state; | 175 | BitField<0, 1, u32> no_extended_dynamic_state; |
| 176 | BitField<2, 1, u32> primitive_restart_enable; | 176 | BitField<2, 1, u32> primitive_restart_enable; |
| 177 | BitField<3, 1, u32> depth_bias_enable; | 177 | BitField<3, 1, u32> depth_bias_enable; |
| @@ -187,13 +187,13 @@ struct FixedPipelineState { | |||
| 187 | BitField<23, 1, u32> rasterize_enable; | 187 | BitField<23, 1, u32> rasterize_enable; |
| 188 | BitField<24, 4, Maxwell::PrimitiveTopology> topology; | 188 | BitField<24, 4, Maxwell::PrimitiveTopology> topology; |
| 189 | }; | 189 | }; |
| 190 | |||
| 191 | u32 alpha_test_ref; ///< Alpha test reference value | ||
| 192 | union { | 190 | union { |
| 193 | u32 alpha_raw; | 191 | u32 raw2; |
| 194 | BitField<0, 3, u32> alpha_test_func; | 192 | BitField<0, 3, u32> alpha_test_func; |
| 193 | BitField<3, 1, u32> early_z; | ||
| 195 | }; | 194 | }; |
| 196 | 195 | ||
| 196 | u32 alpha_test_ref; | ||
| 197 | u32 point_size; | 197 | u32 point_size; |
| 198 | std::array<u32, Maxwell::NumVertexArrays> binding_divisors; | 198 | std::array<u32, Maxwell::NumVertexArrays> binding_divisors; |
| 199 | std::array<VertexAttribute, Maxwell::NumVertexAttributes> attributes; | 199 | std::array<VertexAttribute, Maxwell::NumVertexAttributes> attributes; |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index f9efe526d..df7e8c864 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -344,6 +344,7 @@ VKPipelineCache::DecompileShaders(const FixedPipelineState& fixed_state) { | |||
| 344 | specialization.attribute_types[i] = attribute.Type(); | 344 | specialization.attribute_types[i] = attribute.Type(); |
| 345 | } | 345 | } |
| 346 | specialization.ndc_minus_one_to_one = fixed_state.ndc_minus_one_to_one; | 346 | specialization.ndc_minus_one_to_one = fixed_state.ndc_minus_one_to_one; |
| 347 | specialization.early_fragment_tests = fixed_state.early_z; | ||
| 347 | 348 | ||
| 348 | // Alpha test | 349 | // Alpha test |
| 349 | specialization.alpha_test_func = | 350 | specialization.alpha_test_func = |
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 1c52f40bb..fed9ebecd 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -315,7 +315,6 @@ public: | |||
| 315 | "supported on this device"); | 315 | "supported on this device"); |
| 316 | } | 316 | } |
| 317 | } | 317 | } |
| 318 | |||
| 319 | if (ir.UsesLayer() || ir.UsesViewportIndex()) { | 318 | if (ir.UsesLayer() || ir.UsesViewportIndex()) { |
| 320 | if (ir.UsesViewportIndex()) { | 319 | if (ir.UsesViewportIndex()) { |
| 321 | AddCapability(spv::Capability::MultiViewport); | 320 | AddCapability(spv::Capability::MultiViewport); |
| @@ -325,11 +324,9 @@ public: | |||
| 325 | AddCapability(spv::Capability::ShaderViewportIndexLayerEXT); | 324 | AddCapability(spv::Capability::ShaderViewportIndexLayerEXT); |
| 326 | } | 325 | } |
| 327 | } | 326 | } |
| 328 | |||
| 329 | if (device.IsFormatlessImageLoadSupported()) { | 327 | if (device.IsFormatlessImageLoadSupported()) { |
| 330 | AddCapability(spv::Capability::StorageImageReadWithoutFormat); | 328 | AddCapability(spv::Capability::StorageImageReadWithoutFormat); |
| 331 | } | 329 | } |
| 332 | |||
| 333 | if (device.IsFloat16Supported()) { | 330 | if (device.IsFloat16Supported()) { |
| 334 | AddCapability(spv::Capability::Float16); | 331 | AddCapability(spv::Capability::Float16); |
| 335 | } | 332 | } |
| @@ -377,6 +374,9 @@ public: | |||
| 377 | if (header.ps.omap.depth) { | 374 | if (header.ps.omap.depth) { |
| 378 | AddExecutionMode(main, spv::ExecutionMode::DepthReplacing); | 375 | AddExecutionMode(main, spv::ExecutionMode::DepthReplacing); |
| 379 | } | 376 | } |
| 377 | if (specialization.early_fragment_tests) { | ||
| 378 | AddExecutionMode(main, spv::ExecutionMode::EarlyFragmentTests); | ||
| 379 | } | ||
| 380 | break; | 380 | break; |
| 381 | case ShaderType::Compute: | 381 | case ShaderType::Compute: |
| 382 | const auto workgroup_size = specialization.workgroup_size; | 382 | const auto workgroup_size = specialization.workgroup_size; |
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.h b/src/video_core/renderer_vulkan/vk_shader_decompiler.h index cd3d0a415..110848922 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.h +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.h | |||
| @@ -95,6 +95,7 @@ struct Specialization final { | |||
| 95 | std::bitset<Maxwell::NumVertexAttributes> enabled_attributes; | 95 | std::bitset<Maxwell::NumVertexAttributes> enabled_attributes; |
| 96 | std::array<Maxwell::VertexAttribute::Type, Maxwell::NumVertexAttributes> attribute_types{}; | 96 | std::array<Maxwell::VertexAttribute::Type, Maxwell::NumVertexAttributes> attribute_types{}; |
| 97 | bool ndc_minus_one_to_one{}; | 97 | bool ndc_minus_one_to_one{}; |
| 98 | bool early_fragment_tests{}; | ||
| 98 | float alpha_test_ref{}; | 99 | float alpha_test_ref{}; |
| 99 | Maxwell::ComparisonOp alpha_test_func{}; | 100 | Maxwell::ComparisonOp alpha_test_func{}; |
| 100 | }; | 101 | }; |