dzn: Fixes compiling error when build with msys2/mingw

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>
This commit is contained in:
Yonggang Luo 2022-04-21 20:35:29 +08:00 committed by Marge Bot
parent 6f61b1e1da
commit 0445bfdc1b
10 changed files with 44 additions and 42 deletions

View file

@ -182,7 +182,7 @@ dzn_cmd_buffer_create(const VkCommandBufferAllocateInfo *info,
if (FAILED(ID3D12Device1_CreateCommandAllocator(device->dev, type,
&IID_ID3D12CommandAllocator,
&cmdbuf->cmdalloc))) {
(void **)&cmdbuf->cmdalloc))) {
result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
goto out;
}
@ -190,7 +190,7 @@ dzn_cmd_buffer_create(const VkCommandBufferAllocateInfo *info,
if (FAILED(ID3D12Device1_CreateCommandList(device->dev, 0, type,
cmdbuf->cmdalloc, NULL,
&IID_ID3D12GraphicsCommandList1,
&cmdbuf->cmdlist))) {
(void **)&cmdbuf->cmdlist))) {
result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
goto out;
}
@ -264,7 +264,7 @@ dzn_cmd_buffer_reset(struct dzn_cmd_buffer *cmdbuf)
type,
cmdbuf->cmdalloc, NULL,
&IID_ID3D12GraphicsCommandList1,
&cmdbuf->cmdlist))) {
(void **)&cmdbuf->cmdlist))) {
cmdbuf->error = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
}
@ -862,7 +862,7 @@ dzn_cmd_buffer_alloc_internal_buf(struct dzn_cmd_buffer *cmdbuf,
D3D12_HEAP_FLAG_NONE, &rdesc,
init_state, NULL,
&IID_ID3D12Resource,
&res);
(void **)&res);
if (FAILED(hres)) {
cmdbuf->error = vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
return cmdbuf->error;
@ -928,7 +928,7 @@ dzn_cmd_buffer_clear_rects_with_copy(struct dzn_cmd_buffer *cmdbuf,
assert(!(res_size % fill_step));
uint8_t *cpu_ptr;
ID3D12Resource_Map(src_res, 0, NULL, &cpu_ptr);
ID3D12Resource_Map(src_res, 0, NULL, (void **)&cpu_ptr);
for (uint32_t i = 0; i < res_size; i += fill_step)
memcpy(&cpu_ptr[i], buf, fill_step);
@ -1084,7 +1084,7 @@ dzn_cmd_buffer_clear_ranges_with_copy(struct dzn_cmd_buffer *cmdbuf,
assert(!(res_size % fill_step));
uint8_t *cpu_ptr;
ID3D12Resource_Map(src_res, 0, NULL, &cpu_ptr);
ID3D12Resource_Map(src_res, 0, NULL, (void **)&cpu_ptr);
for (uint32_t i = 0; i < res_size; i += fill_step)
memcpy(&cpu_ptr[i], buf, fill_step);
@ -3179,7 +3179,7 @@ dzn_CmdFillBuffer(VkCommandBuffer commandBuffer,
return;
uint32_t *cpu_ptr;
ID3D12Resource_Map(src_res, 0, NULL, &cpu_ptr);
ID3D12Resource_Map(src_res, 0, NULL, (void **)&cpu_ptr);
for (uint32_t i = 0; i < size / 4; i++)
cpu_ptr[i] = data;

View file

@ -789,7 +789,7 @@ dzn_descriptor_heap_init(struct dzn_descriptor_heap *heap,
if (FAILED(ID3D12Device1_CreateDescriptorHeap(device->dev, &desc,
&IID_ID3D12DescriptorHeap,
&heap->heap))) {
(void **)&heap->heap))) {
return vk_error(device,
shader_visible ?
VK_ERROR_OUT_OF_DEVICE_MEMORY : VK_ERROR_OUT_OF_HOST_MEMORY);

View file

@ -370,7 +370,7 @@ dzn_physical_device_cache_caps(struct dzn_physical_device *pdev)
ID3D12CommandQueue *cmdqueue;
ID3D12Device1_CreateCommandQueue(pdev->dev, &queue_desc,
&IID_ID3D12CommandQueue,
&cmdqueue);
(void **)&cmdqueue);
uint64_t ts_freq;
ID3D12CommandQueue_GetTimestampFrequency(cmdqueue, &ts_freq);
@ -1743,14 +1743,14 @@ dzn_queue_init(struct dzn_queue *queue,
if (FAILED(ID3D12Device1_CreateCommandQueue(device->dev, &queue_desc,
&IID_ID3D12CommandQueue,
&queue->cmdqueue))) {
(void **)&queue->cmdqueue))) {
dzn_queue_finish(queue);
return vk_error(device->vk.physical->instance, VK_ERROR_INITIALIZATION_FAILED);
}
if (FAILED(ID3D12Device1_CreateFence(device->dev, 0, D3D12_FENCE_FLAG_NONE,
&IID_ID3D12Fence,
&queue->fence))) {
(void **)&queue->fence))) {
dzn_queue_finish(queue);
return vk_error(device->vk.physical->instance, VK_ERROR_INITIALIZATION_FAILED);
}
@ -1830,11 +1830,11 @@ dzn_device_query_init(struct dzn_device *device)
D3D12_RESOURCE_STATE_GENERIC_READ,
NULL,
&IID_ID3D12Resource,
&device->queries.refs)))
(void **)&device->queries.refs)))
return vk_error(device->vk.physical, VK_ERROR_OUT_OF_DEVICE_MEMORY);
uint8_t *queries_ref;
if (FAILED(ID3D12Resource_Map(device->queries.refs, 0, NULL, &queries_ref)))
if (FAILED(ID3D12Resource_Map(device->queries.refs, 0, NULL, (void **)&queries_ref)))
return vk_error(device->vk.physical, VK_ERROR_OUT_OF_HOST_MEMORY);
memset(queries_ref + DZN_QUERY_REFS_ALL_ONES_OFFSET, 0xff, DZN_QUERY_REFS_SECTION_SIZE);
@ -1944,7 +1944,7 @@ dzn_device_create(struct dzn_physical_device *pdev,
ID3D12InfoQueue *info_queue;
if (SUCCEEDED(ID3D12Device1_QueryInterface(device->dev,
&IID_ID3D12InfoQueue,
&info_queue))) {
(void **)&info_queue))) {
D3D12_MESSAGE_SEVERITY severities[] = {
D3D12_MESSAGE_SEVERITY_INFO,
D3D12_MESSAGE_SEVERITY_WARNING,
@ -2021,7 +2021,7 @@ dzn_device_create_root_sig(struct dzn_device *device,
ID3D10Blob_GetBufferPointer(sig),
ID3D10Blob_GetBufferSize(sig),
&IID_ID3D12RootSignature,
&root_sig);
(void **)&root_sig);
out:
if (error)
@ -2161,7 +2161,7 @@ dzn_device_memory_create(struct dzn_device *device,
if (FAILED(ID3D12Device1_CreateHeap(device->dev, &heap_desc,
&IID_ID3D12Heap,
&mem->heap))) {
(void **)&mem->heap))) {
dzn_device_memory_destroy(mem, pAllocator);
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
}
@ -2184,7 +2184,7 @@ dzn_device_memory_create(struct dzn_device *device,
mem->initial_state,
NULL,
&IID_ID3D12Resource,
&mem->map_res);
(void **)&mem->map_res);
if (FAILED(hr)) {
dzn_device_memory_destroy(mem, pAllocator);
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
@ -2537,7 +2537,7 @@ dzn_BindBufferMemory2(VkDevice _device,
mem->initial_state,
NULL,
&IID_ID3D12Resource,
&buffer->res)))
(void **)&buffer->res)))
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
}
@ -2577,7 +2577,7 @@ dzn_event_create(struct dzn_device *device,
if (FAILED(ID3D12Device1_CreateFence(device->dev, 0, D3D12_FENCE_FLAG_NONE,
&IID_ID3D12Fence,
&event->fence))) {
(void **)&event->fence))) {
dzn_event_destroy(event, pAllocator);
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
}

