vkd3d-shader: Remove vkd3d_shader_serialize_root_signature().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-04-22 10:58:35 +02:00 committed by Alexandre Julliard
parent 534f30b30a
commit 21ab63c4d6
5 changed files with 20 additions and 44 deletions

View File

@ -572,9 +572,6 @@ void vkd3d_shader_free_versioned_root_signature(struct vkd3d_versioned_root_sign
void vkd3d_shader_free_root_signature(struct vkd3d_root_signature_desc *root_signature); void vkd3d_shader_free_root_signature(struct vkd3d_root_signature_desc *root_signature);
/* FIXME: Add support for returning error messages (ID3DBlob). */ /* FIXME: Add support for returning error messages (ID3DBlob). */
int vkd3d_shader_serialize_root_signature(const struct vkd3d_root_signature_desc *root_signature,
enum vkd3d_root_signature_version version, struct vkd3d_shader_code *dxbc);
int vkd3d_shader_serialize_versioned_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature, int vkd3d_shader_serialize_versioned_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature,
struct vkd3d_shader_code *dxbc); struct vkd3d_shader_code *dxbc);
@ -607,9 +604,6 @@ typedef int (*PFN_vkd3d_shader_parse_versioned_root_signature)(const struct vkd3
typedef void (*PFN_vkd3d_shader_free_versioned_root_signature)(struct vkd3d_versioned_root_signature_desc *root_signature); typedef void (*PFN_vkd3d_shader_free_versioned_root_signature)(struct vkd3d_versioned_root_signature_desc *root_signature);
typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_root_signature_desc *root_signature); typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_root_signature_desc *root_signature);
typedef int (*PFN_vkd3d_shader_serialize_root_signature)(const struct vkd3d_root_signature_desc *root_signature,
enum vkd3d_root_signature_version version, struct vkd3d_shader_code *dxbc);
typedef int (*PFN_vkd3d_shader_serialize_versioned_root_signature)( typedef int (*PFN_vkd3d_shader_serialize_versioned_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);

View File

@ -2886,7 +2886,7 @@ static int shader_write_root_signature(struct root_signature_writer_context *con
return shader_write_static_samplers(context, desc); return shader_write_static_samplers(context, desc);
} }
static int shader_serialize_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature, int vkd3d_shader_serialize_versioned_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature,
struct vkd3d_shader_code *dxbc) struct vkd3d_shader_code *dxbc)
{ {
struct root_signature_writer_context context; struct root_signature_writer_context context;
@ -2894,6 +2894,8 @@ static int shader_serialize_root_signature(const struct vkd3d_versioned_root_sig
uint32_t checksum[4]; uint32_t checksum[4];
int ret; int ret;
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_ROOT_SIGNATURE_VERSION_1_0
&& root_signature->version != VKD3D_ROOT_SIGNATURE_VERSION_1_1) && root_signature->version != VKD3D_ROOT_SIGNATURE_VERSION_1_1)
{ {
@ -2929,33 +2931,6 @@ static int shader_serialize_root_signature(const struct vkd3d_versioned_root_sig
return VKD3D_OK; return VKD3D_OK;
} }
int vkd3d_shader_serialize_root_signature(const struct vkd3d_root_signature_desc *root_signature,
enum vkd3d_root_signature_version version, struct vkd3d_shader_code *dxbc)
{
struct vkd3d_versioned_root_signature_desc versioned_root_signature;
TRACE("root_signature %p, version %#x, dxbc %p.\n", root_signature, version, dxbc);
if (version != VKD3D_ROOT_SIGNATURE_VERSION_1_0)
{
WARN("Unexpected Root signature version %#x.\n", version);
return VKD3D_ERROR_INVALID_ARGUMENT;
}
versioned_root_signature.version = VKD3D_ROOT_SIGNATURE_VERSION_1_0;
versioned_root_signature.u.v_1_0 = *root_signature;
return shader_serialize_root_signature(&versioned_root_signature, dxbc);
}
int vkd3d_shader_serialize_versioned_root_signature(const struct vkd3d_versioned_root_signature_desc *root_signature,
struct vkd3d_shader_code *dxbc)
{
TRACE("root_signature %p, dxbc %p.\n", root_signature, dxbc);
return shader_serialize_root_signature(root_signature, dxbc);
}
static void free_descriptor_ranges(const struct vkd3d_root_parameter *parameters, unsigned int count) static void free_descriptor_ranges(const struct vkd3d_root_parameter *parameters, unsigned int count)
{ {
unsigned int i; unsigned int i;

View File

@ -11,7 +11,6 @@ global:
vkd3d_shader_parse_input_signature; vkd3d_shader_parse_input_signature;
vkd3d_shader_parse_versioned_root_signature; vkd3d_shader_parse_versioned_root_signature;
vkd3d_shader_scan_dxbc; vkd3d_shader_scan_dxbc;
vkd3d_shader_serialize_root_signature;
vkd3d_shader_serialize_versioned_root_signature; vkd3d_shader_serialize_versioned_root_signature;
local: *; local: *;

View File

@ -538,8 +538,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, HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob) D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob)
{ {
const struct vkd3d_root_signature_desc *vkd3d_desc; struct vkd3d_versioned_root_signature_desc vkd3d_desc;
enum vkd3d_root_signature_version vkd3d_version;
struct vkd3d_shader_code dxbc; struct vkd3d_shader_code dxbc;
struct d3d_blob *blob_object; struct d3d_blob *blob_object;
HRESULT hr; HRESULT hr;
@ -547,6 +546,12 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
TRACE("desc %p, version %#x, blob %p, error_blob %p.\n", desc, version, blob, error_blob); TRACE("desc %p, version %#x, blob %p, error_blob %p.\n", desc, version, blob, error_blob);
if (version != D3D_ROOT_SIGNATURE_VERSION_1_0)
{
WARN("Unexpected Root signature version %#x.\n", version);
return E_INVALIDARG;
}
if (!blob) if (!blob)
{ {
WARN("Invalid blob parameter.\n"); WARN("Invalid blob parameter.\n");
@ -556,9 +561,9 @@ 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 = (const struct vkd3d_root_signature_desc *)desc; vkd3d_desc.version = VKD3D_ROOT_SIGNATURE_VERSION_1_0;
vkd3d_version = vkd3d_root_signature_version_from_d3d12(version); vkd3d_desc.u.v_1_0 = *(const struct vkd3d_root_signature_desc *)desc;
if ((ret = vkd3d_shader_serialize_root_signature(vkd3d_desc, vkd3d_version, &dxbc)) < 0) if ((ret = vkd3d_shader_serialize_versioned_root_signature(&vkd3d_desc, &dxbc)) < 0)
{ {
WARN("Failed to serialize root signature, vkd3d result %d.\n", ret); WARN("Failed to serialize root signature, vkd3d result %d.\n", ret);
if (error_blob) if (error_blob)

View File

@ -54,9 +54,9 @@ static void test_invalid_shaders(void)
static void test_vkd3d_shader_pfns(void) static void test_vkd3d_shader_pfns(void)
{ {
PFN_vkd3d_shader_serialize_versioned_root_signature pfn_vkd3d_shader_serialize_versioned_root_signature;
PFN_vkd3d_shader_parse_versioned_root_signature pfn_vkd3d_shader_parse_versioned_root_signature; PFN_vkd3d_shader_parse_versioned_root_signature pfn_vkd3d_shader_parse_versioned_root_signature;
PFN_vkd3d_shader_free_versioned_root_signature pfn_vkd3d_shader_free_versioned_root_signature; PFN_vkd3d_shader_free_versioned_root_signature pfn_vkd3d_shader_free_versioned_root_signature;
PFN_vkd3d_shader_serialize_root_signature pfn_vkd3d_shader_serialize_root_signature;
PFN_vkd3d_shader_find_signature_element pfn_vkd3d_shader_find_signature_element; PFN_vkd3d_shader_find_signature_element pfn_vkd3d_shader_find_signature_element;
PFN_vkd3d_shader_free_shader_signature pfn_vkd3d_shader_free_shader_signature; PFN_vkd3d_shader_free_shader_signature pfn_vkd3d_shader_free_shader_signature;
PFN_vkd3d_shader_parse_input_signature pfn_vkd3d_shader_parse_input_signature; PFN_vkd3d_shader_parse_input_signature pfn_vkd3d_shader_parse_input_signature;
@ -71,7 +71,10 @@ static void test_vkd3d_shader_pfns(void)
struct vkd3d_shader_code dxbc, spirv; struct vkd3d_shader_code dxbc, spirv;
int rc; int rc;
static const struct vkd3d_root_signature_desc empty_rs_desc; static const struct vkd3d_versioned_root_signature_desc empty_rs_desc =
{
.version = VKD3D_ROOT_SIGNATURE_VERSION_1_0,
};
static const DWORD vs_code[] = static const DWORD vs_code[] =
{ {
#if 0 #if 0
@ -90,9 +93,9 @@ static void test_vkd3d_shader_pfns(void)
}; };
static const struct vkd3d_shader_code vs = {vs_code, sizeof(vs_code)}; static const struct vkd3d_shader_code vs = {vs_code, sizeof(vs_code)};
pfn_vkd3d_shader_serialize_versioned_root_signature = vkd3d_shader_serialize_versioned_root_signature;
pfn_vkd3d_shader_parse_versioned_root_signature = vkd3d_shader_parse_versioned_root_signature; pfn_vkd3d_shader_parse_versioned_root_signature = vkd3d_shader_parse_versioned_root_signature;
pfn_vkd3d_shader_free_versioned_root_signature = vkd3d_shader_free_versioned_root_signature; pfn_vkd3d_shader_free_versioned_root_signature = vkd3d_shader_free_versioned_root_signature;
pfn_vkd3d_shader_serialize_root_signature = vkd3d_shader_serialize_root_signature;
pfn_vkd3d_shader_find_signature_element = vkd3d_shader_find_signature_element; pfn_vkd3d_shader_find_signature_element = vkd3d_shader_find_signature_element;
pfn_vkd3d_shader_free_shader_signature = vkd3d_shader_free_shader_signature; pfn_vkd3d_shader_free_shader_signature = vkd3d_shader_free_shader_signature;
pfn_vkd3d_shader_parse_input_signature = vkd3d_shader_parse_input_signature; pfn_vkd3d_shader_parse_input_signature = vkd3d_shader_parse_input_signature;
@ -100,7 +103,7 @@ static void test_vkd3d_shader_pfns(void)
pfn_vkd3d_shader_compile_dxbc = vkd3d_shader_compile_dxbc; pfn_vkd3d_shader_compile_dxbc = vkd3d_shader_compile_dxbc;
pfn_vkd3d_shader_scan_dxbc = vkd3d_shader_scan_dxbc; pfn_vkd3d_shader_scan_dxbc = vkd3d_shader_scan_dxbc;
rc = pfn_vkd3d_shader_serialize_root_signature(&empty_rs_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_0, &dxbc); rc = pfn_vkd3d_shader_serialize_versioned_root_signature(&empty_rs_desc, &dxbc);
ok(rc == VKD3D_OK, "Got unexpected error code %d.\n", rc); ok(rc == VKD3D_OK, "Got unexpected error code %d.\n", rc);
rc = pfn_vkd3d_shader_parse_versioned_root_signature(&dxbc, &root_signature_desc); rc = pfn_vkd3d_shader_parse_versioned_root_signature(&dxbc, &root_signature_desc);
ok(rc == VKD3D_OK, "Got unexpected error code %d.\n", rc); ok(rc == VKD3D_OK, "Got unexpected error code %d.\n", rc);