To vkd3d_shader_versioned_root_signature_desc.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- include/vkd3d_shader.h | 22 +++++++++--------- libs/vkd3d-shader/dxbc.c | 44 ++++++++++++++++++----------------- libs/vkd3d-shader/vkd3d_shader_main.c | 2 +- libs/vkd3d/state.c | 2 +- libs/vkd3d/vkd3d_main.c | 16 ++++++------- libs/vkd3d/vkd3d_private.h | 2 +- tests/vkd3d_shader_api.c | 4 ++-- 7 files changed, 47 insertions(+), 45 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 3bd9ce5..601f21f 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -576,7 +576,7 @@ enum vkd3d_shader_root_signature_version VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_ROOT_SIGNATURE_VERSION), };
-struct vkd3d_versioned_root_signature_desc +struct vkd3d_shader_versioned_root_signature_desc { enum vkd3d_shader_root_signature_version version; union @@ -729,15 +729,15 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info, s void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code);
int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc, - struct vkd3d_versioned_root_signature_desc *root_signature); -void vkd3d_shader_free_root_signature(struct vkd3d_versioned_root_signature_desc *root_signature); + struct vkd3d_shader_versioned_root_signature_desc *root_signature); +void vkd3d_shader_free_root_signature(struct vkd3d_shader_versioned_root_signature_desc *root_signature);
/* FIXME: Add support for returning error messages (ID3DBlob). */ -int vkd3d_shader_serialize_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature, +int vkd3d_shader_serialize_root_signature(const struct vkd3d_shader_versioned_root_signature_desc *root_signature, struct vkd3d_shader_code *dxbc);
-int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_desc *dst, - enum vkd3d_shader_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src); +int vkd3d_shader_convert_root_signature(struct vkd3d_shader_versioned_root_signature_desc *dst, + enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src);
int vkd3d_shader_scan_dxbc(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_scan_info *scan_info); @@ -760,14 +760,14 @@ typedef int (*PFN_vkd3d_shader_compile)(const struct vkd3d_shader_compile_info * typedef void (*PFN_vkd3d_shader_free_shader_code)(struct vkd3d_shader_code *code);
typedef int (*PFN_vkd3d_shader_parse_root_signature)(const struct vkd3d_shader_code *dxbc, - struct vkd3d_versioned_root_signature_desc *root_signature); -typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_versioned_root_signature_desc *root_signature); + struct vkd3d_shader_versioned_root_signature_desc *root_signature); +typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_shader_versioned_root_signature_desc *root_signature);
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_shader_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, - enum vkd3d_shader_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src); +typedef int (*PFN_vkd3d_shader_convert_root_signature)(struct vkd3d_shader_versioned_root_signature_desc *dst, + enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src);
typedef int (*PFN_vkd3d_shader_scan_dxbc)(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_scan_info *scan_info); diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index dd57287..21efffd 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -2561,7 +2561,7 @@ static int shader_parse_static_samplers(struct root_signature_parser_context *co }
static int shader_parse_root_signature(const char *data, unsigned int data_size, - struct vkd3d_versioned_root_signature_desc *desc) + struct vkd3d_shader_versioned_root_signature_desc *desc) { struct vkd3d_shader_root_signature_desc *v_1_0 = &desc->u.v_1_0; struct root_signature_parser_context context; @@ -2645,7 +2645,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
static int rts0_handler(const char *data, DWORD data_size, DWORD tag, void *context) { - struct vkd3d_versioned_root_signature_desc *desc = context; + struct vkd3d_shader_versioned_root_signature_desc *desc = context;
if (tag != TAG_RTS0) return VKD3D_OK; @@ -2654,7 +2654,7 @@ static int rts0_handler(const char *data, DWORD data_size, DWORD tag, void *cont }
int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc, - struct vkd3d_versioned_root_signature_desc *root_signature) + struct vkd3d_shader_versioned_root_signature_desc *root_signature) { int ret;
@@ -2670,7 +2670,8 @@ int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc, return VKD3D_OK; }
-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_shader_versioned_root_signature_desc *desc) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return desc->u.v_1_0.parameter_count; @@ -2679,7 +2680,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( - const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i) + const struct vkd3d_shader_versioned_root_signature_desc *desc, unsigned int i) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return desc->u.v_1_0.parameters[i].parameter_type; @@ -2688,7 +2689,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( - const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i) + const struct vkd3d_shader_versioned_root_signature_desc *desc, unsigned int i) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return desc->u.v_1_0.parameters[i].shader_visibility; @@ -2697,7 +2698,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( - const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i) + const struct vkd3d_shader_versioned_root_signature_desc *desc, unsigned int i) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return &desc->u.v_1_0.parameters[i].u.constants; @@ -2705,7 +2706,8 @@ static const struct vkd3d_shader_root_constants *versioned_root_signature_get_ro return &desc->u.v_1_1.parameters[i].u.constants; }
-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_shader_versioned_root_signature_desc *desc) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return desc->u.v_1_0.static_sampler_count; @@ -2714,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( - const struct vkd3d_versioned_root_signature_desc *desc) + const struct vkd3d_shader_versioned_root_signature_desc *desc) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return desc->u.v_1_0.static_samplers; @@ -2722,7 +2724,7 @@ static const struct vkd3d_shader_static_sampler_desc *versioned_root_signature_g return desc->u.v_1_1.static_samplers; }
-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_shader_versioned_root_signature_desc *desc) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) return desc->u.v_1_0.flags; @@ -2914,7 +2916,7 @@ static int shader_write_root_descriptor1(struct root_signature_writer_context *c }
static int shader_write_root_parameters(struct root_signature_writer_context *context, - const struct vkd3d_versioned_root_signature_desc *desc) + const struct vkd3d_shader_versioned_root_signature_desc *desc) { unsigned int parameter_count = versioned_root_signature_get_parameter_count(desc); size_t parameters_position; @@ -2968,7 +2970,7 @@ static int shader_write_root_parameters(struct root_signature_writer_context *co }
static int shader_write_static_samplers(struct root_signature_writer_context *context, - const struct vkd3d_versioned_root_signature_desc *desc) + const struct vkd3d_shader_versioned_root_signature_desc *desc) { const struct vkd3d_shader_static_sampler_desc *samplers = versioned_root_signature_get_static_samplers(desc); unsigned int i; @@ -3007,7 +3009,7 @@ static int shader_write_static_samplers(struct root_signature_writer_context *co }
static int shader_write_root_signature(struct root_signature_writer_context *context, - const struct vkd3d_versioned_root_signature_desc *desc) + const struct vkd3d_shader_versioned_root_signature_desc *desc) { size_t samplers_offset_position; int ret; @@ -3108,7 +3110,7 @@ static int validate_descriptor_table_v_1_1(const struct vkd3d_shader_root_descri return VKD3D_OK; }
-static int validate_root_signature_desc(const struct vkd3d_versioned_root_signature_desc *desc) +static int validate_root_signature_desc(const struct vkd3d_shader_versioned_root_signature_desc *desc) { int ret = VKD3D_OK; unsigned int i; @@ -3133,7 +3135,7 @@ static int validate_root_signature_desc(const struct vkd3d_versioned_root_signat return ret; }
-int vkd3d_shader_serialize_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature, +int vkd3d_shader_serialize_root_signature(const struct vkd3d_shader_versioned_root_signature_desc *root_signature, struct vkd3d_shader_code *dxbc) { struct root_signature_writer_context context; @@ -3259,8 +3261,8 @@ fail: return ret; }
-static int convert_root_signature_to_v1_0(struct vkd3d_versioned_root_signature_desc *dst, - const struct vkd3d_versioned_root_signature_desc *src) +static int convert_root_signature_to_v1_0(struct vkd3d_shader_versioned_root_signature_desc *dst, + const struct vkd3d_shader_versioned_root_signature_desc *src) { const struct vkd3d_shader_root_signature_desc1 *src_desc = &src->u.v_1_1; struct vkd3d_shader_root_signature_desc *dst_desc = &dst->u.v_1_0; @@ -3380,8 +3382,8 @@ fail: return ret; }
-static int convert_root_signature_to_v1_1(struct vkd3d_versioned_root_signature_desc *dst, - const struct vkd3d_versioned_root_signature_desc *src) +static int convert_root_signature_to_v1_1(struct vkd3d_shader_versioned_root_signature_desc *dst, + const struct vkd3d_shader_versioned_root_signature_desc *src) { const struct vkd3d_shader_root_signature_desc *src_desc = &src->u.v_1_0; struct vkd3d_shader_root_signature_desc1 *dst_desc = &dst->u.v_1_1; @@ -3421,8 +3423,8 @@ fail: return ret; }
-int vkd3d_shader_convert_root_signature(struct vkd3d_versioned_root_signature_desc *dst, - enum vkd3d_shader_root_signature_version version, const struct vkd3d_versioned_root_signature_desc *src) +int vkd3d_shader_convert_root_signature(struct vkd3d_shader_versioned_root_signature_desc *dst, + enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src) { int ret;
diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index b40d2b4..30b4405 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -512,7 +512,7 @@ static void vkd3d_shader_free_root_signature_v_1_1(struct vkd3d_shader_root_sign memset(root_signature, 0, sizeof(*root_signature)); }
-void vkd3d_shader_free_root_signature(struct vkd3d_versioned_root_signature_desc *desc) +void vkd3d_shader_free_root_signature(struct vkd3d_shader_versioned_root_signature_desc *desc) { if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) { diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index e6803ca..f6a38c6 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -899,7 +899,7 @@ HRESULT d3d12_root_signature_create(struct d3d12_device *device, union { D3D12_VERSIONED_ROOT_SIGNATURE_DESC d3d12; - struct vkd3d_versioned_root_signature_desc vkd3d; + struct vkd3d_shader_versioned_root_signature_desc vkd3d; } root_signature_desc; struct d3d12_root_signature *object; HRESULT hr; diff --git a/libs/vkd3d/vkd3d_main.c b/libs/vkd3d/vkd3d_main.c index f9a6aa4..5d7c71e 100644 --- a/libs/vkd3d/vkd3d_main.c +++ b/libs/vkd3d/vkd3d_main.c @@ -88,7 +88,7 @@ struct d3d12_root_signature_deserializer union { D3D12_VERSIONED_ROOT_SIGNATURE_DESC d3d12; - struct vkd3d_versioned_root_signature_desc vkd3d; + struct vkd3d_shader_versioned_root_signature_desc vkd3d; } desc; };
@@ -169,9 +169,9 @@ static const struct ID3D12RootSignatureDeserializerVtbl d3d12_root_signature_des };
int vkd3d_parse_root_signature_v_1_0(const struct vkd3d_shader_code *dxbc, - struct vkd3d_versioned_root_signature_desc *out_desc) + struct vkd3d_shader_versioned_root_signature_desc *out_desc) { - struct vkd3d_versioned_root_signature_desc desc, converted_desc; + struct vkd3d_shader_versioned_root_signature_desc desc, converted_desc; int ret;
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &desc)) < 0) @@ -248,11 +248,11 @@ struct d3d12_versioned_root_signature_deserializer union { D3D12_VERSIONED_ROOT_SIGNATURE_DESC d3d12; - struct vkd3d_versioned_root_signature_desc vkd3d; + struct vkd3d_shader_versioned_root_signature_desc vkd3d; } desc, other_desc; };
-STATIC_ASSERT(sizeof(D3D12_VERSIONED_ROOT_SIGNATURE_DESC) == sizeof(struct vkd3d_versioned_root_signature_desc)); +STATIC_ASSERT(sizeof(D3D12_VERSIONED_ROOT_SIGNATURE_DESC) == sizeof(struct vkd3d_shader_versioned_root_signature_desc));
static struct d3d12_versioned_root_signature_deserializer *impl_from_ID3D12VersionedRootSignatureDeserializer( ID3D12VersionedRootSignatureDeserializer *iface) @@ -540,7 +540,7 @@ static HRESULT d3d_blob_create(void *buffer, SIZE_T size, struct d3d_blob **blob HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc, D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob) { - struct vkd3d_versioned_root_signature_desc vkd3d_desc; + struct vkd3d_shader_versioned_root_signature_desc vkd3d_desc; struct vkd3d_shader_code dxbc; struct d3d_blob *blob_object; HRESULT hr; @@ -588,7 +588,7 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc, HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *desc, ID3DBlob **blob, ID3DBlob **error_blob) { - const struct vkd3d_versioned_root_signature_desc *vkd3d_desc; + const struct vkd3d_shader_versioned_root_signature_desc *vkd3d_desc; struct vkd3d_shader_code dxbc; struct d3d_blob *blob_object; HRESULT hr; @@ -605,7 +605,7 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN if (error_blob) *error_blob = NULL;
- vkd3d_desc = (const struct vkd3d_versioned_root_signature_desc *)desc; + vkd3d_desc = (const struct vkd3d_shader_versioned_root_signature_desc *)desc; if ((ret = vkd3d_shader_serialize_root_signature(vkd3d_desc, &dxbc)) < 0) { WARN("Failed to serialize root signature, vkd3d result %d.\n", ret); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 1c36b24..9f0982d 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -735,7 +735,7 @@ HRESULT d3d12_root_signature_create(struct d3d12_device *device, const void *byt struct d3d12_root_signature *unsafe_impl_from_ID3D12RootSignature(ID3D12RootSignature *iface) DECLSPEC_HIDDEN;
int vkd3d_parse_root_signature_v_1_0(const struct vkd3d_shader_code *dxbc, - struct vkd3d_versioned_root_signature_desc *desc) DECLSPEC_HIDDEN; + struct vkd3d_shader_versioned_root_signature_desc *desc) DECLSPEC_HIDDEN;
struct d3d12_graphics_pipeline_state { diff --git a/tests/vkd3d_shader_api.c b/tests/vkd3d_shader_api.c index 569b0e9..161feb8 100644 --- a/tests/vkd3d_shader_api.c +++ b/tests/vkd3d_shader_api.c @@ -80,7 +80,7 @@ static void test_vkd3d_shader_pfns(void) PFN_vkd3d_shader_scan_dxbc pfn_vkd3d_shader_scan_dxbc; PFN_vkd3d_shader_compile pfn_vkd3d_shader_compile;
- struct vkd3d_versioned_root_signature_desc root_signature_desc; + struct vkd3d_shader_versioned_root_signature_desc root_signature_desc; struct vkd3d_shader_signature_element *element; struct vkd3d_shader_compile_info compile_info; struct vkd3d_shader_scan_info scan_info; @@ -88,7 +88,7 @@ static void test_vkd3d_shader_pfns(void) struct vkd3d_shader_code dxbc, spirv; int rc;
- static const struct vkd3d_versioned_root_signature_desc empty_rs_desc = + static const struct vkd3d_shader_versioned_root_signature_desc empty_rs_desc = { .version = VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0, };