vkd3d-shader: Add way to pass down descriptor QA buffers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-05-14 13:50:34 +02:00
parent b49df76367
commit 0d5f1d7784
2 changed files with 46 additions and 0 deletions

View File

@ -180,6 +180,7 @@ enum vkd3d_shader_interface_flag
VKD3D_SHADER_INTERFACE_BINDLESS_CBV_AS_STORAGE_BUFFER = 0x00000002u,
VKD3D_SHADER_INTERFACE_SSBO_OFFSET_BUFFER = 0x00000004u,
VKD3D_SHADER_INTERFACE_TYPED_OFFSET_BUFFER = 0x00000008u,
VKD3D_SHADER_INTERFACE_DESCRIPTOR_QA_BUFFER = 0x00000010u
};
struct vkd3d_shader_interface_info
@ -199,6 +200,11 @@ struct vkd3d_shader_interface_info
/* Ignored unless VKD3D_SHADER_INTERFACE_SSBO_OFFSET_BUFFER or TYPED_OFFSET_BUFFER is set */
const struct vkd3d_shader_descriptor_binding *offset_buffer_binding;
/* Ignored unless VKD3D_SHADER_INTERFACE_DESCRIPTOR_QA_BUFFER is set. */
const struct vkd3d_shader_descriptor_binding *descriptor_qa_global_binding;
/* Ignored unless VKD3D_SHADER_INTERFACE_DESCRIPTOR_QA_BUFFER is set. */
const struct vkd3d_shader_descriptor_binding *descriptor_qa_heap_binding;
VkShaderStageFlagBits stage;
const struct vkd3d_shader_transform_feedback_info *xfb_info;

View File

@ -635,6 +635,26 @@ int vkd3d_shader_compile_dxil(const struct vkd3d_shader_code *dxbc,
}
}
if (shader_interface_info->flags & VKD3D_SHADER_INTERFACE_DESCRIPTOR_QA_BUFFER)
{
struct dxil_spv_option_descriptor_qa helper;
helper.base.type = DXIL_SPV_OPTION_DESCRIPTOR_QA;
helper.enabled = DXIL_SPV_TRUE;
helper.version = DXIL_SPV_DESCRIPTOR_QA_INTERFACE_VERSION;
helper.shader_hash = hash;
helper.global_desc_set = shader_interface_info->descriptor_qa_global_binding->set;
helper.global_binding = shader_interface_info->descriptor_qa_global_binding->binding;
helper.heap_desc_set = shader_interface_info->descriptor_qa_heap_binding->set;
helper.heap_binding = shader_interface_info->descriptor_qa_heap_binding->binding;
if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
{
ERR("dxil-spirv does not support DESCRIPTOR_QA_BUFFER.\n");
ret = VKD3D_ERROR_NOT_IMPLEMENTED;
goto end;
}
}
{
const struct dxil_spv_option_bindless_offset_buffer_layout helper =
{ { DXIL_SPV_OPTION_BINDLESS_OFFSET_BUFFER_LAYOUT },
@ -1027,6 +1047,26 @@ int vkd3d_shader_compile_dxil_export(const struct vkd3d_shader_code *dxil,
}
}
if (shader_interface_info->flags & VKD3D_SHADER_INTERFACE_DESCRIPTOR_QA_BUFFER)
{
struct dxil_spv_option_descriptor_qa helper;
helper.base.type = DXIL_SPV_OPTION_DESCRIPTOR_QA;
helper.enabled = DXIL_SPV_TRUE;
helper.version = DXIL_SPV_DESCRIPTOR_QA_INTERFACE_VERSION;
helper.shader_hash = hash;
helper.global_desc_set = shader_interface_info->descriptor_qa_global_binding->set;
helper.global_binding = shader_interface_info->descriptor_qa_global_binding->binding;
helper.heap_desc_set = shader_interface_info->descriptor_qa_heap_binding->set;
helper.heap_binding = shader_interface_info->descriptor_qa_heap_binding->binding;
if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
{
ERR("dxil-spirv does not support DESCRIPTOR_QA_BUFFER.\n");
ret = VKD3D_ERROR_NOT_IMPLEMENTED;
goto end;
}
}
{
const struct dxil_spv_option_sbt_descriptor_size_log2 helper =
{ { DXIL_SPV_OPTION_SBT_DESCRIPTOR_SIZE_LOG2 },