vkd3d-shader: Add PER_COMPONENT_ROBUSTNESS shader extension.
Signals that we can use vectorized vec3 byte address buffers. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
e605d19ef7
commit
58aab78a5b
|
@ -292,6 +292,14 @@ enum vkd3d_shader_target_extension
|
|||
VKD3D_SHADER_TARGET_EXTENSION_SPV_KHR_INTEGER_DOT_PRODUCT,
|
||||
VKD3D_SHADER_TARGET_EXTENSION_RAY_TRACING_PRIMITIVE_CULLING,
|
||||
VKD3D_SHADER_TARGET_EXTENSION_SCALAR_BLOCK_LAYOUT,
|
||||
|
||||
/* When using scalar block layout with a vec3 array on a byte address buffer,
|
||||
* there is diverging behavior across hardware.
|
||||
* On AMD, robustness is checked per component, which means we can implement ByteAddressBuffer
|
||||
* without further hackery. On NVIDIA, robustness does not seem to work this way, so it's either
|
||||
* all in range, or all out of range. We can implement structured buffer vectorization of vec3,
|
||||
* but not byte address buffer. */
|
||||
VKD3D_SHADER_TARGET_EXTENSION_ASSUME_PER_COMPONENT_SSBO_ROBUSTNESS,
|
||||
};
|
||||
|
||||
enum vkd3d_shader_quirk
|
||||
|
|
|
@ -513,7 +513,7 @@ int vkd3d_shader_compile_dxil(const struct vkd3d_shader_code *dxbc,
|
|||
dxil_spv_parsed_blob blob = NULL;
|
||||
dxil_spv_compiled_spirv compiled;
|
||||
dxil_spv_shader_stage stage;
|
||||
unsigned int i, max_size;
|
||||
unsigned int i, j, max_size;
|
||||
vkd3d_shader_hash_t hash;
|
||||
int ret = VKD3D_OK;
|
||||
uint32_t quirks;
|
||||
|
@ -744,8 +744,19 @@ int vkd3d_shader_compile_dxil(const struct vkd3d_shader_code *dxbc,
|
|||
}
|
||||
else if (compiler_args->target_extensions[i] == VKD3D_SHADER_TARGET_EXTENSION_SCALAR_BLOCK_LAYOUT)
|
||||
{
|
||||
static const dxil_spv_option_scalar_block_layout helper =
|
||||
dxil_spv_option_scalar_block_layout helper =
|
||||
{ { DXIL_SPV_OPTION_SCALAR_BLOCK_LAYOUT }, DXIL_SPV_TRUE };
|
||||
|
||||
for (j = 0; j < compiler_args->target_extension_count; j++)
|
||||
{
|
||||
if (compiler_args->target_extensions[j] ==
|
||||
VKD3D_SHADER_TARGET_EXTENSION_ASSUME_PER_COMPONENT_SSBO_ROBUSTNESS)
|
||||
{
|
||||
helper.supports_per_component_robustness = DXIL_SPV_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
|
||||
{
|
||||
ERR("dxil-spirv does not support SCALAR_BLOCK_LAYOUT.\n");
|
||||
|
@ -1205,8 +1216,19 @@ int vkd3d_shader_compile_dxil_export(const struct vkd3d_shader_code *dxil,
|
|||
}
|
||||
else if (compiler_args->target_extensions[i] == VKD3D_SHADER_TARGET_EXTENSION_SCALAR_BLOCK_LAYOUT)
|
||||
{
|
||||
static const dxil_spv_option_scalar_block_layout helper =
|
||||
dxil_spv_option_scalar_block_layout helper =
|
||||
{ { DXIL_SPV_OPTION_SCALAR_BLOCK_LAYOUT }, DXIL_SPV_TRUE };
|
||||
|
||||
for (j = 0; j < compiler_args->target_extension_count; j++)
|
||||
{
|
||||
if (compiler_args->target_extensions[j] ==
|
||||
VKD3D_SHADER_TARGET_EXTENSION_ASSUME_PER_COMPONENT_SSBO_ROBUSTNESS)
|
||||
{
|
||||
helper.supports_per_component_robustness = DXIL_SPV_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
|
||||
{
|
||||
ERR("dxil-spirv does not support SCALAR_BLOCK_LAYOUT.\n");
|
||||
|
|
Loading…
Reference in New Issue