dx12: reduce initializations of dxc
This commit is contained in:
parent
227cae6405
commit
621d1da3c2
1 changed files with 12 additions and 4 deletions
|
@ -362,11 +362,18 @@ impl FilterChainD3D12 {
|
||||||
let filters: Vec<error::Result<_>> = passes.into_par_iter()
|
let filters: Vec<error::Result<_>> = passes.into_par_iter()
|
||||||
.zip(hlsl_passes)
|
.zip(hlsl_passes)
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(index, ((config, source, mut dxil),
|
.map_init(
|
||||||
|
|| {
|
||||||
|
let validator: IDxcValidator = unsafe { DxcCreateInstance(&CLSID_DxcValidator)? };
|
||||||
|
let library: IDxcUtils = unsafe { DxcCreateInstance(&CLSID_DxcLibrary)? };
|
||||||
|
let compiler: IDxcCompiler = unsafe { DxcCreateInstance(&CLSID_DxcCompiler)? };
|
||||||
|
Ok::<_, FilterChainError>((validator, library, compiler))
|
||||||
|
},
|
||||||
|
|dxc, (index, ((config, source, mut dxil),
|
||||||
(_, _, mut hlsl)))| {
|
(_, _, mut hlsl)))| {
|
||||||
let validator: IDxcValidator = unsafe { DxcCreateInstance(&CLSID_DxcValidator)? };
|
let Ok((validator, library, compiler)) = dxc else {
|
||||||
let library: IDxcUtils = unsafe { DxcCreateInstance(&CLSID_DxcLibrary)? };
|
return Err(FilterChainError::Direct3DOperationError("Could not initialize DXC for thread"));
|
||||||
let compiler: IDxcCompiler = unsafe { DxcCreateInstance(&CLSID_DxcCompiler)? };
|
};
|
||||||
|
|
||||||
let dxil_reflection = dxil.reflect(index, semantics)?;
|
let dxil_reflection = dxil.reflect(index, semantics)?;
|
||||||
let dxil = dxil.compile(Some(
|
let dxil = dxil.compile(Some(
|
||||||
|
@ -446,6 +453,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..?
|
||||||
let filters: Vec<error::Result<FilterPass>> = filters
|
let filters: Vec<error::Result<FilterPass>> = filters
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip(work_heaps)
|
.zip(work_heaps)
|
||||||
|
|
Loading…
Add table
Reference in a new issue