Skip to content

Commit

Permalink
vkd3d: Do not attempt to enable anything RT related.
Browse files Browse the repository at this point in the history
Temporary workaround for release build to avoid causing vkCreateDevice failures on Ampere
with Steam Linux runtime.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
  • Loading branch information
HansKristian-Work committed Feb 19, 2021
1 parent dc246a7 commit eca8e49
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 59 deletions.
53 changes: 1 addition & 52 deletions libs/vkd3d/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] =
VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore),
VK_EXTENSION(KHR_SHADER_FLOAT16_INT8, KHR_shader_float16_int8),
VK_EXTENSION(KHR_SHADER_SUBGROUP_EXTENDED_TYPES, KHR_shader_subgroup_extended_types),
VK_EXTENSION(KHR_RAY_TRACING_PIPELINE, KHR_ray_tracing_pipeline),
VK_EXTENSION(KHR_ACCELERATION_STRUCTURE, KHR_acceleration_structure),
VK_EXTENSION(KHR_DEFERRED_HOST_OPERATIONS, KHR_deferred_host_operations),
VK_EXTENSION(KHR_SPIRV_1_4, KHR_spirv_1_4),
VK_EXTENSION(KHR_SHADER_FLOAT_CONTROLS, KHR_shader_float_controls),
VK_EXTENSION(KHR_FRAGMENT_SHADING_RATE, KHR_fragment_shading_rate),
Expand Down Expand Up @@ -1042,19 +1039,6 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
vk_prepend_struct(&info->features2, &info->mutable_descriptor_features);
}

if (vulkan_info->KHR_acceleration_structure && vulkan_info->KHR_ray_tracing_pipeline &&
vulkan_info->KHR_deferred_host_operations && vulkan_info->KHR_spirv_1_4)
{
info->acceleration_structure_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR;
info->acceleration_structure_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR;
info->ray_tracing_pipeline_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR;
info->ray_tracing_pipeline_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR;
vk_prepend_struct(&info->features2, &info->acceleration_structure_features);
vk_prepend_struct(&info->features2, &info->ray_tracing_pipeline_features);
vk_prepend_struct(&info->properties2, &info->acceleration_structure_properties);
vk_prepend_struct(&info->properties2, &info->ray_tracing_pipeline_properties);
}

