dx12: use versionedrootsignature
This commit is contained in:
parent
fd48d88fdd
commit
1fe4b47981
|
@ -25,7 +25,6 @@ pub enum FilterChainError {
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, FilterChainError>;
|
pub type Result<T> = std::result::Result<T, FilterChainError>;
|
||||||
|
|
||||||
// todo: make this return error
|
|
||||||
macro_rules! assume_d3d12_init {
|
macro_rules! assume_d3d12_init {
|
||||||
($value:ident, $call:literal) => {
|
($value:ident, $call:literal) => {
|
||||||
let $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
|
let $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
|
||||||
|
|
|
@ -437,7 +437,7 @@ impl FilterChainD3D12 {
|
||||||
let filters: error::Result<Vec<_>> = filters.into_iter().collect();
|
let filters: error::Result<Vec<_>> = filters.into_iter().collect();
|
||||||
let filters = filters?;
|
let filters = filters?;
|
||||||
|
|
||||||
/// Need to take care of the heaps in a single thread because [;16] is not sized..?
|
// Need to take care of the heaps in a single thread because [;16] is not sized..?
|
||||||
let filters: Vec<error::Result<FilterPass>> = filters
|
let filters: Vec<error::Result<FilterPass>> = filters
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip(work_heaps)
|
.zip(work_heaps)
|
||||||
|
|
|
@ -8,19 +8,7 @@ use librashader_reflect::back::ShaderCompilerOutput;
|
||||||
use librashader_reflect::reflect::semantics::BindingStage;
|
use librashader_reflect::reflect::semantics::BindingStage;
|
||||||
use windows::Win32::Foundation::BOOL;
|
use windows::Win32::Foundation::BOOL;
|
||||||
use windows::Win32::Graphics::Direct3D::Dxc::{IDxcBlob, IDxcCompiler, IDxcUtils, IDxcValidator};
|
use windows::Win32::Graphics::Direct3D::Dxc::{IDxcBlob, IDxcCompiler, IDxcUtils, IDxcValidator};
|
||||||
use windows::Win32::Graphics::Direct3D12::{
|
use windows::Win32::Graphics::Direct3D12::{ID3D12Device, ID3D12PipelineState, ID3D12RootSignature, D3D12_BLEND_DESC, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, D3D12_BLEND_SRC_ALPHA, D3D12_COLOR_WRITE_ENABLE_ALL, D3D12_CULL_MODE_NONE, D3D12_DESCRIPTOR_RANGE, D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, D3D12_DESCRIPTOR_RANGE_TYPE_SRV, D3D12_FILL_MODE_SOLID, D3D12_GRAPHICS_PIPELINE_STATE_DESC, D3D12_INPUT_LAYOUT_DESC, D3D12_LOGIC_OP_NOOP, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, D3D12_RASTERIZER_DESC, D3D12_RENDER_TARGET_BLEND_DESC, D3D12_ROOT_DESCRIPTOR, D3D12_ROOT_DESCRIPTOR_TABLE, D3D12_ROOT_PARAMETER, D3D12_ROOT_PARAMETER_0, D3D12_ROOT_PARAMETER_TYPE_CBV, D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, D3D12_ROOT_SIGNATURE_DESC, D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT, D3D12_SHADER_BYTECODE, D3D12_SHADER_VISIBILITY_ALL, D3D12_SHADER_VISIBILITY_PIXEL, D3D_ROOT_SIGNATURE_VERSION_1, D3D12SerializeVersionedRootSignature, D3D12_VERSIONED_ROOT_SIGNATURE_DESC, D3D_ROOT_SIGNATURE_VERSION_1_0, D3D12_VERSIONED_ROOT_SIGNATURE_DESC_0};
|
||||||
D3D12SerializeRootSignature, ID3D12Device, ID3D12PipelineState, ID3D12RootSignature,
|
|
||||||
D3D12_BLEND_DESC, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, D3D12_BLEND_SRC_ALPHA,
|
|
||||||
D3D12_COLOR_WRITE_ENABLE_ALL, D3D12_CULL_MODE_NONE, D3D12_DESCRIPTOR_RANGE,
|
|
||||||
D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, D3D12_DESCRIPTOR_RANGE_TYPE_SRV, D3D12_FILL_MODE_SOLID,
|
|
||||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC, D3D12_INPUT_LAYOUT_DESC, D3D12_LOGIC_OP_NOOP,
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, D3D12_RASTERIZER_DESC, D3D12_RENDER_TARGET_BLEND_DESC,
|
|
||||||
D3D12_ROOT_DESCRIPTOR, D3D12_ROOT_DESCRIPTOR_TABLE, D3D12_ROOT_PARAMETER,
|
|
||||||
D3D12_ROOT_PARAMETER_0, D3D12_ROOT_PARAMETER_TYPE_CBV,
|
|
||||||
D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, D3D12_ROOT_SIGNATURE_DESC,
|
|
||||||
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT, D3D12_SHADER_BYTECODE,
|
|
||||||
D3D12_SHADER_VISIBILITY_ALL, D3D12_SHADER_VISIBILITY_PIXEL, D3D_ROOT_SIGNATURE_VERSION_1,
|
|
||||||
};
|
|
||||||
use windows::Win32::Graphics::Dxgi::Common::{DXGI_FORMAT, DXGI_FORMAT_UNKNOWN, DXGI_SAMPLE_DESC};
|
use windows::Win32::Graphics::Dxgi::Common::{DXGI_FORMAT, DXGI_FORMAT_UNKNOWN, DXGI_SAMPLE_DESC};
|
||||||
|
|
||||||
pub struct D3D12GraphicsPipeline {
|
pub struct D3D12GraphicsPipeline {
|
||||||
|
@ -85,12 +73,17 @@ const D3D12_SLANG_ROOT_PARAMETERS: &[D3D12_ROOT_PARAMETER; 4] = &[
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const D3D12_SLANG_ROOT_SIGNATURE: &D3D12_ROOT_SIGNATURE_DESC = &D3D12_ROOT_SIGNATURE_DESC {
|
const D3D12_SLANG_VERSIONED_ROOT_SIGNATURE: &D3D12_VERSIONED_ROOT_SIGNATURE_DESC = &D3D12_VERSIONED_ROOT_SIGNATURE_DESC {
|
||||||
NumParameters: D3D12_SLANG_ROOT_PARAMETERS.len() as u32,
|
Version: D3D_ROOT_SIGNATURE_VERSION_1_0,
|
||||||
pParameters: D3D12_SLANG_ROOT_PARAMETERS.as_ptr(),
|
Anonymous: D3D12_VERSIONED_ROOT_SIGNATURE_DESC_0 {
|
||||||
NumStaticSamplers: 0,
|
Desc_1_0: D3D12_ROOT_SIGNATURE_DESC {
|
||||||
pStaticSamplers: std::ptr::null(),
|
NumParameters: D3D12_SLANG_ROOT_PARAMETERS.len() as u32,
|
||||||
Flags: D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT,
|
pParameters: D3D12_SLANG_ROOT_PARAMETERS.as_ptr(),
|
||||||
|
NumStaticSamplers: 0,
|
||||||
|
pStaticSamplers: std::ptr::null(),
|
||||||
|
Flags: D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT,
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct D3D12RootSignature {
|
pub struct D3D12RootSignature {
|
||||||
|
@ -101,16 +94,14 @@ impl D3D12RootSignature {
|
||||||
pub fn new(device: &ID3D12Device) -> error::Result<D3D12RootSignature> {
|
pub fn new(device: &ID3D12Device) -> error::Result<D3D12RootSignature> {
|
||||||
let signature = unsafe {
|
let signature = unsafe {
|
||||||
let mut rs_blob = None;
|
let mut rs_blob = None;
|
||||||
// todo: D3D12SerializeVersionedRootSignature
|
|
||||||
// todo: hlsl rootsig tbh
|
D3D12SerializeVersionedRootSignature(
|
||||||
D3D12SerializeRootSignature(
|
D3D12_SLANG_VERSIONED_ROOT_SIGNATURE,
|
||||||
D3D12_SLANG_ROOT_SIGNATURE,
|
|
||||||
D3D_ROOT_SIGNATURE_VERSION_1,
|
|
||||||
&mut rs_blob,
|
&mut rs_blob,
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assume_d3d12_init!(rs_blob, "D3D12SerializeRootSignature");
|
assume_d3d12_init!(rs_blob, "D3D12SerializeVersionedRootSignature");
|
||||||
let blob = std::slice::from_raw_parts(
|
let blob = std::slice::from_raw_parts(
|
||||||
rs_blob.GetBufferPointer().cast(),
|
rs_blob.GetBufferPointer().cast(),
|
||||||
rs_blob.GetBufferSize(),
|
rs_blob.GetBufferSize(),
|
||||||
|
|
Loading…
Reference in a new issue