View file

@ -636,7 +636,7 @@ dzn_BindImageMemory2(VkDevice dev,
mem->initial_state,
NULL,
&IID_ID3D12Resource,
&image->res)))
(void **)&image->res)))
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
did_bind = true;
}

View file

@ -212,7 +212,7 @@ dzn_meta_indirect_draw_init(struct dzn_device *device,
if (FAILED(ID3D12Device1_CreateComputePipelineState(device->dev, &desc,
&IID_ID3D12PipelineState,
&meta->pipeline_state)))
(void **)&meta->pipeline_state)))
ret = vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
out:
@ -349,7 +349,7 @@ dzn_meta_triangle_fan_rewrite_index_init(struct dzn_device *device,
if (FAILED(ID3D12Device1_CreateComputePipelineState(device->dev, &desc,
&IID_ID3D12PipelineState,
&meta->pipeline_state))) {
(void **)&meta->pipeline_state))) {
ret = vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
goto out;
}
@ -357,7 +357,7 @@ dzn_meta_triangle_fan_rewrite_index_init(struct dzn_device *device,
if (FAILED(ID3D12Device1_CreateCommandSignature(device->dev, &cmd_sig_desc,
meta->root_sig,
&IID_ID3D12CommandSignature,
&meta->cmd_sig)))
(void **)&meta->cmd_sig)))
ret = vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
out:
@ -630,7 +630,7 @@ dzn_meta_blit_create(struct dzn_device *device, const struct dzn_meta_blit_key *
if (FAILED(ID3D12Device1_CreateGraphicsPipelineState(device->dev, &desc,
&IID_ID3D12PipelineState,
&blit->pipeline_state))) {
(void **)&blit->pipeline_state))) {
dzn_meta_blit_destroy(device, blit);
return NULL;
}

