Skip to content

Commit 7d7e334

Browse files
committed
add root signature flags support.
1 parent 6b77c6a commit 7d7e334

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

descriptors/root_signature.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ wrapper::directx12::root_signature::root_signature(const ComPtr<ID3D12RootSignat
135135
{
136136
}
137137

138-
wrapper::directx12::root_signature wrapper::directx12::root_signature::create(const device& device, const root_signature_info& info, bool local)
138+
wrapper::directx12::root_signature wrapper::directx12::root_signature::create(
139+
const D3D12_ROOT_SIGNATURE_FLAGS& flags,
140+
const device& device, const root_signature_info& info)
139141
{
140142
D3D12_ROOT_SIGNATURE_DESC desc;
141143

142-
// https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_root_signature_flags
143-
// This flag(D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE) cannot be combined with any other root signature flags
144-
desc.Flags = local ? D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE : D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
144+
desc.Flags = flags;
145145
desc.NumStaticSamplers = static_cast<UINT>(info.samplers().size());
146146
desc.NumParameters = static_cast<UINT>(info.parameters().size());
147147
desc.pStaticSamplers = info.samplers().data();
148148
desc.pParameters = info.parameters().data();
149-
149+
150150
ComPtr<ID3DBlob> signature_blob = nullptr;
151151
ComPtr<ID3DBlob> error_blob = nullptr;
152152

descriptors/root_signature.hpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ namespace wrapper::directx12
4141
const std::vector<D3D12_ROOT_PARAMETER>& parameters() const;
4242
private:
4343
root_signature_info& add_root_parameter(const std::string& name, const D3D12_ROOT_PARAMETER& parameter);
44-
44+
45+
D3D12_ROOT_SIGNATURE_FLAGS mFlags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
46+
4547
std::vector<D3D12_STATIC_SAMPLER_DESC> mStaticSamplers;
4648
std::vector<D3D12_ROOT_PARAMETER> mRootParameters;
4749

@@ -61,7 +63,9 @@ namespace wrapper::directx12
6163

6264
root_signature(const ComPtr<ID3D12RootSignature>& source);
6365

64-
static root_signature create(const device& device, const root_signature_info& info, bool local = false);
66+
static root_signature create(
67+
const D3D12_ROOT_SIGNATURE_FLAGS& flags,
68+
const device& device, const root_signature_info& info);
6569
};
6670

6771
}

extensions/imgui.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ namespace wrapper::directx12::extensions
322322
.add_constants("view", 0, 0, 16)
323323
.add_static_sampler("sampler", 0, 0);
324324

325-
RootSignature = root_signature::create(Device, RootSignatureInfo);
325+
RootSignature = root_signature::create(
326+
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT,
327+
Device, RootSignatureInfo);
326328

327329
static const char* vert_shader =
328330
"cbuffer vertexBuffer : register(b0) \

0 commit comments

Comments
 (0)