From f3b631f1dc8530da75e475e57e3c5e1ebdde7b9d Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Fri, 26 Aug 2022 09:46:33 -0700 Subject: [PATCH] dzn: Upgrade baseline from ID3D12Device2 to 4 This is pretty old already and we'll want to use CreateCommandList1 Part-of: --- src/microsoft/vulkan/dzn_abi_helper.h | 16 ++++++++-------- src/microsoft/vulkan/dzn_cmd_buffer.c | 6 +++--- src/microsoft/vulkan/dzn_device.c | 8 ++++---- src/microsoft/vulkan/dzn_image.c | 2 +- src/microsoft/vulkan/dzn_pipeline.c | 6 +++--- src/microsoft/vulkan/dzn_private.h | 8 ++++---- src/microsoft/vulkan/dzn_query.c | 4 ++-- src/microsoft/vulkan/dzn_util.c | 8 ++++---- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/microsoft/vulkan/dzn_abi_helper.h b/src/microsoft/vulkan/dzn_abi_helper.h index ece2b55046d..c97085f3485 100644 --- a/src/microsoft/vulkan/dzn_abi_helper.h +++ b/src/microsoft/vulkan/dzn_abi_helper.h @@ -35,29 +35,29 @@ #define DZN_ABI_HELPER_H static inline D3D12_HEAP_PROPERTIES -dzn_ID3D12Device2_GetCustomHeapProperties(ID3D12Device2 *dev, UINT node_mask, D3D12_HEAP_TYPE type) +dzn_ID3D12Device4_GetCustomHeapProperties(ID3D12Device4 *dev, UINT node_mask, D3D12_HEAP_TYPE type) { D3D12_HEAP_PROPERTIES ret; #ifdef _WIN32 - ID3D12Device2_GetCustomHeapProperties(dev, &ret, node_mask, type); + ID3D12Device4_GetCustomHeapProperties(dev, &ret, node_mask, type); #elif D3D12_SDK_VERSION >= 606 - ret = ID3D12Device2_GetCustomHeapProperties(dev, node_mask, type); + ret = ID3D12Device4_GetCustomHeapProperties(dev, node_mask, type); #else - ret = ((D3D12_HEAP_PROPERTIES (STDMETHODCALLTYPE *)(ID3D12Device2 *, UINT, D3D12_HEAP_TYPE))dev->lpVtbl->GetCustomHeapProperties)(dev, node_mask, type); + ret = ((D3D12_HEAP_PROPERTIES (STDMETHODCALLTYPE *)(ID3D12Device4 *, UINT, D3D12_HEAP_TYPE))dev->lpVtbl->GetCustomHeapProperties)(dev, node_mask, type); #endif return ret; } static inline D3D12_RESOURCE_ALLOCATION_INFO -dzn_ID3D12Device2_GetResourceAllocationInfo(ID3D12Device2 *dev, UINT visible_mask, UINT num_resource_descs, const D3D12_RESOURCE_DESC *resource_descs) +dzn_ID3D12Device4_GetResourceAllocationInfo(ID3D12Device4 *dev, UINT visible_mask, UINT num_resource_descs, const D3D12_RESOURCE_DESC *resource_descs) { D3D12_RESOURCE_ALLOCATION_INFO ret; #ifdef _WIN32 - ID3D12Device2_GetResourceAllocationInfo(dev, &ret, visible_mask, num_resource_descs, resource_descs); + ID3D12Device4_GetResourceAllocationInfo(dev, &ret, visible_mask, num_resource_descs, resource_descs); #elif D3D12_SDK_VERSION >= 606 - ret = ID3D12Device2_GetResourceAllocationInfo(dev, visible_mask, num_resource_descs, resource_descs); + ret = ID3D12Device4_GetResourceAllocationInfo(dev, visible_mask, num_resource_descs, resource_descs); #else - ret = ((D3D12_RESOURCE_ALLOCATION_INFO (STDMETHODCALLTYPE *)(ID3D12Device2 *, UINT, UINT, const D3D12_RESOURCE_DESC *)) + ret = ((D3D12_RESOURCE_ALLOCATION_INFO (STDMETHODCALLTYPE *)(ID3D12Device4 *, UINT, UINT, const D3D12_RESOURCE_DESC *)) dev->lpVtbl->GetResourceAllocationInfo)(dev, visible_mask, num_resource_descs, resource_descs); #endif return ret; diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index 4b29697096d..1e3d6e96332 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -1047,7 +1047,7 @@ dzn_cmd_buffer_alloc_internal_buf(struct dzn_cmd_buffer *cmdbuf, /* Align size on 64k (the default alignment) */ size = ALIGN_POT(size, 64 * 1024); - D3D12_HEAP_PROPERTIES hprops = dzn_ID3D12Device2_GetCustomHeapProperties(device->dev, 0, heap_type); + D3D12_HEAP_PROPERTIES hprops = dzn_ID3D12Device4_GetCustomHeapProperties(device->dev, 0, heap_type); D3D12_RESOURCE_DESC rdesc = { .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, .Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT, @@ -1725,7 +1725,7 @@ dzn_cmd_buffer_copy_img_chunk(struct dzn_cmd_buffer *cmdbuf, VK_FROM_HANDLE(dzn_image, src, info->srcImage); VK_FROM_HANDLE(dzn_image, dst, info->dstImage); - ID3D12Device2 *dev = device->dev; + ID3D12Device4 *dev = device->dev; ID3D12GraphicsCommandList1 *cmdlist = cmdbuf->cmdlist; VkImageCopy2 region = info->pRegions[r]; @@ -3087,7 +3087,7 @@ dzn_CmdCopyImage2(VkCommandBuffer commandBuffer, }; if (requires_temp_res) { - ID3D12Device2 *dev = device->dev; + ID3D12Device4 *dev = device->dev; VkImageAspectFlags aspect = 0; uint64_t max_size = 0; diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c index ddff2638b6d..66914c5f168 100644 --- a/src/microsoft/vulkan/dzn_device.c +++ b/src/microsoft/vulkan/dzn_device.c @@ -683,7 +683,7 @@ dzn_physical_device_get_max_array_layers() return dzn_physical_device_get_max_extent(false); } -static ID3D12Device2 * +static ID3D12Device4 * dzn_physical_device_get_d3d12_dev(struct dzn_physical_device *pdev) { struct dzn_instance *instance = container_of(pdev->vk.instance, struct dzn_instance, vk); @@ -735,7 +735,7 @@ dzn_physical_device_get_format_support(struct dzn_physical_device *pdev, .Format = dzn_image_get_dxgi_format(format, usage, aspects), }; - ID3D12Device2 *dev = dzn_physical_device_get_d3d12_dev(pdev); + ID3D12Device4 *dev = dzn_physical_device_get_d3d12_dev(pdev); ASSERTED HRESULT hres = ID3D12Device1_CheckFeatureSupport(dev, D3D12_FEATURE_FORMAT_SUPPORT, &dfmt_info, sizeof(dfmt_info)); @@ -933,7 +933,7 @@ dzn_physical_device_get_image_format_properties(struct dzn_physical_device *pdev return VK_ERROR_FORMAT_NOT_SUPPORTED; bool is_bgra4 = info->format == VK_FORMAT_B4G4R4A4_UNORM_PACK16; - ID3D12Device2 *dev = dzn_physical_device_get_d3d12_dev(pdev); + ID3D12Device4 *dev = dzn_physical_device_get_d3d12_dev(pdev); if ((info->type == VK_IMAGE_TYPE_1D && !(dfmt_info.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE1D)) || (info->type == VK_IMAGE_TYPE_2D && !(dfmt_info.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D)) || @@ -2050,7 +2050,7 @@ static VkResult dzn_device_query_init(struct dzn_device *device) { /* FIXME: create the resource in the default heap */ - D3D12_HEAP_PROPERTIES hprops = dzn_ID3D12Device2_GetCustomHeapProperties(device->dev, 0, D3D12_HEAP_TYPE_UPLOAD); + D3D12_HEAP_PROPERTIES hprops = dzn_ID3D12Device4_GetCustomHeapProperties(device->dev, 0, D3D12_HEAP_TYPE_UPLOAD); D3D12_RESOURCE_DESC rdesc = { .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, .Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT, diff --git a/src/microsoft/vulkan/dzn_image.c b/src/microsoft/vulkan/dzn_image.c index b356369024c..22797ae9f44 100644 --- a/src/microsoft/vulkan/dzn_image.c +++ b/src/microsoft/vulkan/dzn_image.c @@ -811,7 +811,7 @@ dzn_GetImageMemoryRequirements2(VkDevice _device, } } - D3D12_RESOURCE_ALLOCATION_INFO info = dzn_ID3D12Device2_GetResourceAllocationInfo(device->dev, 0, 1, &image->desc); + D3D12_RESOURCE_ALLOCATION_INFO info = dzn_ID3D12Device4_GetResourceAllocationInfo(device->dev, 0, 1, &image->desc); pMemoryRequirements->memoryRequirements = (VkMemoryRequirements) { .size = info.SizeInBytes, diff --git a/src/microsoft/vulkan/dzn_pipeline.c b/src/microsoft/vulkan/dzn_pipeline.c index ec5ba628f6b..d051f9541c4 100644 --- a/src/microsoft/vulkan/dzn_pipeline.c +++ b/src/microsoft/vulkan/dzn_pipeline.c @@ -1752,7 +1752,7 @@ dzn_graphics_pipeline_create(struct dzn_device *device, goto out; if (!pipeline->variants) { - hres = ID3D12Device2_CreatePipelineState(device->dev, stream_desc, + hres = ID3D12Device4_CreatePipelineState(device->dev, stream_desc, &IID_ID3D12PipelineState, (void **)&pipeline->base.state); if (FAILED(hres)) { @@ -1869,7 +1869,7 @@ dzn_graphics_pipeline_get_state(struct dzn_graphics_pipeline *pipeline, } } - ASSERTED HRESULT hres = ID3D12Device2_CreatePipelineState(device->dev, &stream_desc, + ASSERTED HRESULT hres = ID3D12Device4_CreatePipelineState(device->dev, &stream_desc, &IID_ID3D12PipelineState, (void**)(&variant->state)); assert(!FAILED(hres)); @@ -2195,7 +2195,7 @@ dzn_compute_pipeline_create(struct dzn_device *device, if (ret != VK_SUCCESS) goto out; - if (FAILED(ID3D12Device2_CreatePipelineState(device->dev, &stream_desc, + if (FAILED(ID3D12Device4_CreatePipelineState(device->dev, &stream_desc, &IID_ID3D12PipelineState, (void **)&pipeline->base.state))) ret = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); diff --git a/src/microsoft/vulkan/dzn_private.h b/src/microsoft/vulkan/dzn_private.h index 65f7aa403ed..4d08341bd95 100644 --- a/src/microsoft/vulkan/dzn_private.h +++ b/src/microsoft/vulkan/dzn_private.h @@ -200,7 +200,7 @@ struct dzn_physical_device { struct wsi_device wsi_device; mtx_t dev_lock; - ID3D12Device2 *dev; + ID3D12Device4 *dev; ID3D12Device10 *dev10; D3D_FEATURE_LEVEL feature_level; D3D_SHADER_MODEL shader_model; @@ -238,7 +238,7 @@ d3d12_enable_debug_layer(struct util_dl_library *d3d12_mod, ID3D12DeviceFactory void d3d12_enable_gpu_validation(struct util_dl_library *d3d12_mod, ID3D12DeviceFactory *factory); -ID3D12Device2 * +ID3D12Device4 * d3d12_create_device(struct util_dl_library *d3d12_mod, IUnknown *adapter, ID3D12DeviceFactory *factory, bool experimental_features); struct dzn_queue { @@ -254,7 +254,7 @@ struct dzn_device { struct vk_device_extension_table enabled_extensions; struct vk_device_dispatch_table cmd_dispatch; - ID3D12Device2 *dev; + ID3D12Device4 *dev; ID3D12Device10 *dev10; ID3D12DeviceConfiguration *dev_config; @@ -363,7 +363,7 @@ struct dzn_buffer_desc { #define MAX_DESCS_PER_CBV_SRV_UAV_HEAP 1000000u struct dzn_descriptor_heap { - ID3D12Device2 *dev; + ID3D12Device4 *dev; ID3D12DescriptorHeap *heap; D3D12_DESCRIPTOR_HEAP_TYPE type; SIZE_T cpu_base; diff --git a/src/microsoft/vulkan/dzn_query.c b/src/microsoft/vulkan/dzn_query.c index 9c08c186d1a..c3171710fe3 100644 --- a/src/microsoft/vulkan/dzn_query.c +++ b/src/microsoft/vulkan/dzn_query.c @@ -133,7 +133,7 @@ dzn_query_pool_create(struct dzn_device *device, } D3D12_HEAP_PROPERTIES hprops = - dzn_ID3D12Device2_GetCustomHeapProperties(device->dev, 0, D3D12_HEAP_TYPE_DEFAULT); + dzn_ID3D12Device4_GetCustomHeapProperties(device->dev, 0, D3D12_HEAP_TYPE_DEFAULT); D3D12_RESOURCE_DESC rdesc = { .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, .Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT, @@ -159,7 +159,7 @@ dzn_query_pool_create(struct dzn_device *device, return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY); } - hprops = dzn_ID3D12Device2_GetCustomHeapProperties(device->dev, 0, + hprops = dzn_ID3D12Device4_GetCustomHeapProperties(device->dev, 0, D3D12_HEAP_TYPE_READBACK); rdesc.Width = info->queryCount * (qpool->query_size + sizeof(uint64_t)); hres = ID3D12Device1_CreateCommittedResource(device->dev, &hprops, diff --git a/src/microsoft/vulkan/dzn_util.c b/src/microsoft/vulkan/dzn_util.c index c1be1cded8c..e8fe29ea9dd 100644 --- a/src/microsoft/vulkan/dzn_util.c +++ b/src/microsoft/vulkan/dzn_util.c @@ -350,7 +350,7 @@ d3d12_enable_gpu_validation(struct util_dl_library *d3d12_mod, ID3D12DeviceFacto } } -ID3D12Device2 * +ID3D12Device4 * d3d12_create_device(struct util_dl_library *d3d12_mod, IUnknown *adapter, ID3D12DeviceFactory *factory, bool experimental_features) { #ifdef _WIN32 @@ -373,12 +373,12 @@ d3d12_create_device(struct util_dl_library *d3d12_mod, IUnknown *adapter, ID3D12 } } - ID3D12Device2 *dev; + ID3D12Device4 *dev; if (factory) { ID3D12DeviceFactory_SetFlags(factory, D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE | D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_INCOMPATIBLE_EXISTING_DEVICE); if (FAILED(ID3D12DeviceFactory_CreateDevice(factory, adapter, D3D_FEATURE_LEVEL_11_0, - &IID_ID3D12Device2, + &IID_ID3D12Device4, (void **)&dev))) { mesa_loge("ID3D12DeviceFactory::CreateDevice failed\n"); return NULL; @@ -394,7 +394,7 @@ d3d12_create_device(struct util_dl_library *d3d12_mod, IUnknown *adapter, ID3D12 } if (FAILED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, - &IID_ID3D12Device2, + &IID_ID3D12Device4, (void **)&dev))) { mesa_loge("D3D12CreateDevice failed\n"); return NULL;