Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion d3d12/crates/leonida-gpu/src/pipeline/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,36 @@ mod tests {
let dir = tempfile::tempdir().unwrap();
let vs = compile(&dxc, dir.path(), VS, "vs_6_5");
let ps = compile(&dxc, dir.path(), PS, "ps_6_5");
let (root, root_blob) = root_signature(&host.device, &[], &[], false).unwrap();
// Empty root signature without SM 6.6 `*_HEAP_DIRECTLY_INDEXED` flags: the
// shaders bind no descriptors, and unit tests run against inbox `d3d12.dll`
// (which rejects SM 6.6 root signature flags with `E_INVALIDARG` on Windows 10).
let (root, root_blob) = {
let desc = D3D12_VERSIONED_ROOT_SIGNATURE_DESC {
Version: windows::Win32::Graphics::Direct3D12::D3D_ROOT_SIGNATURE_VERSION_1_1,
Anonymous: D3D12_VERSIONED_ROOT_SIGNATURE_DESC_0 {
Desc_1_1: D3D12_ROOT_SIGNATURE_DESC1 {
NumParameters: 0,
pParameters: std::ptr::null(),
NumStaticSamplers: 0,
pStaticSamplers: std::ptr::null(),
Flags: D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT,
},
},
};
// SAFETY: self-contained empty root signature descriptor; blob is read before drop.
unsafe {
let mut blob: Option<ID3DBlob> = None;
D3D12SerializeVersionedRootSignature(&desc, &mut blob, None).unwrap();
let blob = blob.unwrap();
let bytes = std::slice::from_raw_parts(
blob.GetBufferPointer().cast::<u8>(),
blob.GetBufferSize(),
)
.to_vec();
let root: ID3D12RootSignature = host.device.CreateRootSignature(0, &bytes).unwrap();
(root, bytes)
}
};

let mut g = GraphicsState::default();
// Subobject 21 (`DEPTH_STENCIL1`) with `DepthBoundsTestEnable = true`,
Expand Down