rt(d3d12): replace let_chains with stable alternatives

This commit is contained in:
chyyran 2024-09-14 01:33:36 -04:00 committed by Ronny Chan
parent ab9ab6fe68
commit b432a1e02d
4 changed files with 41 additions and 30 deletions

View file

@ -535,7 +535,12 @@ impl FilterChainD3D12 {
.into();
// incredibly cursed.
let (reflection, graphics_pipeline) =
let (reflection, graphics_pipeline) = 'pipeline: {
'dxil: {
if force_hlsl {
break 'dxil;
}
if let Ok(graphics_pipeline) = D3D12GraphicsPipeline::new_from_dxil(
device,
library,
@ -544,10 +549,11 @@ impl FilterChainD3D12 {
root_signature,
render_format,
disable_cache,
) && !force_hlsl
{
(dxil_reflection, graphics_pipeline)
} else {
) {
break 'pipeline (dxil_reflection, graphics_pipeline);
}
}
let hlsl_reflection = hlsl.reflect(index, semantics)?;
let hlsl = hlsl.compile(Some(
librashader_reflect::back::hlsl::HlslShaderModel::ShaderModel6_0,

View file

@ -160,14 +160,20 @@ impl FilterPass {
source,
);
if let Some(ubo) = &self.reflection.ubo
&& ubo.size != 0
if self
.reflection
.ubo
.as_ref()
.is_some_and(|ubo| ubo.size != 0)
{
self.uniform_storage.inner_ubo().bind_cbv(2, cmd);
}
if let Some(push) = &self.reflection.push_constant
&& push.size != 0
if self
.reflection
.push_constant
.as_ref()
.is_some_and(|push| push.size != 0)
{
self.uniform_storage.inner_push().bind_cbv(3, cmd);
}

View file

@ -1,6 +1,5 @@
#![cfg(target_os = "windows")]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(let_chains)]
#![feature(type_alias_impl_trait)]
mod buffer;

View file

@ -5,14 +5,14 @@ use crate::hello_triangle::{DXSample, SampleCommandLine};
#[test]
fn triangle_d3d12() {
let sample = hello_triangle::d3d12_hello_triangle::Sample::new(
// "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
// "../test/shaders_slang/crt/crt-lottes.slangp",
// "../test/basic.slangp",
// "../test/shaders_slang/handheld/console-border/gbc-lcd-grid-v2.slangp",
// "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp",
// "../test/shaders_slang/test/feedback.slangp",
// "../test/shaders_slang/test/history.slangp",
"../test/shaders_slang/crt/crt-geom-deluxe.slangp",
// "../test/shaders_slang/crt/crt-geom-deluxe.slangp",
// "../test/slang-shaders/vhs/VHSPro.slangp",
&SampleCommandLine {
use_warp_device: false,