View file

@ -950,7 +950,7 @@ dzn_graphics_pipeline_create(struct dzn_device *device,
hres = ID3D12Device1_CreateGraphicsPipelineState(device->dev, &desc,
&IID_ID3D12PipelineState,
&pipeline->base.state);
(void **)&pipeline->base.state);
if (FAILED(hres)) {
ret = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
goto out;
@ -1040,7 +1040,7 @@ dzn_graphics_pipeline_get_indirect_cmd_sig(struct dzn_graphics_pipeline *pipelin
ID3D12Device1_CreateCommandSignature(device->dev, &cmd_sig_desc,
pipeline->base.root.sig,
&IID_ID3D12CommandSignature,
&cmdsig);
(void **)&cmdsig);
if (FAILED(hres))
return NULL;
@ -1134,7 +1134,7 @@ dzn_compute_pipeline_create(struct dzn_device *device,
if (FAILED(ID3D12Device1_CreateComputePipelineState(device->dev, &desc,
&IID_ID3D12PipelineState,
&pipeline->base.state))) {
(void **)&pipeline->base.state))) {
ret = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
goto out;
}
@ -1182,7 +1182,7 @@ dzn_compute_pipeline_get_indirect_cmd_sig(struct dzn_compute_pipeline *pipeline)
ID3D12Device1_CreateCommandSignature(device->dev, &indirect_dispatch_desc,
pipeline->base.root.sig,
&IID_ID3D12CommandSignature,
&pipeline->indirect_cmd_sig);
(void **)&pipeline->indirect_cmd_sig);
if (FAILED(hres))
return NULL;

View file

@ -213,10 +213,10 @@ PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE
d3d12_get_serialize_root_sig(void);
void
d3d12_enable_debug_layer();
d3d12_enable_debug_layer(void);
void
d3d12_enable_gpu_validation();
d3d12_enable_gpu_validation(void);
ID3D12Device1 *
d3d12_create_device(IDXGIAdapter1 *adapter, bool experimental_features);

View file

