vkd3d-shader: Rename the vkd3d_root_signature_version enumeration to vkd3d_shader_root_signature_version.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-07-21 15:20:02 +04:30 committed by Alexandre Julliard
parent 9366248ed2
commit 0056fc7046
5 changed files with 39 additions and 37 deletions

View File

@ -568,17 +568,17 @@ struct vkd3d_root_signature_desc1
enum vkd3d_shader_root_signature_flags flags; enum vkd3d_shader_root_signature_flags flags;
}; };
enum vkd3d_root_signature_version enum vkd3d_shader_root_signature_version
{ {
VKD3D_ROOT_SIGNATURE_VERSION_1_0 = 0x1, VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0 = 0x1,
VKD3D_ROOT_SIGNATURE_VERSION_1_1 = 0x2, VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1 = 0x2,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_ROOT_SIGNATURE_VERSION), VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_ROOT_SIGNATURE_VERSION),
}; };
struct vkd3d_versioned_root_signature_desc struct vkd3d_versioned_root_signature_desc
{ {
enum vkd3d_root_signature_version version; enum vkd3d_shader_root_signature_version version;
union union
{ {
struct vkd3d_root_signature_desc v_1_0; struct vkd3d_root_signature_desc v_1_0;
@ -737,7 +737,7 @@ int vkd3d_shader_serialize_root_signature(const struct vkd3d_versioned_root_sign
struct vkd3d_shader_code *dxbc); struct vkd3d_shader_code *dxbc);
int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_desc *dst, int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_desc *dst,
enum vkd3d_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src); enum vkd3d_shader_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src);
int vkd3d_shader_scan_dxbc(const struct vkd3d_shader_code *dxbc, int vkd3d_shader_scan_dxbc(const struct vkd3d_shader_code *dxbc,
struct vkd3d_shader_scan_info *scan_info); struct vkd3d_shader_scan_info *scan_info);
@ -767,7 +767,7 @@ typedef int (*PFN_vkd3d_shader_serialize_root_signature)(
const struct vkd3d_versioned_root_signature_desc *root_signature, struct vkd3d_shader_code *dxbc); const struct vkd3d_versioned_root_signature_desc *root_signature, struct vkd3d_shader_code *dxbc);
typedef int (*PFN_vkd3d_shader_convert_root_signature)(struct vkd3d_versioned_root_signature_desc *dst, typedef int (*PFN_vkd3d_shader_convert_root_signature)(struct vkd3d_versioned_root_signature_desc *dst,
enum vkd3d_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src); enum vkd3d_shader_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src);
typedef int (*PFN_vkd3d_shader_scan_dxbc)(const struct vkd3d_shader_code *dxbc, typedef int (*PFN_vkd3d_shader_scan_dxbc)(const struct vkd3d_shader_code *dxbc,
struct vkd3d_shader_scan_info *scan_info); struct vkd3d_shader_scan_info *scan_info);

View File

