diff --git a/demos/demo.h b/demos/demo.h index ab1e28f0..dc36d102 100644 --- a/demos/demo.h +++ b/demos/demo.h @@ -123,6 +123,21 @@ static inline void demo_blend_desc_init_default(D3D12_BLEND_DESC *desc) } } +static inline HRESULT demo_create_root_signature(ID3D12Device *device, + const D3D12_ROOT_SIGNATURE_DESC *desc, ID3D12RootSignature **signature) +{ + ID3DBlob *blob; + HRESULT hr; + + if (FAILED(hr = D3D12SerializeRootSignature(desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, NULL))) + return hr; + hr = ID3D12Device_CreateRootSignature(device, 0, ID3D10Blob_GetBufferPointer(blob), + ID3D10Blob_GetBufferSize(blob), &IID_ID3D12RootSignature, (void **)signature); + ID3D10Blob_Release(blob); + + return hr; +} + #ifdef _WIN32 #include "demo_win32.h" #else diff --git a/demos/demo_win32.h b/demos/demo_win32.h index 3cdce889..addcc953 100644 --- a/demos/demo_win32.h +++ b/demos/demo_win32.h @@ -325,18 +325,3 @@ static inline void demo_destroy_event(HANDLE event) { CloseHandle(event); } - -static inline HRESULT demo_create_root_signature(ID3D12Device *device, - const D3D12_ROOT_SIGNATURE_DESC *desc, ID3D12RootSignature **signature) -{ - ID3DBlob *blob; - HRESULT hr; - - if (FAILED(hr = D3D12SerializeRootSignature(desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, NULL))) - return hr; - hr = ID3D12Device_CreateRootSignature(device, 0, ID3D10Blob_GetBufferPointer(blob), - ID3D10Blob_GetBufferSize(blob), &IID_ID3D12RootSignature, (void **)signature); - ID3D10Blob_Release(blob); - - return hr; -} diff --git a/demos/demo_xcb.h b/demos/demo_xcb.h index 736e8fc1..3cc2c54d 100644 --- a/demos/demo_xcb.h +++ b/demos/demo_xcb.h @@ -564,10 +564,3 @@ static inline void demo_destroy_event(HANDLE event) { vkd3d_destroy_event(event); } - -static inline HRESULT demo_create_root_signature(ID3D12Device *device, - const D3D12_ROOT_SIGNATURE_DESC *desc, ID3D12RootSignature **signature) -{ - return ID3D12Device_CreateRootSignature(device, 0, desc, ~(SIZE_T)0, - &IID_ID3D12RootSignature, (void **)signature); -}