From af2e212c598d41d2dd6b1da85537c822198edd82 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Tue, 8 Dec 2020 10:14:47 -0800 Subject: [PATCH] d3d12: Use IID_PPV_ARGS instead of __uuidof We've been inconsistent between IID_PPV_ARGS, __uuidof(var), and __uuidof(type). Since Linux doesn't support the latter of these, they need to be changed. While we're at it, switch all __uuidof to the more terse IIV_PPV_ARGS option. Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/d3d12/d3d12_batch.cpp | 6 ++---- src/gallium/drivers/d3d12/d3d12_bufmgr.cpp | 3 +-- src/gallium/drivers/d3d12/d3d12_context.cpp | 3 +-- .../drivers/d3d12/d3d12_descriptor_pool.cpp | 3 +-- src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp | 6 ++---- .../drivers/d3d12/d3d12_pipeline_state.cpp | 3 +-- src/gallium/drivers/d3d12/d3d12_query.cpp | 3 +-- src/gallium/drivers/d3d12/d3d12_resource.cpp | 3 +-- .../drivers/d3d12/d3d12_root_signature.cpp | 3 +-- src/gallium/drivers/d3d12/d3d12_screen.cpp | 15 ++++++--------- 10 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/gallium/drivers/d3d12/d3d12_batch.cpp b/src/gallium/drivers/d3d12/d3d12_batch.cpp index a9fd84c4980..d9bd3187337 100644 --- a/src/gallium/drivers/d3d12/d3d12_batch.cpp +++ b/src/gallium/drivers/d3d12/d3d12_batch.cpp @@ -56,8 +56,7 @@ d3d12_init_batch(struct d3d12_context *ctx, struct d3d12_batch *batch) util_dynarray_init(&batch->zombie_samplers, NULL); if (FAILED(screen->dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, - __uuidof(batch->cmdalloc), - (void **)&batch->cmdalloc))) + IID_PPV_ARGS(&batch->cmdalloc)))) return false; @@ -173,8 +172,7 @@ d3d12_start_batch(struct d3d12_context *ctx, struct d3d12_batch *batch) } else { if (FAILED(screen->dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, batch->cmdalloc, NULL, - __uuidof(ctx->cmdlist), - (void **)&ctx->cmdlist))) { + IID_PPV_ARGS(&ctx->cmdlist)))) { debug_printf("D3D12: creating ID3D12GraphicsCommandList failed\n"); batch->has_errors = true; return; diff --git a/src/gallium/drivers/d3d12/d3d12_bufmgr.cpp b/src/gallium/drivers/d3d12/d3d12_bufmgr.cpp index aea12c90332..825bbf1116a 100644 --- a/src/gallium/drivers/d3d12/d3d12_bufmgr.cpp +++ b/src/gallium/drivers/d3d12/d3d12_bufmgr.cpp @@ -111,8 +111,7 @@ d3d12_bo_new(ID3D12Device *dev, uint64_t size, uint64_t alignment) &res_desc, D3D12_RESOURCE_STATE_COMMON, NULL, - __uuidof(ID3D12Resource), - (void **)&res); + IID_PPV_ARGS(&res)); if (FAILED(hres)) return NULL; diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp index 4679c6c5bf8..022df3605f2 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context.cpp @@ -1945,8 +1945,7 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)GetProcAddress(hD3D12Mod, "D3D12SerializeVersionedRootSignature"); if (FAILED(screen->dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, - __uuidof(ctx->cmdqueue_fence), - (void **)&ctx->cmdqueue_fence))) { + IID_PPV_ARGS(&ctx->cmdqueue_fence)))) { FREE(ctx); return NULL; } diff --git a/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp b/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp index b529a55be4b..9ba394b994a 100644 --- a/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp +++ b/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp @@ -69,8 +69,7 @@ d3d12_descriptor_heap_new(ID3D12Device *dev, heap->desc.Type = type; heap->desc.Flags = flags; if (FAILED(dev->CreateDescriptorHeap(&heap->desc, - __uuidof(heap->heap), - (void **)&heap->heap))) { + IID_PPV_ARGS(&heap->heap)))) { FREE(heap); return NULL; } diff --git a/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp b/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp index f0abd401aef..9967fa10c5e 100644 --- a/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp @@ -68,16 +68,14 @@ choose_dxgi_adapter(IDXGIFactory4 *factory, LUID *adapter) IDXGIAdapter1 *ret; if (adapter) { if (SUCCEEDED(factory->EnumAdapterByLuid(*adapter, - __uuidof(IDXGIAdapter1), - (void**)&ret))) + IID_PPV_ARGS(&ret)))) return ret; debug_printf("D3D12: requested adapter missing, falling back to auto-detection...\n"); } bool want_warp = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false); if (want_warp) { - if (SUCCEEDED(factory->EnumWarpAdapter(__uuidof(IDXGIAdapter1), - (void**)&ret))) + if (SUCCEEDED(factory->EnumWarpAdapter(IID_PPV_ARGS(&ret)))) return ret; debug_printf("D3D12: failed to enum warp adapter\n"); return NULL; diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp index 46cb03484a4..abea496023f 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp @@ -279,8 +279,7 @@ create_gfx_pipeline_state(struct d3d12_context *ctx) ID3D12PipelineState *ret; if (FAILED(screen->dev->CreateGraphicsPipelineState(&pso_desc, - __uuidof(ret), - (void **)&ret))) { + IID_PPV_ARGS(&ret)))) { debug_printf("D3D12: CreateGraphicsPipelineState failed!\n"); return NULL; } diff --git a/src/gallium/drivers/d3d12/d3d12_query.cpp b/src/gallium/drivers/d3d12/d3d12_query.cpp index f97affdf4b7..c1f10679049 100644 --- a/src/gallium/drivers/d3d12/d3d12_query.cpp +++ b/src/gallium/drivers/d3d12/d3d12_query.cpp @@ -138,8 +138,7 @@ d3d12_create_query(struct pipe_context *pctx, desc.Count = query->num_queries; desc.Type = d3d12_query_heap_type(query_type); if (FAILED(screen->dev->CreateQueryHeap(&desc, - __uuidof(query->query_heap), - (void **)&query->query_heap))) { + IID_PPV_ARGS(&query->query_heap)))) { FREE(query); return NULL; } diff --git a/src/gallium/drivers/d3d12/d3d12_resource.cpp b/src/gallium/drivers/d3d12/d3d12_resource.cpp index b679c175ebc..660328ad7b9 100644 --- a/src/gallium/drivers/d3d12/d3d12_resource.cpp +++ b/src/gallium/drivers/d3d12/d3d12_resource.cpp @@ -217,8 +217,7 @@ init_texture(struct d3d12_screen *screen, &desc, D3D12_RESOURCE_STATE_COMMON, NULL, - __uuidof(ID3D12Resource), - (void **)&d3d12_res); + IID_PPV_ARGS(&d3d12_res)); if (FAILED(hres)) return false; diff --git a/src/gallium/drivers/d3d12/d3d12_root_signature.cpp b/src/gallium/drivers/d3d12/d3d12_root_signature.cpp index f05221ebf0a..eb369c86cb6 100644 --- a/src/gallium/drivers/d3d12/d3d12_root_signature.cpp +++ b/src/gallium/drivers/d3d12/d3d12_root_signature.cpp @@ -169,8 +169,7 @@ create_root_signature(struct d3d12_context *ctx, struct d3d12_root_signature_key if (FAILED(screen->dev->CreateRootSignature(0, sig->GetBufferPointer(), sig->GetBufferSize(), - __uuidof(ret), - (void **)&ret))) { + IID_PPV_ARGS(&ret)))) { debug_printf("CreateRootSignature failed\n"); return NULL; } diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp index d3c423597c9..f23cff1db07 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp @@ -633,8 +633,7 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen, } ID3D12SharingContract *sharing_contract; - if (SUCCEEDED(screen->cmdqueue->QueryInterface(__uuidof(sharing_contract), - (void **)&sharing_contract))) + if (SUCCEEDED(screen->cmdqueue->QueryInterface(IID_PPV_ARGS(&sharing_contract)))) sharing_contract->Present(d3d12_res, 0, WindowFromDC((HDC)winsys_drawable_handle)); winsys->displaytarget_display(winsys, res->dt, winsys_drawable_handle, sub_box); @@ -659,7 +658,7 @@ get_debug_interface() } ID3D12Debug *debug; - if (FAILED(D3D12GetDebugInterface(__uuidof(ID3D12Debug), (void **)&debug))) { + if (FAILED(D3D12GetDebugInterface(IID_PPV_ARGS(&debug)))) { debug_printf("D3D12: D3D12GetDebugInterface failed\n"); return NULL; } @@ -681,7 +680,7 @@ enable_gpu_validation() ID3D12Debug *debug = get_debug_interface(); ID3D12Debug3 *debug3; if (debug && - SUCCEEDED(debug->QueryInterface(__uuidof(debug), (void **)&debug3))) + SUCCEEDED(debug->QueryInterface(IID_PPV_ARGS(&debug3)))) debug3->SetEnableGPUBasedValidation(true); } @@ -712,7 +711,7 @@ create_device(IUnknown *adapter) ID3D12Device *dev; if (SUCCEEDED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, - __uuidof(ID3D12Device), (void **)&dev))) + IID_PPV_ARGS(&dev)))) return dev; debug_printf("D3D12: D3D12CreateDevice failed\n"); @@ -764,8 +763,7 @@ d3d12_init_screen(struct d3d12_screen *screen, struct sw_winsys *winsys, IUnknow } ID3D12InfoQueue *info_queue; - if (SUCCEEDED(screen->dev->QueryInterface(__uuidof(info_queue), - (void **)&info_queue))) { + if (SUCCEEDED(screen->dev->QueryInterface(IID_PPV_ARGS(&info_queue)))) { D3D12_MESSAGE_SEVERITY severities[] = { D3D12_MESSAGE_SEVERITY_INFO, D3D12_MESSAGE_SEVERITY_WARNING, @@ -840,8 +838,7 @@ d3d12_init_screen(struct d3d12_screen *screen, struct sw_winsys *winsys, IUnknow queue_desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; queue_desc.NodeMask = 0; if (FAILED(screen->dev->CreateCommandQueue(&queue_desc, - __uuidof(screen->cmdqueue), - (void **)&screen->cmdqueue))) + IID_PPV_ARGS(&screen->cmdqueue)))) goto failed; UINT64 timestamp_freq;