@ -2580,7 +2580,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
read_dword(&ptr, &version); read_dword(&ptr, &version);
TRACE("Version %#x.\n", version); TRACE("Version %#x.\n", version);
if (version != VKD3D_ROOT_SIGNATURE_VERSION_1_0 && version != VKD3D_ROOT_SIGNATURE_VERSION_1_1) if (version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0 && version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1)
{ {
FIXME("Unknown version %#x.\n", version); FIXME("Unknown version %#x.\n", version);
return VKD3D_ERROR_INVALID_ARGUMENT; return VKD3D_ERROR_INVALID_ARGUMENT;
@ -2591,7 +2591,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
read_dword(&ptr, &offset); read_dword(&ptr, &offset);
TRACE("Parameter count %u, offset %u.\n", count, offset); TRACE("Parameter count %u, offset %u.\n", count, offset);
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
{ {
v_1_0->parameter_count = count; v_1_0->parameter_count = count;
if (v_1_0->parameter_count) if (v_1_0->parameter_count)
@ -2608,7 +2608,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
{ {
struct vkd3d_root_signature_desc1 *v_1_1 = &desc->u.v_1_1; struct vkd3d_root_signature_desc1 *v_1_1 = &desc->u.v_1_1;
assert(version == VKD3D_ROOT_SIGNATURE_VERSION_1_1); assert(version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1);
v_1_1->parameter_count = count; v_1_1->parameter_count = count;
if (v_1_1->parameter_count) if (v_1_1->parameter_count)
@ -2672,7 +2672,7 @@ int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
static unsigned int versioned_root_signature_get_parameter_count(const struct vkd3d_versioned_root_signature_desc *desc) static unsigned int versioned_root_signature_get_parameter_count(const struct vkd3d_versioned_root_signature_desc *desc)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.parameter_count; return desc->u.v_1_0.parameter_count;
else else
return desc->u.v_1_1.parameter_count; return desc->u.v_1_1.parameter_count;
@ -2681,7 +2681,7 @@ static unsigned int versioned_root_signature_get_parameter_count(const struct vk
static enum vkd3d_shader_root_parameter_type versioned_root_signature_get_parameter_type( static enum vkd3d_shader_root_parameter_type versioned_root_signature_get_parameter_type(
const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i) const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.parameters[i].parameter_type; return desc->u.v_1_0.parameters[i].parameter_type;
else else
return desc->u.v_1_1.parameters[i].parameter_type; return desc->u.v_1_1.parameters[i].parameter_type;
@ -2690,7 +2690,7 @@ static enum vkd3d_shader_root_parameter_type versioned_root_signature_get_parame
static enum vkd3d_shader_visibility versioned_root_signature_get_parameter_shader_visibility( static enum vkd3d_shader_visibility versioned_root_signature_get_parameter_shader_visibility(
const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i) const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.parameters[i].shader_visibility; return desc->u.v_1_0.parameters[i].shader_visibility;
else else
return desc->u.v_1_1.parameters[i].shader_visibility; return desc->u.v_1_1.parameters[i].shader_visibility;
@ -2699,7 +2699,7 @@ static enum vkd3d_shader_visibility versioned_root_signature_get_parameter_shade
static const struct vkd3d_shader_root_constants *versioned_root_signature_get_root_constants( static const struct vkd3d_shader_root_constants *versioned_root_signature_get_root_constants(
const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i) const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return &desc->u.v_1_0.parameters[i].u.constants; return &desc->u.v_1_0.parameters[i].u.constants;
else else
return &desc->u.v_1_1.parameters[i].u.constants; return &desc->u.v_1_1.parameters[i].u.constants;
@ -2707,7 +2707,7 @@ static const struct vkd3d_shader_root_constants *versioned_root_signature_get_ro
static unsigned int versioned_root_signature_get_static_sampler_count(const struct vkd3d_versioned_root_signature_desc *desc) static unsigned int versioned_root_signature_get_static_sampler_count(const struct vkd3d_versioned_root_signature_desc *desc)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.static_sampler_count; return desc->u.v_1_0.static_sampler_count;
else else
return desc->u.v_1_1.static_sampler_count; return desc->u.v_1_1.static_sampler_count;
@ -2716,7 +2716,7 @@ static unsigned int versioned_root_signature_get_static_sampler_count(const stru
static const struct vkd3d_shader_static_sampler_desc *versioned_root_signature_get_static_samplers( static const struct vkd3d_shader_static_sampler_desc *versioned_root_signature_get_static_samplers(
const struct vkd3d_versioned_root_signature_desc *desc) const struct vkd3d_versioned_root_signature_desc *desc)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.static_samplers; return desc->u.v_1_0.static_samplers;
else else
return desc->u.v_1_1.static_samplers; return desc->u.v_1_1.static_samplers;
@ -2724,7 +2724,7 @@ static const struct vkd3d_shader_static_sampler_desc *versioned_root_signature_g
static unsigned int versioned_root_signature_get_flags(const struct vkd3d_versioned_root_signature_desc *desc) static unsigned int versioned_root_signature_get_flags(const struct vkd3d_versioned_root_signature_desc *desc)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.flags; return desc->u.v_1_0.flags;
else else
return desc->u.v_1_1.flags; return desc->u.v_1_1.flags;
@ -2939,7 +2939,7 @@ static int shader_write_root_parameters(struct root_signature_writer_context *co
switch (versioned_root_signature_get_parameter_type(desc, i)) switch (versioned_root_signature_get_parameter_type(desc, i))
{ {
case VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE: case VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
ret = shader_write_descriptor_table(context, &desc->u.v_1_0.parameters[i].u.descriptor_table); ret = shader_write_descriptor_table(context, &desc->u.v_1_0.parameters[i].u.descriptor_table);
else else
ret = shader_write_descriptor_table1(context, &desc->u.v_1_1.parameters[i].u.descriptor_table); ret = shader_write_descriptor_table1(context, &desc->u.v_1_1.parameters[i].u.descriptor_table);
@ -2950,7 +2950,7 @@ static int shader_write_root_parameters(struct root_signature_writer_context *co
case VKD3D_SHADER_ROOT_PARAMETER_TYPE_CBV: case VKD3D_SHADER_ROOT_PARAMETER_TYPE_CBV:
case VKD3D_SHADER_ROOT_PARAMETER_TYPE_SRV: case VKD3D_SHADER_ROOT_PARAMETER_TYPE_SRV:
case VKD3D_SHADER_ROOT_PARAMETER_TYPE_UAV: case VKD3D_SHADER_ROOT_PARAMETER_TYPE_UAV:
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
ret = shader_write_root_descriptor(context, &desc->u.v_1_0.parameters[i].u.descriptor); ret = shader_write_root_descriptor(context, &desc->u.v_1_0.parameters[i].u.descriptor);
else else
ret = shader_write_root_descriptor1(context, &desc->u.v_1_1.parameters[i].u.descriptor); ret = shader_write_root_descriptor1(context, &desc->u.v_1_1.parameters[i].u.descriptor);
@ -3120,7 +3120,7 @@ static int validate_root_signature_desc(const struct vkd3d_versioned_root_signat
type = versioned_root_signature_get_parameter_type(desc, i); type = versioned_root_signature_get_parameter_type(desc, i);
if (type == VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE) if (type == VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
ret = validate_descriptor_table_v_1_0(&desc->u.v_1_0.parameters[i].u.descriptor_table); ret = validate_descriptor_table_v_1_0(&desc->u.v_1_0.parameters[i].u.descriptor_table);
else else
ret = validate_descriptor_table_v_1_1(&desc->u.v_1_1.parameters[i].u.descriptor_table); ret = validate_descriptor_table_v_1_1(&desc->u.v_1_1.parameters[i].u.descriptor_table);
@ -3143,8 +3143,8 @@ int vkd3d_shader_serialize_root_signature(const struct vkd3d_versioned_root_sign
TRACE("root_signature %p, dxbc %p.\n", root_signature, dxbc); TRACE("root_signature %p, dxbc %p.\n", root_signature, dxbc);
if (root_signature->version != VKD3D_ROOT_SIGNATURE_VERSION_1_0 if (root_signature->version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0
&& root_signature->version != VKD3D_ROOT_SIGNATURE_VERSION_1_1) && root_signature->version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1)
{ {
WARN("Root signature version %#x not supported.\n", root_signature->version); WARN("Root signature version %#x not supported.\n", root_signature->version);
return VKD3D_ERROR_INVALID_ARGUMENT; return VKD3D_ERROR_INVALID_ARGUMENT;
@ -3422,7 +3422,7 @@ fail:
} }
int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_desc *dst, int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_desc *dst,
enum vkd3d_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src) enum vkd3d_shader_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src)
{ {
int ret; int ret;
@ -3434,13 +3434,14 @@ int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_de
return VKD3D_ERROR_INVALID_ARGUMENT; return VKD3D_ERROR_INVALID_ARGUMENT;
} }
if (version != VKD3D_ROOT_SIGNATURE_VERSION_1_0 && version != VKD3D_ROOT_SIGNATURE_VERSION_1_1) if (version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0 && version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1)
{ {
WARN("Root signature version %#x not supported.\n", version); WARN("Root signature version %#x not supported.\n", version);
return VKD3D_ERROR_INVALID_ARGUMENT; return VKD3D_ERROR_INVALID_ARGUMENT;
} }
if (src->version != VKD3D_ROOT_SIGNATURE_VERSION_1_0 && src->version != VKD3D_ROOT_SIGNATURE_VERSION_1_1) if (src->version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0
&& src->version != VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1)
{ {
WARN("Root signature version %#x not supported.\n", src->version); WARN("Root signature version %#x not supported.\n", src->version);
return VKD3D_ERROR_INVALID_ARGUMENT; return VKD3D_ERROR_INVALID_ARGUMENT;
@ -3449,13 +3450,13 @@ int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_de
memset(dst, 0, sizeof(*dst)); memset(dst, 0, sizeof(*dst));
dst->version = version; dst->version = version;
if (version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
{ {
ret = convert_root_signature_to_v1_0(dst, src); ret = convert_root_signature_to_v1_0(dst, src);
} }
else else
{ {
assert(version == VKD3D_ROOT_SIGNATURE_VERSION_1_1); assert(version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1);
ret = convert_root_signature_to_v1_1(dst, src); ret = convert_root_signature_to_v1_1(dst, src);
} }

View File

@ -514,11 +514,11 @@ static void vkd3d_shader_free_root_signature_v_1_1(struct vkd3d_root_signature_d
void vkd3d_shader_free_root_signature(struct vkd3d_versioned_root_signature_desc *desc) void vkd3d_shader_free_root_signature(struct vkd3d_versioned_root_signature_desc *desc)
{ {
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
{ {
vkd3d_shader_free_root_signature_v_1_0(&desc->u.v_1_0); vkd3d_shader_free_root_signature_v_1_0(&desc->u.v_1_0);
} }
else if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_1) else if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1)
{ {
vkd3d_shader_free_root_signature_v_1_1(&desc->u.v_1_1); vkd3d_shader_free_root_signature_v_1_1(&desc->u.v_1_1);
} }

View File

@ -180,15 +180,15 @@ int vkd3d_parse_root_signature_v_1_0(const struct vkd3d_shader_code *dxbc,
return ret; return ret;
} }
if (desc.version == VKD3D_ROOT_SIGNATURE_VERSION_1_0) if (desc.version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
{ {
*out_desc = desc; *out_desc = desc;
} }
else else
{ {
enum vkd3d_root_signature_version version = desc.version; enum vkd3d_shader_root_signature_version version = desc.version;
ret = vkd3d_shader_convert_root_signature(&converted_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_0, &desc); ret = vkd3d_shader_convert_root_signature(&converted_desc, VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0, &desc);
vkd3d_shader_free_root_signature(&desc); vkd3d_shader_free_root_signature(&desc);
if (ret < 0) if (ret < 0)
{ {
@ -309,14 +309,15 @@ static ULONG STDMETHODCALLTYPE d3d12_versioned_root_signature_deserializer_Relea
return refcount; return refcount;
} }
static enum vkd3d_root_signature_version vkd3d_root_signature_version_from_d3d12(D3D_ROOT_SIGNATURE_VERSION version) static enum vkd3d_shader_root_signature_version vkd3d_root_signature_version_from_d3d12(
D3D_ROOT_SIGNATURE_VERSION version)
{ {
switch (version) switch (version)
{ {
case D3D_ROOT_SIGNATURE_VERSION_1_0: case D3D_ROOT_SIGNATURE_VERSION_1_0:
return VKD3D_ROOT_SIGNATURE_VERSION_1_0; return VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0;
case D3D_ROOT_SIGNATURE_VERSION_1_1: case D3D_ROOT_SIGNATURE_VERSION_1_1:
return VKD3D_ROOT_SIGNATURE_VERSION_1_1; return VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1;
default: default:
WARN("Unknown root signature version %#x.\n", version); WARN("Unknown root signature version %#x.\n", version);
return 0; return 0;
@ -562,7 +563,7 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
if (error_blob) if (error_blob)
*error_blob = NULL; *error_blob = NULL;
vkd3d_desc.version = VKD3D_ROOT_SIGNATURE_VERSION_1_0; vkd3d_desc.version = VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0;
vkd3d_desc.u.v_1_0 = *(const struct vkd3d_root_signature_desc *)desc; vkd3d_desc.u.v_1_0 = *(const struct vkd3d_root_signature_desc *)desc;
if ((ret = vkd3d_shader_serialize_root_signature(&vkd3d_desc, &dxbc)) < 0) if ((ret = vkd3d_shader_serialize_root_signature(&vkd3d_desc, &dxbc)) < 0)
{ {

View File

@ -90,7 +90,7 @@ static void test_vkd3d_shader_pfns(void)
static const struct vkd3d_versioned_root_signature_desc empty_rs_desc = static const struct vkd3d_versioned_root_signature_desc empty_rs_desc =
{ {
.version = VKD3D_ROOT_SIGNATURE_VERSION_1_0, .version = VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0,
}; };
static const DWORD vs_code[] = static const DWORD vs_code[] =
{ {