mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
vk: Optionally ignore depth bounds testing on hardware that does not
support it.
This commit is contained in:
parent
7a5c20ef85
commit
eda09489b2
3 changed files with 56 additions and 15 deletions
|
@ -973,14 +973,17 @@ void VKGSRender::update_draw_state()
|
|||
}
|
||||
}
|
||||
|
||||
if (rsx::method_registers.depth_bounds_test_enabled())
|
||||
if (m_device->get_depth_bounds_support())
|
||||
{
|
||||
//Update depth bounds min/max
|
||||
vkCmdSetDepthBounds(*m_current_command_buffer, rsx::method_registers.depth_bounds_min(), rsx::method_registers.depth_bounds_max());
|
||||
}
|
||||
else
|
||||
{
|
||||
vkCmdSetDepthBounds(*m_current_command_buffer, 0.f, 1.f);
|
||||
if (rsx::method_registers.depth_bounds_test_enabled())
|
||||
{
|
||||
//Update depth bounds min/max
|
||||
vkCmdSetDepthBounds(*m_current_command_buffer, rsx::method_registers.depth_bounds_min(), rsx::method_registers.depth_bounds_max());
|
||||
}
|
||||
else
|
||||
{
|
||||
vkCmdSetDepthBounds(*m_current_command_buffer, 0.f, 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
bind_viewport();
|
||||
|
@ -2480,7 +2483,7 @@ bool VKGSRender::load_program()
|
|||
properties.state.set_front_face(vk::get_front_face(rsx::method_registers.front_face_mode()));
|
||||
properties.state.enable_depth_clamp(rsx::method_registers.depth_clamp_enabled() || !rsx::method_registers.depth_clip_enabled());
|
||||
properties.state.enable_depth_bias(true);
|
||||
properties.state.enable_depth_bounds_test(true);
|
||||
properties.state.enable_depth_bounds_test(m_device->get_depth_bounds_support());
|
||||
|
||||
if (rsx::method_registers.depth_test_enabled())
|
||||
{
|
||||
|
|
|
@ -770,16 +770,44 @@ private:
|
|||
// 1. Anisotropic sampling
|
||||
// 2. DXT support
|
||||
// 3. Indexable storage buffers
|
||||
VkPhysicalDeviceFeatures available_features = pgpu->features;
|
||||
VkPhysicalDeviceFeatures enabled_features{};
|
||||
if (pgpu->shader_types_support.allow_float16)
|
||||
{
|
||||
requested_extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
available_features.depthBounds = VK_TRUE;
|
||||
available_features.samplerAnisotropy = VK_TRUE;
|
||||
available_features.textureCompressionBC = VK_TRUE;
|
||||
available_features.shaderStorageBufferArrayDynamicIndexing = VK_TRUE;
|
||||
enabled_features.robustBufferAccess = VK_TRUE;
|
||||
enabled_features.fullDrawIndexUint32 = VK_TRUE;
|
||||
enabled_features.independentBlend = VK_TRUE;
|
||||
enabled_features.logicOp = VK_TRUE;
|
||||
enabled_features.depthClamp = VK_TRUE;
|
||||
enabled_features.depthBounds = VK_TRUE;
|
||||
enabled_features.wideLines = VK_TRUE;
|
||||
enabled_features.largePoints = VK_TRUE;
|
||||
|
||||
if (g_cfg.video.antialiasing_level != msaa_level::none)
|
||||
{
|
||||
// MSAA features
|
||||
enabled_features.alphaToOne = VK_TRUE;
|
||||
enabled_features.shaderStorageImageMultisample = VK_TRUE;
|
||||
// enabled_features.shaderStorageImageReadWithoutFormat = VK_TRUE; // Unused currently, may be needed soon
|
||||
enabled_features.shaderStorageImageWriteWithoutFormat = VK_TRUE;
|
||||
}
|
||||
|
||||
// enabled_features.shaderSampledImageArrayDynamicIndexing = TRUE; // Unused currently but will be needed soon
|
||||
enabled_features.shaderClipDistance = VK_TRUE;
|
||||
// enabled_features.shaderCullDistance = VK_TRUE; // Alt notation of clip distance
|
||||
|
||||
enabled_features.samplerAnisotropy = VK_TRUE;
|
||||
enabled_features.textureCompressionBC = VK_TRUE;
|
||||
enabled_features.shaderStorageBufferArrayDynamicIndexing = VK_TRUE;
|
||||
|
||||
// Optionally disable unsupported stuff
|
||||
if (!pgpu->features.depthBounds)
|
||||
{
|
||||
LOG_ERROR(RSX, "Your GPU does not support depth bounds testing. Graphics may not work correctly.");
|
||||
enabled_features.depthBounds = VK_FALSE;
|
||||
}
|
||||
|
||||
VkDeviceCreateInfo device = {};
|
||||
device.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
|
@ -790,7 +818,7 @@ private:
|
|||
device.ppEnabledLayerNames = nullptr; // Deprecated
|
||||
device.enabledExtensionCount = (u32)requested_extensions.size();
|
||||
device.ppEnabledExtensionNames = requested_extensions.data();
|
||||
device.pEnabledFeatures = &available_features;
|
||||
device.pEnabledFeatures = &enabled_features;
|
||||
|
||||
VkPhysicalDeviceFloat16Int8FeaturesKHR shader_support_info{};
|
||||
if (pgpu->shader_types_support.allow_float16)
|
||||
|
@ -898,6 +926,11 @@ private:
|
|||
return pgpu->stencil_export_support;
|
||||
}
|
||||
|
||||
bool get_depth_bounds_support() const
|
||||
{
|
||||
return pgpu->features.depthBounds != VK_FALSE;
|
||||
}
|
||||
|
||||
mem_allocator_base* get_allocator() const
|
||||
{
|
||||
return m_allocator.get();
|
||||
|
|
|
@ -126,12 +126,17 @@ struct VKTraits
|
|||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_LINE_WIDTH;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_WRITE_MASK;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BIAS;
|
||||
|
||||
if (vk::get_current_renderer()->get_depth_bounds_support())
|
||||
{
|
||||
dynamic_state_descriptors[dynamic_state_info.dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;
|
||||
}
|
||||
|
||||
dynamic_state_info.pDynamicStates = dynamic_state_descriptors;
|
||||
|
||||
VkPipelineVertexInputStateCreateInfo vi = { VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO };
|
||||
|
|
Loading…
Add table
Reference in a new issue