From 67eae2a2149f4af6ec787fac309b94c74f6c716c Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Thu, 22 Jul 2021 17:06:12 +0200 Subject: [PATCH] vkd3d: Rework how shader model versions are exposed. From native testing, we can expose higher shader models if cap bits features are not supported. E.g. Polaris exposes SM 6.5, even when 16-bit and barycentrics are not supported. Signed-off-by: Hans-Kristian Arntzen --- libs/vkd3d/device.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index f83fb435..3cdf8a1d 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -4887,12 +4887,14 @@ static void d3d12_device_caps_init_shader_model(struct d3d12_device *device) (physical_device_info->subgroup_properties.supportedOperations & required) == required && (physical_device_info->subgroup_properties.supportedStages & required_stages) == required_stages) { + /* From testing on native Polaris drivers, AMD expose SM 6.5, even if lots of features are not supported. + * This is a good hint that shader model versions are not tied to features which have caps bits. + * Only consider required features here. */ + /* SM 6.0 adds: * https://github.com/microsoft/DirectXShaderCompiler/wiki/Shader-Model-6.0 * WaveOps, int64 (optional) */ - device->d3d12_caps.max_shader_model = D3D_SHADER_MODEL_6_0; - TRACE("Enabling support for SM 6.0.\n"); /* SM 6.1 adds: * https://github.com/microsoft/DirectXShaderCompiler/wiki/Shader-Model-6.1 @@ -4903,24 +4905,14 @@ static void d3d12_device_caps_init_shader_model(struct d3d12_device *device) * https://github.com/microsoft/DirectXShaderCompiler/wiki/Shader-Model-6.2 * FP16, Denorm modes (float controls extension) */ - if (device->device_info.float16_int8_features.shaderFloat16 && - device->device_info.storage_16bit_features.storageBuffer16BitAccess && - device->device_info.subgroup_extended_types_features.shaderSubgroupExtendedTypes) - { - /* These features are required by FidelityFX SSSR demo. */ - /* Technically we need storageInputOutput16 as well, but - * we can probably work around it on devices which don't support it. */ - device->d3d12_caps.max_shader_model = D3D_SHADER_MODEL_6_2; - TRACE("Enabling support for SM 6.2.\n"); - } + device->d3d12_caps.max_shader_model = D3D_SHADER_MODEL_6_2; + TRACE("Enabling support for SM 6.2.\n"); /* SM 6.3 adds: * 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) + if (device->d3d12_caps.max_shader_model == D3D_SHADER_MODEL_6_2 && 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;