@ -111,7 +111,7 @@ dzn_query_pool_create(struct dzn_device *device,
HRESULT hres =
ID3D12Device1_CreateQueryHeap(device->dev, &desc,
&IID_ID3D12QueryHeap,
&qpool->heap);
(void **)&qpool->heap);
if (FAILED(hres)) {
dzn_query_pool_destroy(qpool, alloc);
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
@ -151,7 +151,7 @@ dzn_query_pool_create(struct dzn_device *device,
D3D12_RESOURCE_STATE_COPY_DEST,
NULL,
&IID_ID3D12Resource,
&qpool->resolve_buffer);
(void **)&qpool->resolve_buffer);
if (FAILED(hres)) {
dzn_query_pool_destroy(qpool, alloc);
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
@ -166,13 +166,13 @@ dzn_query_pool_create(struct dzn_device *device,
D3D12_RESOURCE_STATE_COPY_DEST,
NULL,
&IID_ID3D12Resource,
&qpool->collect_buffer);
(void **)&qpool->collect_buffer);
if (FAILED(hres)) {
dzn_query_pool_destroy(qpool, alloc);
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
}
hres = ID3D12Resource_Map(qpool->collect_buffer, 0, NULL, &qpool->collect_map);
hres = ID3D12Resource_Map(qpool->collect_buffer, 0, NULL, (void **)&qpool->collect_map);
if (FAILED(hres)) {
dzn_query_pool_destroy(qpool, alloc);
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);

View file

@ -43,7 +43,7 @@ dzn_sync_init(struct vk_device *device,
if (FAILED(ID3D12Device1_CreateFence(ddev->dev, initial_value,
D3D12_FENCE_FLAG_NONE,
&IID_ID3D12Fence,
&dsync->fence)))
(void **)&dsync->fence)))
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
return VK_SUCCESS;
@ -110,7 +110,7 @@ dzn_sync_move(struct vk_device *device,
if (FAILED(ID3D12Device1_CreateFence(ddev->dev, 0,
D3D12_FENCE_FLAG_NONE,
&IID_ID3D12Fence,
&new_fence)))
(void **)&new_fence)))
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
ID3D12Fence_Release(ddst->fence);

View file

@ -21,6 +21,8 @@
* IN THE SOFTWARE.
*/
#include "dzn_private.h"
#define D3D12_IGNORE_SDK_LAYERS
#define COBJMACROS
#include <directx/d3d12.h>
@ -269,7 +271,7 @@ dxgi_get_factory(bool debug)
flags |= DXGI_CREATE_FACTORY_DEBUG;
IDXGIFactory4 *factory;
HRESULT hr = CreateDXGIFactory2(flags, &IID_IDXGIFactory4, &factory);
HRESULT hr = CreateDXGIFactory2(flags, &IID_IDXGIFactory4, (void **)&factory);
if (FAILED(hr)) {
mesa_loge("CreateDXGIFactory2 failed: %08x\n", hr);
return NULL;
@ -297,7 +299,7 @@ get_debug_interface()
}
ID3D12Debug *debug;
if (FAILED(D3D12GetDebugInterface(&IID_ID3D12Debug, &debug))) {
if (FAILED(D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug))) {
mesa_loge("D3D12GetDebugInterface failed\n");
return NULL;
}
@ -306,7 +308,7 @@ get_debug_interface()
}
void
d3d12_enable_debug_layer()
d3d12_enable_debug_layer(void)
{
ID3D12Debug *debug = get_debug_interface();
if (debug) {
@ -316,14 +318,14 @@ d3d12_enable_debug_layer()
}
void
d3d12_enable_gpu_validation()
d3d12_enable_gpu_validation(void)
{
ID3D12Debug *debug = get_debug_interface();
if (debug) {
ID3D12Debug3 *debug3;
if (SUCCEEDED(ID3D12Debug_QueryInterface(debug,
&IID_ID3D12Debug3,
&debug3))) {
(void **)&debug3))) {
ID3D12Debug3_SetEnableGPUBasedValidation(debug3, true);
ID3D12Debug3_Release(debug3);
}
@ -365,7 +367,7 @@ d3d12_create_device(IDXGIAdapter1 *adapter, bool experimental_features)
ID3D12Device1 *dev;
if (SUCCEEDED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0,
&IID_ID3D12Device1,
&dev)))
(void **)&dev)))
return dev;
mesa_loge("D3D12CreateDevice failed\n");