mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-27 20:44:24 +01:00
vulkan: Enable depth bounds and use it conditionally
Intel devices pre-Xe don't support this.
This commit is contained in:
parent
c44b16124f
commit
77372443c3
@ -598,13 +598,16 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
|||||||
.depthCompareOp = dynamic.depth_test_enable
|
.depthCompareOp = dynamic.depth_test_enable
|
||||||
? MaxwellToVK::ComparisonOp(dynamic.DepthTestFunc())
|
? MaxwellToVK::ComparisonOp(dynamic.DepthTestFunc())
|
||||||
: VK_COMPARE_OP_ALWAYS,
|
: VK_COMPARE_OP_ALWAYS,
|
||||||
.depthBoundsTestEnable = dynamic.depth_bounds_enable,
|
.depthBoundsTestEnable = dynamic.depth_bounds_enable && device.IsDepthBoundsSupported(),
|
||||||
.stencilTestEnable = dynamic.stencil_enable,
|
.stencilTestEnable = dynamic.stencil_enable,
|
||||||
.front = GetStencilFaceState(dynamic.front),
|
.front = GetStencilFaceState(dynamic.front),
|
||||||
.back = GetStencilFaceState(dynamic.back),
|
.back = GetStencilFaceState(dynamic.back),
|
||||||
.minDepthBounds = 0.0f,
|
.minDepthBounds = 0.0f,
|
||||||
.maxDepthBounds = 0.0f,
|
.maxDepthBounds = 0.0f,
|
||||||
};
|
};
|
||||||
|
if (dynamic.depth_bounds_enable && !device.IsDepthBoundsSupported()) {
|
||||||
|
LOG_WARNING(Render_Vulkan, "Depth bounds is enabled but not supported");
|
||||||
|
}
|
||||||
static_vector<VkPipelineColorBlendAttachmentState, Maxwell::NumRenderTargets> cb_attachments;
|
static_vector<VkPipelineColorBlendAttachmentState, Maxwell::NumRenderTargets> cb_attachments;
|
||||||
const size_t num_attachments{NumAttachments(key.state)};
|
const size_t num_attachments{NumAttachments(key.state)};
|
||||||
for (size_t index = 0; index < num_attachments; ++index) {
|
for (size_t index = 0; index < num_attachments; ++index) {
|
||||||
|
@ -682,6 +682,11 @@ void RasterizerVulkan::UpdateDepthBoundsTestEnable(Tegra::Engines::Maxwell3D::Re
|
|||||||
if (!state_tracker.TouchDepthBoundsTestEnable()) {
|
if (!state_tracker.TouchDepthBoundsTestEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool enabled = regs.depth_bounds_enable;
|
||||||
|
if (enabled && !device.IsDepthBoundsSupported()) {
|
||||||
|
LOG_WARNING(Render_Vulkan, "Depth bounds is enabled but not supported");
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
scheduler.Record([enable = regs.depth_bounds_enable](vk::CommandBuffer cmdbuf) {
|
scheduler.Record([enable = regs.depth_bounds_enable](vk::CommandBuffer cmdbuf) {
|
||||||
cmdbuf.SetDepthBoundsTestEnableEXT(enable);
|
cmdbuf.SetDepthBoundsTestEnableEXT(enable);
|
||||||
});
|
});
|
||||||
|
@ -226,7 +226,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
|||||||
.depthClamp = true,
|
.depthClamp = true,
|
||||||
.depthBiasClamp = true,
|
.depthBiasClamp = true,
|
||||||
.fillModeNonSolid = true,
|
.fillModeNonSolid = true,
|
||||||
.depthBounds = false,
|
.depthBounds = is_depth_bounds_supported,
|
||||||
.wideLines = false,
|
.wideLines = false,
|
||||||
.largePoints = true,
|
.largePoints = true,
|
||||||
.alphaToOne = false,
|
.alphaToOne = false,
|
||||||
@ -908,6 +908,7 @@ void Device::SetupFamilies(VkSurfaceKHR surface) {
|
|||||||
|
|
||||||
void Device::SetupFeatures() {
|
void Device::SetupFeatures() {
|
||||||
const VkPhysicalDeviceFeatures features{physical.GetFeatures()};
|
const VkPhysicalDeviceFeatures features{physical.GetFeatures()};
|
||||||
|
is_depth_bounds_supported = features.depthBounds;
|
||||||
is_formatless_image_load_supported = features.shaderStorageImageReadWithoutFormat;
|
is_formatless_image_load_supported = features.shaderStorageImageReadWithoutFormat;
|
||||||
is_shader_float64_supported = features.shaderFloat64;
|
is_shader_float64_supported = features.shaderFloat64;
|
||||||
is_shader_int64_supported = features.shaderInt64;
|
is_shader_int64_supported = features.shaderInt64;
|
||||||
|
@ -159,6 +159,11 @@ public:
|
|||||||
return is_formatless_image_load_supported;
|
return is_formatless_image_load_supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if depth bounds is supported.
|
||||||
|
bool IsDepthBoundsSupported() const {
|
||||||
|
return is_depth_bounds_supported;
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true when blitting from and to depth stencil images is supported.
|
/// Returns true when blitting from and to depth stencil images is supported.
|
||||||
bool IsBlitDepthStencilSupported() const {
|
bool IsBlitDepthStencilSupported() const {
|
||||||
return is_blit_depth_stencil_supported;
|
return is_blit_depth_stencil_supported;
|
||||||
@ -314,6 +319,7 @@ private:
|
|||||||
bool is_float16_supported{}; ///< Support for float16 arithmetics.
|
bool is_float16_supported{}; ///< Support for float16 arithmetics.
|
||||||
bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest.
|
bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest.
|
||||||
bool is_formatless_image_load_supported{}; ///< Support for shader image read without format.
|
bool is_formatless_image_load_supported{}; ///< Support for shader image read without format.
|
||||||
|
bool is_depth_bounds_supported{}; ///< Support for depth bounds.
|
||||||
bool is_shader_float64_supported{}; ///< Support for float64.
|
bool is_shader_float64_supported{}; ///< Support for float64.
|
||||||
bool is_shader_int64_supported{}; ///< Support for int64.
|
bool is_shader_int64_supported{}; ///< Support for int64.
|
||||||
bool is_shader_storage_image_multisample{}; ///< Support for image operations on MSAA images.
|
bool is_shader_storage_image_multisample{}; ///< Support for image operations on MSAA images.
|
||||||
|
Loading…
Reference in New Issue
Block a user