rt(d3d11): replace let_chains with stable alternatives

This commit is contained in:
chyyran 2024-09-14 01:40:41 -04:00 committed by Ronny Chan
parent b432a1e02d
commit 3d9139b4e0
4 changed files with 23 additions and 21 deletions

View file

@ -269,9 +269,8 @@ impl FilterChainD3D11 {
disable_cache,
)?;
let ubo_cbuffer = if let Some(ubo) = &reflection.ubo
&& ubo.size != 0
{
let ubo_cbuffer =
if let Some(ubo) = &reflection.ubo.as_ref().filter(|ubo| ubo.size != 0) {
let buffer = FilterChainD3D11::create_constant_buffer(device, ubo.size)?;
Some(ConstantBufferBinding {
binding: ubo.binding,
@ -283,8 +282,10 @@ impl FilterChainD3D11 {
None
};
let push_cbuffer = if let Some(push) = &reflection.push_constant
&& push.size != 0
let push_cbuffer = if let Some(push) = &reflection
.push_constant
.as_ref()
.filter(|push| push.size != 0)
{
let buffer = FilterChainD3D11::create_constant_buffer(device, push.size)?;
Some(ConstantBufferBinding {
@ -518,7 +519,6 @@ impl FilterChainD3D11 {
QuadType::Final,
)?;
pass.draw(
&ctx,
index,

View file

@ -6,7 +6,6 @@
//! See [`librashader::runtime::d3d11`](https://docs.rs/librashader/latest/librashader/runtime/d3d11/index.html) instead.
#![feature(type_alias_impl_trait)]
#![feature(let_chains)]
mod draw_quad;
mod filter_chain;

View file

@ -97,8 +97,11 @@ pub fn d3d11_get_closest_format(
for supported in format_support_list {
unsafe {
if let Ok(supported_format) = device.CheckFormatSupport(*supported)
&& (supported_format & format_support_mask) == format_support_mask
if device
.CheckFormatSupport(*supported)
.is_ok_and(|supported_format| {
(supported_format & format_support_mask) == format_support_mask
})
{
return *supported;
}

View file

@ -15,9 +15,9 @@ use librashader_runtime_d3d11::options::FilterChainOptionsD3D11;
// const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp";
// const FILTER_PATH: &str = "../test/slang-shaders/test/history.slangp";
const FILTER_PATH: &str = "../test/shaders_slang/test/feedback.slangp";
// const FILTER_PATH: &str = "../test/shaders_slang/test/feedback.slangp";
// const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp";
const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp";
const IMAGE_PATH: &str = "../triangle.png";
#[test]
fn triangle_d3d11_args() {