vkd3d: Handle default global root signature in RTPSO.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
b8b2a93aa6
commit
22778b99be
|
@ -1073,6 +1073,7 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
|
||||||
struct vkd3d_shader_interface_local_info shader_interface_local_info;
|
struct vkd3d_shader_interface_local_info shader_interface_local_info;
|
||||||
VkRayTracingPipelineInterfaceCreateInfoKHR interface_create_info;
|
VkRayTracingPipelineInterfaceCreateInfoKHR interface_create_info;
|
||||||
VkDescriptorSetLayoutBinding *local_static_sampler_bindings;
|
VkDescriptorSetLayoutBinding *local_static_sampler_bindings;
|
||||||
|
struct d3d12_root_signature *default_global_root_signature;
|
||||||
struct vkd3d_shader_interface_info shader_interface_info;
|
struct vkd3d_shader_interface_info shader_interface_info;
|
||||||
VkRayTracingPipelineCreateInfoKHR pipeline_create_info;
|
VkRayTracingPipelineCreateInfoKHR pipeline_create_info;
|
||||||
struct vkd3d_shader_resource_binding *local_bindings;
|
struct vkd3d_shader_resource_binding *local_bindings;
|
||||||
|
@ -1129,6 +1130,19 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
|
||||||
shader_interface_info.descriptor_qa_global_binding = &global_signature->descriptor_qa_global_info;
|
shader_interface_info.descriptor_qa_global_binding = &global_signature->descriptor_qa_global_info;
|
||||||
shader_interface_info.descriptor_qa_heap_binding = &global_signature->descriptor_qa_heap_binding;
|
shader_interface_info.descriptor_qa_heap_binding = &global_signature->descriptor_qa_heap_binding;
|
||||||
#endif
|
#endif
|
||||||
|
d3d12_root_signature_inc_ref(object->global_root_signature = global_signature);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We have to create a dummy root signature in this scenario.
|
||||||
|
* Add a special entry point for this since otherwise we have to serialize root signatures
|
||||||
|
* to dummy blobs and stuff which is only defined in d3d12.dll and the outer modules that
|
||||||
|
* we shouldn't have access to. */
|
||||||
|
if (FAILED(hr = d3d12_root_signature_create_empty(object->device, &default_global_root_signature)))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
global_signature = default_global_root_signature;
|
||||||
|
d3d12_root_signature_inc_ref(object->global_root_signature = global_signature);
|
||||||
|
ID3D12RootSignature_Release(&default_global_root_signature->ID3D12RootSignature_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_interface_local_info.descriptor_size = VKD3D_RESOURCE_DESC_INCREMENT;
|
shader_interface_local_info.descriptor_size = VKD3D_RESOURCE_DESC_INCREMENT;
|
||||||
|
@ -1439,13 +1453,6 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
|
||||||
(object->flags & D3D12_STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS)) ?
|
(object->flags & D3D12_STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS)) ?
|
||||||
VK_PIPELINE_CREATE_LIBRARY_BIT_KHR : 0;
|
VK_PIPELINE_CREATE_LIBRARY_BIT_KHR : 0;
|
||||||
|
|
||||||
/* FIXME: What if we have no global root signature? */
|
|
||||||
if (!global_signature)
|
|
||||||
{
|
|
||||||
FIXME("No global root signature was found. Is this allowed?\n");
|
|
||||||
return E_INVALIDARG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: What happens here if we have local static samplers with COLLECTIONS? :| */
|
/* TODO: What happens here if we have local static samplers with COLLECTIONS? :| */
|
||||||
if (object->local_static_sampler.pipeline_layout)
|
if (object->local_static_sampler.pipeline_layout)
|
||||||
pipeline_create_info.layout = object->local_static_sampler.pipeline_layout;
|
pipeline_create_info.layout = object->local_static_sampler.pipeline_layout;
|
||||||
|
@ -1540,8 +1547,6 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
|
||||||
data->exports_size = 0;
|
data->exports_size = 0;
|
||||||
data->exports_count = 0;
|
data->exports_count = 0;
|
||||||
|
|
||||||
d3d12_root_signature_inc_ref(object->global_root_signature = global_signature);
|
|
||||||
|
|
||||||
object->shader_config = *data->shader_config;
|
object->shader_config = *data->shader_config;
|
||||||
object->pipeline_config = data->pipeline_config;
|
object->pipeline_config = data->pipeline_config;
|
||||||
|
|
||||||
|
|
|
@ -1473,6 +1473,33 @@ fail:
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT d3d12_root_signature_create_empty(struct d3d12_device *device,
|
||||||
|
struct d3d12_root_signature **root_signature)
|
||||||
|
{
|
||||||
|
struct d3d12_root_signature *object;
|
||||||
|
D3D12_ROOT_SIGNATURE_DESC1 desc;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (!(object = vkd3d_malloc(sizeof(*object))))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
memset(&desc, 0, sizeof(desc));
|
||||||
|
hr = d3d12_root_signature_init(object, device, &desc);
|
||||||
|
|
||||||
|
/* For pipeline libraries, (and later DXR to some degree), we need a way to
|
||||||
|
* compare root signature objects. */
|
||||||
|
object->compatibility_hash = 0;
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
vkd3d_free(object);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
*root_signature = object;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT d3d12_root_signature_create(struct d3d12_device *device,
|
HRESULT d3d12_root_signature_create(struct d3d12_device *device,
|
||||||
const void *bytecode, size_t bytecode_length, struct d3d12_root_signature **root_signature)
|
const void *bytecode, size_t bytecode_length, struct d3d12_root_signature **root_signature)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1403,6 +1403,8 @@ struct d3d12_root_signature
|
||||||
|
|
||||||
HRESULT d3d12_root_signature_create(struct d3d12_device *device, const void *bytecode,
|
HRESULT d3d12_root_signature_create(struct d3d12_device *device, const void *bytecode,
|
||||||
size_t bytecode_length, struct d3d12_root_signature **root_signature);
|
size_t bytecode_length, struct d3d12_root_signature **root_signature);
|
||||||
|
HRESULT d3d12_root_signature_create_empty(struct d3d12_device *device,
|
||||||
|
struct d3d12_root_signature **root_signature);
|
||||||
/* Private ref counts, for pipeline library. */
|
/* Private ref counts, for pipeline library. */
|
||||||
void d3d12_root_signature_inc_ref(struct d3d12_root_signature *state);
|
void d3d12_root_signature_inc_ref(struct d3d12_root_signature *state);
|
||||||
void d3d12_root_signature_dec_ref(struct d3d12_root_signature *state);
|
void d3d12_root_signature_dec_ref(struct d3d12_root_signature *state);
|
||||||
|
|
Loading…
Reference in New Issue