libs/vkd3d: Implement creating root signature from bytecode.

This commit is contained in:
Józef Kucia 2017-10-10 16:01:35 +02:00
parent 6b9c3b8971
commit 5b5cffcf84
3 changed files with 25 additions and 14 deletions

View File

@ -1273,14 +1273,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device *
if (node_mask && node_mask != 1)
FIXME("Ignoring node mask 0x%08x.\n", node_mask);
if (bytecode_length != ~(SIZE_T)0)
{
FIXME("Root signature byte code not supported.\n");
return E_NOTIMPL;
}
if (FAILED(hr = d3d12_root_signature_create(device,
(const D3D12_ROOT_SIGNATURE_DESC *)bytecode, &object)))
if (FAILED(hr = d3d12_root_signature_create(device, bytecode, bytecode_length, &object)))
return hr;
return return_interface((IUnknown *)&object->ID3D12RootSignature_iface,

View File

@ -1001,15 +1001,33 @@ fail:
}
HRESULT d3d12_root_signature_create(struct d3d12_device *device,
const D3D12_ROOT_SIGNATURE_DESC *desc, struct d3d12_root_signature **root_signature)
const void *bytecode, size_t bytecode_length, struct d3d12_root_signature **root_signature)
{
const struct vkd3d_shader_code dxbc = {bytecode, bytecode_length};
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
struct d3d12_root_signature *object;
HRESULT hr;
if (!(object = vkd3d_malloc(sizeof(*object))))
return E_OUTOFMEMORY;
if (bytecode_length == ~(SIZE_T)0)
{
root_signature_desc = *(const D3D12_ROOT_SIGNATURE_DESC *)bytecode;
}
else if (FAILED(hr = vkd3d_shader_parse_root_signature(&dxbc, &root_signature_desc)))
{
WARN("Failed to parse root signature, hr %#x.\n", hr);
return hr;
}
if (FAILED(hr = d3d12_root_signature_init(object, device, desc)))
if (!(object = vkd3d_malloc(sizeof(*object))))
{
vkd3d_shader_free_root_signature(&root_signature_desc);
return E_OUTOFMEMORY;
}
hr = d3d12_root_signature_init(object, device, &root_signature_desc);
if (bytecode_length != ~(SIZE_T)0)
vkd3d_shader_free_root_signature(&root_signature_desc);
if (FAILED(hr))
{
vkd3d_free(object);
return hr;

View File

@ -394,8 +394,8 @@ struct d3d12_root_signature
struct d3d12_device *device;
};
HRESULT d3d12_root_signature_create(struct d3d12_device *device,
const D3D12_ROOT_SIGNATURE_DESC *desc, struct d3d12_root_signature **root_signature) DECLSPEC_HIDDEN;
HRESULT d3d12_root_signature_create(struct d3d12_device *device, const void *bytecode,
size_t bytecode_length, struct d3d12_root_signature **root_signature) DECLSPEC_HIDDEN;
struct d3d12_root_signature *unsafe_impl_from_ID3D12RootSignature(ID3D12RootSignature *iface) DECLSPEC_HIDDEN;
struct d3d12_graphics_pipeline_state