Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- include/vkd3d_shader.h | 23 ++++++----------------- libs/vkd3d-shader/dxbc.c | 16 ++++++++-------- libs/vkd3d-shader/spirv.c | 5 +++-- 3 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 26a2110..de2c0c7 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -88,11 +88,10 @@ struct vkd3d_shader_code
enum vkd3d_shader_descriptor_type { - VKD3D_SHADER_DESCRIPTOR_TYPE_UNKNOWN, - VKD3D_SHADER_DESCRIPTOR_TYPE_CBV, /* cb# */ - VKD3D_SHADER_DESCRIPTOR_TYPE_SRV, /* t# */ - VKD3D_SHADER_DESCRIPTOR_TYPE_UAV, /* u# */ - VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, /* s# */ + VKD3D_SHADER_DESCRIPTOR_TYPE_SRV = 0x0, /* t# */ + VKD3D_SHADER_DESCRIPTOR_TYPE_UAV = 0x1, /* u# */ + VKD3D_SHADER_DESCRIPTOR_TYPE_CBV = 0x2, /* cb# */ + VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER = 0x3, /* s# */
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_TYPE), }; @@ -450,19 +449,9 @@ struct vkd3d_shader_static_sampler_desc enum vkd3d_shader_visibility shader_visibility; };
-enum vkd3d_shader_descriptor_range_type -{ - VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_SRV = 0x0, - VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_UAV = 0x1, - VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_CBV = 0x2, - VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_SAMPLER = 0x3, - - VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE), -}; - struct vkd3d_shader_descriptor_range { - enum vkd3d_shader_descriptor_range_type range_type; + enum vkd3d_shader_descriptor_type range_type; unsigned int descriptor_count; unsigned int base_shader_register; unsigned int register_space; @@ -558,7 +547,7 @@ enum vkd3d_shader_descriptor_range_flags
struct vkd3d_shader_descriptor_range1 { - enum vkd3d_shader_descriptor_range_type range_type; + enum vkd3d_shader_descriptor_type range_type; unsigned int descriptor_count; unsigned int base_shader_register; unsigned int register_space; diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index df5f6a2..1aa8a5c 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -3143,13 +3143,13 @@ static int validate_descriptor_table_v_1_0(const struct vkd3d_shader_root_descri { const struct vkd3d_shader_descriptor_range *r = &descriptor_table->descriptor_ranges[i];
- if (r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_SRV - || r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_UAV - || r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_CBV) + if (r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_SRV + || r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV + || r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_CBV) { have_srv_uav_cbv = true; } - else if (r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_SAMPLER) + else if (r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER) { have_sampler = true; } @@ -3184,13 +3184,13 @@ static int validate_descriptor_table_v_1_1(const struct vkd3d_shader_root_descri { const struct vkd3d_shader_descriptor_range1 *r = &descriptor_table->descriptor_ranges[i];
- if (r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_SRV - || r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_UAV - || r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_CBV) + if (r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_SRV + || r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV + || r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_CBV) { have_srv_uav_cbv = true; } - else if (r->range_type == VKD3D_SHADER_DESCRIPTOR_RANGE_TYPE_SAMPLER) + else if (r->range_type == VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER) { have_sampler = true; } diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 4d1826f..9ef0430 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2364,7 +2364,6 @@ static struct vkd3d_shader_descriptor_binding vkd3d_dxbc_compiler_get_descriptor struct vkd3d_shader_descriptor_binding binding; unsigned int i;
- descriptor_type = VKD3D_SHADER_DESCRIPTOR_TYPE_UNKNOWN; if (reg->type == VKD3DSPR_CONSTBUFFER) descriptor_type = VKD3D_SHADER_DESCRIPTOR_TYPE_CBV; else if (reg->type == VKD3DSPR_RESOURCE) @@ -2378,6 +2377,7 @@ static struct vkd3d_shader_descriptor_binding vkd3d_dxbc_compiler_get_descriptor FIXME("Unhandled register type %#x.\n", reg->type); vkd3d_dxbc_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE, "Encountered invalid/unhandled register type %#x.", reg->type); + goto done; }
resource_type_flag = resource_type == VKD3D_SHADER_RESOURCE_BUFFER @@ -2406,7 +2406,7 @@ static struct vkd3d_shader_descriptor_binding vkd3d_dxbc_compiler_get_descriptor "Could not find descriptor binding for UAV counter %u, space %u.", reg_idx, register_space); } } - else if (descriptor_type != VKD3D_SHADER_DESCRIPTOR_TYPE_UNKNOWN) + else { for (i = 0; i < shader_interface->binding_count; ++i) { @@ -2432,6 +2432,7 @@ static struct vkd3d_shader_descriptor_binding vkd3d_dxbc_compiler_get_descriptor } }
+done: binding.set = 0; binding.binding = compiler->binding_idx++; return binding;