Compare commits

...

7 Commits

Author SHA1 Message Date
Joshua Ashton d0f8e854d1 build: Remove -Wno-incompatible-pointer-types
No longer needed with recent changes.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 15:48:14 +01:00
Joshua Ashton a950a342e1 vkd3d-shader: Use uint32 for immediate constants
DWORD and uint32_t are different types on Windows.
Fixes warnings.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 15:47:52 +01:00
Joshua Ashton d2643bd7fa vkd3d-shader: Split read_dword into read_uint32
On Windows, DWORD is unsigned long, which means it's technically a different pointer type.

Let's keep type safety (as much as we can in C) and remove some warnings.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 02:25:59 +01:00
Joshua Ashton 18b2d2dc6e build: Remove -Wno-discarded-qualifiers
We don't need this since the CONST_VTBL change.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 02:03:20 +01:00
Joshua Ashton 0ab18ea09b vkd3d: Use CONST_VTBL instead of const for vtable decls
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 02:02:21 +01:00
Joshua Ashton c0fcec36af build: Remove -Wno-missing-braces
Hold over from autotools that isn't needed.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 01:47:18 +01:00
Joshua Ashton daf0c632fb vkd3d-shader: Fix incorrect assertion
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 01:44:18 +01:00
12 changed files with 79 additions and 76 deletions

View File