if (vulkan_info->KHR_shader_float_controls)
{
info->float_control_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR;
Expand Down Expand Up @@ -1560,7 +1544,6 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
struct vkd3d_physical_device_info *physical_device_info)
{
const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
VkPhysicalDeviceAccelerationStructureFeaturesKHR *acceleration_structure;
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR *buffer_device_address;
VkPhysicalDeviceDescriptorIndexingFeaturesEXT *descriptor_indexing;
VkPhysicalDevice physical_device = device->vk_physical_device;
Expand Down Expand Up @@ -1623,9 +1606,6 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
descriptor_indexing->shaderInputAttachmentArrayDynamicIndexing = VK_FALSE;
descriptor_indexing->shaderInputAttachmentArrayNonUniformIndexing = VK_FALSE;

acceleration_structure = &physical_device_info->acceleration_structure_features;
acceleration_structure->accelerationStructureCaptureReplay = VK_FALSE;

if (vulkan_info->EXT_descriptor_indexing && descriptor_indexing
&& (descriptor_indexing->descriptorBindingUniformBufferUpdateAfterBind
|| descriptor_indexing->descriptorBindingStorageBufferUpdateAfterBind
Expand Down Expand Up @@ -4339,29 +4319,6 @@ static D3D12_TILED_RESOURCES_TIER d3d12_device_determine_tiled_resources_tier(st
return D3D12_TILED_RESOURCES_TIER_2;
}

static D3D12_RAYTRACING_TIER d3d12_device_determine_ray_tracing_tier(struct d3d12_device *device)
{
const struct vkd3d_physical_device_info *info = &device->device_info;

/* Currently disabled until fully supported, but add checks for now. */
if (info->ray_tracing_pipeline_features.rayTracingPipeline &&
info->acceleration_structure_features.accelerationStructure &&
info->ray_tracing_pipeline_properties.maxRayHitAttributeSize >= D3D12_RAYTRACING_MAX_ATTRIBUTE_SIZE_IN_BYTES &&
/* Group handle size must match exactly or ShaderRecord layout will not match.
* Can potentially fixup local root signature if HandleSize < 32,
* but Vulkan is essentially specced to match DXR directly. */
info->ray_tracing_pipeline_properties.shaderGroupHandleSize == D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES &&
info->ray_tracing_pipeline_properties.shaderGroupBaseAlignment <= D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT &&
info->ray_tracing_pipeline_properties.shaderGroupHandleAlignment <= D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT &&
info->ray_tracing_pipeline_properties.maxRayRecursionDepth >= D3D12_RAYTRACING_MAX_DECLARABLE_TRACE_RECURSION_DEPTH)
{
INFO("DXR could potentially be supported, but not enabling by default for now.\n");
return D3D12_RAYTRACING_TIER_NOT_SUPPORTED;
}
else
return D3D12_RAYTRACING_TIER_NOT_SUPPORTED;
}

static D3D12_RESOURCE_HEAP_TIER d3d12_device_determine_heap_tier(struct d3d12_device *device)
{
const VkPhysicalDeviceLimits *limits = &device->device_info.properties2.properties.limits;
Expand Down Expand Up @@ -4510,7 +4467,7 @@ static void d3d12_device_caps_init_feature_options5(struct d3d12_device *device)
options5->SRVOnlyTiledResourceTier3 = options->TiledResourcesTier >= D3D12_TILED_RESOURCES_TIER_3;
/* Currently not supported */
options5->RenderPassesTier = D3D12_RENDER_PASS_TIER_0;
options5->RaytracingTier = d3d12_device_determine_ray_tracing_tier(device);
options5->RaytracingTier = D3D12_RAYTRACING_TIER_NOT_SUPPORTED;
}

static void d3d12_device_caps_init_feature_options6(struct d3d12_device *device)
Expand Down Expand Up @@ -4612,14 +4569,6 @@ static void d3d12_device_caps_init_shader_model(struct d3d12_device *device)
* https://github.com/microsoft/DirectXShaderCompiler/wiki/Shader-Model-6.3
* Ray tracing (lib_6_3 multi entry point targets).
*/
if (device->d3d12_caps.max_shader_model == D3D_SHADER_MODEL_6_2 &&
device->device_info.ray_tracing_pipeline_features.rayTracingPipeline &&
device->vk_info.KHR_spirv_1_4)
{
/* SPIR-V 1.4 is required for lib_6_3 since that is required for RT. */
device->d3d12_caps.max_shader_model = D3D_SHADER_MODEL_6_3;
TRACE("Enabling support for SM 6.3.\n");
}

/* SM 6.4 adds:
* https://github.com/microsoft/DirectXShaderCompiler/wiki/Shader-Model-6.4
Expand Down
7 changes: 0 additions & 7 deletions libs/vkd3d/vkd3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ struct vkd3d_vulkan_info
bool KHR_timeline_semaphore;
bool KHR_shader_float16_int8;
bool KHR_shader_subgroup_extended_types;
bool KHR_ray_tracing_pipeline;
bool KHR_acceleration_structure;
bool KHR_deferred_host_operations;
bool KHR_spirv_1_4;
bool KHR_shader_float_controls;
bool KHR_fragment_shading_rate;
Expand Down Expand Up @@ -2213,8 +2210,6 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT sampler_filter_minmax_properties;
VkPhysicalDeviceRobustness2PropertiesEXT robustness2_properties;
VkPhysicalDeviceExternalMemoryHostPropertiesEXT external_memory_host_properties;
VkPhysicalDeviceRayTracingPipelinePropertiesKHR ray_tracing_pipeline_properties;
VkPhysicalDeviceAccelerationStructurePropertiesKHR acceleration_structure_properties;
VkPhysicalDeviceFloatControlsPropertiesKHR float_control_properties;
VkPhysicalDeviceFragmentShadingRatePropertiesKHR fragment_shading_rate_properties;

Expand All @@ -2238,8 +2233,6 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceRobustness2FeaturesEXT robustness2_features;
VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extended_dynamic_state_features;
VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE mutable_descriptor_features;
VkPhysicalDeviceRayTracingPipelineFeaturesKHR ray_tracing_pipeline_features;
VkPhysicalDeviceAccelerationStructureFeaturesKHR acceleration_structure_features;
VkPhysicalDeviceFragmentShadingRateFeaturesKHR fragment_shading_rate_features;

VkPhysicalDeviceFeatures2 features2;
Expand Down

0 comments on commit eca8e49

Please sign in to comment.