diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index f12f7094..5173de7a 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -674,8 +674,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device * struct d3d12_root_signature *object; HRESULT hr; - FIXME("iface %p, node_mask 0x%08x, bytecode %p, bytecode_length %lu, " - "riid %s, root_signature %p stub!\n", + TRACE("iface %p, node_mask 0x%08x, bytecode %p, bytecode_length %lu, riid %s, root_signature %p.\n", iface, node_mask, bytecode, bytecode_length, debugstr_guid(riid), root_signature); if (node_mask && node_mask != 1) diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index f9c4707b..a908c1ee 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -69,6 +69,9 @@ static ULONG STDMETHODCALLTYPE d3d12_root_signature_Release(ID3D12RootSignature if (!refcount) { struct d3d12_device *device = root_signature->device; + const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + + VK_CALL(vkDestroyPipelineLayout(device->vk_device, root_signature->vk_pipeline_layout, NULL)); vkd3d_free(root_signature); @@ -134,25 +137,58 @@ static const struct ID3D12RootSignatureVtbl d3d12_root_signature_vtbl = d3d12_root_signature_GetDevice, }; -static void d3d12_root_signature_init(struct d3d12_root_signature *root_signature, +static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signature, struct d3d12_device *device, const D3D12_ROOT_SIGNATURE_DESC *desc) { + const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + VkPipelineLayoutCreateInfo pipeline_layout_info; + VkResult vr; + root_signature->ID3D12RootSignature_iface.lpVtbl = &d3d12_root_signature_vtbl; root_signature->refcount = 1; + if (desc->NumParameters) + FIXME("Non-empty root signatures not supported yet.\n"); + if (desc->NumStaticSamplers) + FIXME("Static samplers not implemented yet.\n"); + if (desc->Flags) + FIXME("Ignoring root signature flags %#x.\n", desc->Flags); + + pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; + pipeline_layout_info.pNext = NULL; + pipeline_layout_info.flags = 0; + pipeline_layout_info.setLayoutCount = 0; + pipeline_layout_info.pSetLayouts = NULL; + pipeline_layout_info.pushConstantRangeCount = 0; + pipeline_layout_info.pPushConstantRanges = NULL; + + if ((vr = VK_CALL(vkCreatePipelineLayout(device->vk_device, &pipeline_layout_info, NULL, + &root_signature->vk_pipeline_layout)))) + { + WARN("Failed to create Vulkan pipeline layout, vr %d.\n", vr); + return hresult_from_vk_result(vr); + } + root_signature->device = device; ID3D12Device_AddRef(&device->ID3D12Device_iface); + + return S_OK; } HRESULT d3d12_root_signature_create(struct d3d12_device *device, const D3D12_ROOT_SIGNATURE_DESC *desc, struct d3d12_root_signature **root_signature) { struct d3d12_root_signature *object; + HRESULT hr; if (!(object = vkd3d_malloc(sizeof(*object)))) return E_OUTOFMEMORY; - d3d12_root_signature_init(object, device, desc); + if (FAILED(hr = d3d12_root_signature_init(object, device, desc))) + { + vkd3d_free(object); + return hr; + } TRACE("Created root signature %p.\n", object); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 2d0b5e73..0e47ee78 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -76,6 +76,8 @@ struct d3d12_root_signature ID3D12RootSignature ID3D12RootSignature_iface; ULONG refcount; + VkPipelineLayout vk_pipeline_layout; + struct d3d12_device *device; };