@ -1935,6 +1935,12 @@ static void read_dword(const char **ptr, DWORD *d)
*ptr += sizeof(*d);
}
static void read_uint32(const char **ptr, uint32_t *u)
{
memcpy(u, *ptr, sizeof(*u));
*ptr += sizeof(*u);
}
static void read_float(const char **ptr, float *f)
{
STATIC_ASSERT(sizeof(float) == sizeof(DWORD));
@ -2090,7 +2096,7 @@ static int shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
DWORD name_offset;
if (has_stream_index)
read_dword(&ptr, &e[i].stream_index);
read_uint32(&ptr, &e[i].stream_index);
else
e[i].stream_index = 0;
@ -2101,14 +2107,14 @@ static int shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
vkd3d_free(e);
return VKD3D_ERROR_INVALID_ARGUMENT;
}
read_dword(&ptr, &e[i].semantic_index);
read_dword(&ptr, &e[i].sysval_semantic);
read_dword(&ptr, &e[i].component_type);
read_dword(&ptr, &e[i].register_index);
read_dword(&ptr, &e[i].mask);
read_uint32(&ptr, &e[i].semantic_index);
read_uint32(&ptr, &e[i].sysval_semantic);
read_uint32(&ptr, &e[i].component_type);
read_uint32(&ptr, &e[i].register_index);
read_uint32(&ptr, &e[i].mask);
if (has_min_precision)
read_dword(&ptr, &e[i].min_precision);
read_uint32(&ptr, &e[i].min_precision);
else
e[i].min_precision = VKD3D_SHADER_MINIMUM_PRECISION_NONE;
@ -2295,11 +2301,11 @@ static int shader_parse_descriptor_ranges(struct root_signature_parser_context *
for (i = 0; i < count; ++i)
{
read_dword(&ptr, &ranges[i].range_type);
read_dword(&ptr, &ranges[i].descriptor_count);
read_dword(&ptr, &ranges[i].base_shader_register);
read_dword(&ptr, &ranges[i].register_space);
read_dword(&ptr, &ranges[i].descriptor_table_offset);
read_uint32(&ptr, &ranges[i].range_type);
read_uint32(&ptr, &ranges[i].descriptor_count);
read_uint32(&ptr, &ranges[i].base_shader_register);
read_uint32(&ptr, &ranges[i].register_space);
read_uint32(&ptr, &ranges[i].descriptor_table_offset);
TRACE("Type %#x, descriptor count %u, base shader register %u, "
"register space %u, offset %u.\n",
@ -2338,12 +2344,12 @@ static int shader_parse_descriptor_ranges1(struct root_signature_parser_context
for (i = 0; i < count; ++i)
{
read_dword(&ptr, &ranges[i].range_type);
read_dword(&ptr, &ranges[i].descriptor_count);
read_dword(&ptr, &ranges[i].base_shader_register);
read_dword(&ptr, &ranges[i].register_space);
read_dword(&ptr, &ranges[i].flags);
read_dword(&ptr, &ranges[i].descriptor_table_offset);
read_uint32(&ptr, &ranges[i].range_type);
read_uint32(&ptr, &ranges[i].descriptor_count);
read_uint32(&ptr, &ranges[i].base_shader_register);
read_uint32(&ptr, &ranges[i].register_space);
read_uint32(&ptr, &ranges[i].flags);
read_uint32(&ptr, &ranges[i].descriptor_table_offset);
TRACE("Type %#x, descriptor count %u, base shader register %u, "
"register space %u, flags %#x, offset %u.\n",
@ -2371,8 +2377,8 @@ static int shader_parse_descriptor_table(struct root_signature_parser_context *c
}
ptr = &context->data[offset];
read_dword(&ptr, &count);
read_dword(&ptr, &offset);
read_uint32(&ptr, &count);
read_uint32(&ptr, &offset);
TRACE("Descriptor range count %u.\n", count);
@ -2398,8 +2404,8 @@ static int shader_parse_descriptor_table1(struct root_signature_parser_context *
}
ptr = &context->data[offset];
read_dword(&ptr, &count);
read_dword(&ptr, &offset);
read_uint32(&ptr, &count);
read_uint32(&ptr, &offset);
TRACE("Descriptor range count %u.\n", count);
@ -2423,9 +2429,9 @@ static int shader_parse_root_constants(struct root_signature_parser_context *con
}
ptr = &context->data[offset];
read_dword(&ptr, &constants->shader_register);
read_dword(&ptr, &constants->register_space);
read_dword(&ptr, &constants->value_count);
read_uint32(&ptr, &constants->shader_register);
read_uint32(&ptr, &constants->register_space);
read_uint32(&ptr, &constants->value_count);
TRACE("Shader register %u, register space %u, 32-bit value count %u.\n",
constants->shader_register, constants->register_space, constants->value_count);
@ -2445,8 +2451,8 @@ static int shader_parse_root_descriptor(struct root_signature_parser_context *co
}
ptr = &context->data[offset];
read_dword(&ptr, &descriptor->shader_register);
read_dword(&ptr, &descriptor->register_space);
read_uint32(&ptr, &descriptor->shader_register);
read_uint32(&ptr, &descriptor->register_space);
TRACE("Shader register %u, register space %u.\n",
descriptor->shader_register, descriptor->register_space);
@ -2477,9 +2483,9 @@ static int shader_parse_root_descriptor1(struct root_signature_parser_context *c
}
ptr = &context->data[offset];
read_dword(&ptr, &descriptor->shader_register);
read_dword(&ptr, &descriptor->register_space);
read_dword(&ptr, &descriptor->flags);
read_uint32(&ptr, &descriptor->shader_register);
read_uint32(&ptr, &descriptor->register_space);
read_uint32(&ptr, &descriptor->flags);
TRACE("Shader register %u, register space %u, flags %#x.\n",
descriptor->shader_register, descriptor->register_space, descriptor->flags);
@ -2505,9 +2511,9 @@ static int shader_parse_root_parameters(struct root_signature_parser_context *co
for (i = 0; i < count; ++i)
{
read_dword(&ptr, &parameters[i].parameter_type);
read_dword(&ptr, &parameters[i].shader_visibility);
read_dword(&ptr, &offset);
read_uint32(&ptr, &parameters[i].parameter_type);
read_uint32(&ptr, &parameters[i].shader_visibility);
read_uint32(&ptr, &offset);
TRACE("Type %#x, shader visibility %#x.\n",
parameters[i].parameter_type, parameters[i].shader_visibility);
@ -2553,8 +2559,8 @@ static int shader_parse_root_parameters1(struct root_signature_parser_context *c
for (i = 0; i < count; ++i)
{
read_dword(&ptr, &parameters[i].parameter_type);
read_dword(&ptr, &parameters[i].shader_visibility);
read_uint32(&ptr, &parameters[i].parameter_type);
read_uint32(&ptr, &parameters[i].shader_visibility);
read_dword(&ptr, &offset);
TRACE("Type %#x, shader visibility %#x.\n",
@ -2600,19 +2606,19 @@ static int shader_parse_static_samplers(struct root_signature_parser_context *co
for (i = 0; i < count; ++i)
{
read_dword(&ptr, &sampler_descs[i].filter);
read_dword(&ptr, &sampler_descs[i].address_u);
read_dword(&ptr, &sampler_descs[i].address_v);
read_dword(&ptr, &sampler_descs[i].address_w);
read_uint32(&ptr, &sampler_descs[i].filter);
read_uint32(&ptr, &sampler_descs[i].address_u);
read_uint32(&ptr, &sampler_descs[i].address_v);
read_uint32(&ptr, &sampler_descs[i].address_w);
read_float(&ptr, &sampler_descs[i].mip_lod_bias);
read_dword(&ptr, &sampler_descs[i].max_anisotropy);
read_dword(&ptr, &sampler_descs[i].comparison_func);
read_dword(&ptr, &sampler_descs[i].border_color);
read_uint32(&ptr, &sampler_descs[i].max_anisotropy);
read_uint32(&ptr, &sampler_descs[i].comparison_func);
read_uint32(&ptr, &sampler_descs[i].border_color);
read_float(&ptr, &sampler_descs[i].min_lod);
read_float(&ptr, &sampler_descs[i].max_lod);
read_dword(&ptr, &sampler_descs[i].shader_register);
read_dword(&ptr, &sampler_descs[i].register_space);
read_dword(&ptr, &sampler_descs[i].shader_visibility);
read_uint32(&ptr, &sampler_descs[i].shader_register);
read_uint32(&ptr, &sampler_descs[i].register_space);
read_uint32(&ptr, &sampler_descs[i].shader_visibility);
}
return VKD3D_OK;
@ -2636,7 +2642,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
return VKD3D_ERROR_INVALID_ARGUMENT;
}
read_dword(&ptr, &version);
read_uint32(&ptr, &version);
TRACE("Version %#x.\n", version);
if (version != VKD3D_ROOT_SIGNATURE_VERSION_1_0 && version != VKD3D_ROOT_SIGNATURE_VERSION_1_1)
{
@ -2645,8 +2651,8 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
}
desc->version = version;
read_dword(&ptr, &count);
read_dword(&ptr, &offset);
read_uint32(&ptr, &count);
read_uint32(&ptr, &offset);
TRACE("Parameter count %u, offset %u.\n", count, offset);
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
@ -2680,8 +2686,8 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
}
}
read_dword(&ptr, &count);
read_dword(&ptr, &offset);
read_uint32(&ptr, &count);
read_uint32(&ptr, &offset);
TRACE("Static sampler count %u, offset %u.\n", count, offset);
v_1_0->static_sampler_count = count;
@ -2695,7 +2701,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
return ret;
}
read_dword(&ptr, &v_1_0->flags);
read_uint32(&ptr, &v_1_0->flags);
TRACE("Flags %#x.\n", v_1_0->flags);
return VKD3D_OK;

View File

@ -1431,7 +1431,7 @@ static uint32_t vkd3d_spirv_build_op_image_sample_dref(struct vkd3d_spirv_builde
if (op == SpvOpImageSampleDrefExplicitLod)
assert(image_operands_mask & (SpvImageOperandsLodMask | SpvImageOperandsGradMask));
else
assert(op == SpvOpImageSampleDrefImplicitLod || SpvOpImageSparseSampleDrefImplicitLod);
assert(op == SpvOpImageSampleDrefImplicitLod || op == SpvOpImageSparseSampleDrefImplicitLod);
return vkd3d_spirv_build_image_instruction(builder, op, result_type,
operands, ARRAY_SIZE(operands), image_operands_mask, image_operands, image_operand_count);

View File

@ -42,7 +42,7 @@ static void vkd3d_shader_dump_blob(const char *path, const char *prefix, const v
void vkd3d_shader_dump_shader(enum vkd3d_shader_type type, const struct vkd3d_shader_code *shader)
{
static int shader_id = 0;
static LONG shader_id = 0;
static bool enabled = true;
const char *path;
@ -61,7 +61,7 @@ void vkd3d_shader_dump_shader(enum vkd3d_shader_type type, const struct vkd3d_sh
void vkd3d_shader_dump_spirv_shader(enum vkd3d_shader_type type, const struct vkd3d_shader_code *shader)
{
static int shader_id = 0;
static LONG shader_id = 0;
static bool enabled = true;
const char *path;

View File

@ -559,7 +559,7 @@ struct vkd3d_shader_version
struct vkd3d_shader_immediate_constant_buffer
{
unsigned int vec4_count;
DWORD data[MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE];
uint32_t data[MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE];
};
struct vkd3d_shader_indexable_temp
@ -585,7 +585,7 @@ struct vkd3d_shader_register
enum vkd3d_immconst_type immconst_type;
union
{
DWORD immconst_uint[VKD3D_VEC4_SIZE];
uint32_t immconst_uint[VKD3D_VEC4_SIZE];
float immconst_float[VKD3D_VEC4_SIZE];
unsigned fp_body_idx;
};

View File

@ -963,7 +963,7 @@ static D3D12_FENCE_FLAGS STDMETHODCALLTYPE d3d12_fence_GetCreationFlags(d3d12_fe
return fence->d3d12_flags;
}
static const struct ID3D12Fence1Vtbl d3d12_fence_vtbl =
static CONST_VTBL struct ID3D12Fence1Vtbl d3d12_fence_vtbl =
{
/* IUnknown methods */
d3d12_fence_QueryInterface,
@ -1641,7 +1641,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_Reset(ID3D12CommandAllo
return S_OK;
}
static const struct ID3D12CommandAllocatorVtbl d3d12_command_allocator_vtbl =
static CONST_VTBL struct ID3D12CommandAllocatorVtbl d3d12_command_allocator_vtbl =
{
/* IUnknown methods */
d3d12_command_allocator_QueryInterface,
@ -6610,7 +6610,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetShadingRateImage(d3d12_com
FIXME("iface %p, image %p stub!\n", iface, image);
}
static const struct ID3D12GraphicsCommandList5Vtbl d3d12_command_list_vtbl =
static CONST_VTBL struct ID3D12GraphicsCommandList5Vtbl d3d12_command_list_vtbl =
{
/* IUnknown methods */
d3d12_command_list_QueryInterface,
@ -7254,7 +7254,7 @@ static D3D12_COMMAND_QUEUE_DESC * STDMETHODCALLTYPE d3d12_command_queue_GetDesc(
return desc;
}
static const struct ID3D12CommandQueueVtbl d3d12_command_queue_vtbl =
static CONST_VTBL struct ID3D12CommandQueueVtbl d3d12_command_queue_vtbl =
{
/* IUnknown methods */
d3d12_command_queue_QueryInterface,
@ -8033,7 +8033,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_signature_GetDevice(ID3D12Command
return d3d12_device_query_interface(signature->device, iid, device);
}
static const struct ID3D12CommandSignatureVtbl d3d12_command_signature_vtbl =
static CONST_VTBL struct ID3D12CommandSignatureVtbl d3d12_command_signature_vtbl =
{
/* IUnknown methods */
d3d12_command_signature_QueryInterface,

View File

@ -4083,7 +4083,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_SetBackgroundProcessingMode(d3d12_
return E_NOTIMPL;
}
static const struct ID3D12Device6Vtbl d3d12_device_vtbl =
static CONST_VTBL struct ID3D12Device6Vtbl d3d12_device_vtbl =
{
/* IUnknown methods */
d3d12_device_QueryInterface,

View File

@ -473,7 +473,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_GetProtectedResourceSession(d3d12_he
return E_NOTIMPL;
}
static const struct ID3D12Heap1Vtbl d3d12_heap_vtbl =
static CONST_VTBL struct ID3D12Heap1Vtbl d3d12_heap_vtbl =
{
/* IUnknown methods */
d3d12_heap_QueryInterface,
@ -1921,7 +1921,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_GetProtectedResourceSession(d3d1
return E_NOTIMPL;
}
static const struct ID3D12Resource1Vtbl d3d12_resource_vtbl =
static CONST_VTBL struct ID3D12Resource1Vtbl d3d12_resource_vtbl =
{
/* IUnknown methods */
d3d12_resource_QueryInterface,
@ -4501,7 +4501,7 @@ static D3D12_GPU_DESCRIPTOR_HANDLE * STDMETHODCALLTYPE d3d12_descriptor_heap_Get
return descriptor;
}
static const struct ID3D12DescriptorHeapVtbl d3d12_descriptor_heap_vtbl =
static CONST_VTBL struct ID3D12DescriptorHeapVtbl d3d12_descriptor_heap_vtbl =
{
/* IUnknown methods */
d3d12_descriptor_heap_QueryInterface,
@ -4942,7 +4942,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_query_heap_GetDevice(ID3D12QueryHeap *ifa
return d3d12_device_query_interface(heap->device, iid, device);
}
static const struct ID3D12QueryHeapVtbl d3d12_query_heap_vtbl =
static CONST_VTBL struct ID3D12QueryHeapVtbl d3d12_query_heap_vtbl =
{
/* IUnknown methods */
d3d12_query_heap_QueryInterface,

View File

@ -144,7 +144,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_root_signature_GetDevice(ID3D12RootSignat
return d3d12_device_query_interface(root_signature->device, iid, device);
}
static const struct ID3D12RootSignatureVtbl d3d12_root_signature_vtbl =
static CONST_VTBL struct ID3D12RootSignatureVtbl d3d12_root_signature_vtbl =
{
/* IUnknown methods */
d3d12_root_signature_QueryInterface,
@ -1494,7 +1494,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_pipeline_state_GetCachedBlob(ID3D12Pipeli
return S_OK;
}
static const struct ID3D12PipelineStateVtbl d3d12_pipeline_state_vtbl =
static CONST_VTBL struct ID3D12PipelineStateVtbl d3d12_pipeline_state_vtbl =
{
/* IUnknown methods */
d3d12_pipeline_state_QueryInterface,
@ -3345,7 +3345,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_pipeline_library_LoadPipeline(d3d12_pipel
return E_INVALIDARG;
}
static const struct ID3D12PipelineLibrary1Vtbl d3d12_pipeline_library_vtbl =
static CONST_VTBL struct ID3D12PipelineLibrary1Vtbl d3d12_pipeline_library_vtbl =
{
/* IUnknown methods */
d3d12_pipeline_library_QueryInterface,

View File

@ -1111,7 +1111,7 @@ static SIZE_T STDMETHODCALLTYPE d3d_blob_GetBufferSize(ID3DBlob *iface)
return blob->size;
}
static const struct ID3D10BlobVtbl d3d_blob_vtbl =
static CONST_VTBL struct ID3D10BlobVtbl d3d_blob_vtbl =
{
/* IUnknown methods */
d3d_blob_QueryInterface,

View File

@ -156,7 +156,7 @@ static const D3D12_ROOT_SIGNATURE_DESC * STDMETHODCALLTYPE d3d12_root_signature_
return &deserializer->desc.d3d12.Desc_1_0;
}
static const struct ID3D12RootSignatureDeserializerVtbl d3d12_root_signature_deserializer_vtbl =
static CONST_VTBL struct ID3D12RootSignatureDeserializerVtbl d3d12_root_signature_deserializer_vtbl =
{
/* IUnknown methods */
d3d12_root_signature_deserializer_QueryInterface,
@ -367,7 +367,7 @@ d3d12_versioned_root_signature_deserializer_GetUnconvertedRootSignatureDesc(ID3D
return &deserializer->desc.d3d12;
}
static const struct ID3D12VersionedRootSignatureDeserializerVtbl d3d12_versioned_root_signature_deserializer_vtbl =
static CONST_VTBL struct ID3D12VersionedRootSignatureDeserializerVtbl d3d12_versioned_root_signature_deserializer_vtbl =
{
/* IUnknown methods */
d3d12_versioned_root_signature_deserializer_QueryInterface,

View File

@ -45,9 +45,6 @@ endif
add_project_arguments(vkd3d_compiler.get_supported_arguments([
'-Wno-format',
'-Wno-discarded-qualifiers',
'-Wno-incompatible-pointer-types',
'-Wno-missing-braces',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter']),
language : 'c')

View File

@ -629,7 +629,7 @@ static ULONG STDMETHODCALLTYPE parent_Release(IUnknown *iface)
return InterlockedDecrement(&parent->refcount);
}
static const struct IUnknownVtbl parent_vtbl =
static CONST_VTBL struct IUnknownVtbl parent_vtbl =
{
parent_QueryInterface,
parent_AddRef,