rt(d3d11): replace let_chains
with stable alternatives
This commit is contained in:
parent
b432a1e02d
commit
3d9139b4e0
|
@ -269,22 +269,23 @@ impl FilterChainD3D11 {
|
||||||
disable_cache,
|
disable_cache,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let ubo_cbuffer = if let Some(ubo) = &reflection.ubo
|
let ubo_cbuffer =
|
||||||
&& ubo.size != 0
|
if let Some(ubo) = &reflection.ubo.as_ref().filter(|ubo| ubo.size != 0) {
|
||||||
{
|
let buffer = FilterChainD3D11::create_constant_buffer(device, ubo.size)?;
|
||||||
let buffer = FilterChainD3D11::create_constant_buffer(device, ubo.size)?;
|
Some(ConstantBufferBinding {
|
||||||
Some(ConstantBufferBinding {
|
binding: ubo.binding,
|
||||||
binding: ubo.binding,
|
size: ubo.size,
|
||||||
size: ubo.size,
|
stage_mask: ubo.stage_mask,
|
||||||
stage_mask: ubo.stage_mask,
|
buffer,
|
||||||
buffer,
|
})
|
||||||
})
|
} else {
|
||||||
} else {
|
None
|
||||||
None
|
};
|
||||||
};
|
|
||||||
|
|
||||||
let push_cbuffer = if let Some(push) = &reflection.push_constant
|
let push_cbuffer = if let Some(push) = &reflection
|
||||||
&& push.size != 0
|
.push_constant
|
||||||
|
.as_ref()
|
||||||
|
.filter(|push| push.size != 0)
|
||||||
{
|
{
|
||||||
let buffer = FilterChainD3D11::create_constant_buffer(device, push.size)?;
|
let buffer = FilterChainD3D11::create_constant_buffer(device, push.size)?;
|
||||||
Some(ConstantBufferBinding {
|
Some(ConstantBufferBinding {
|
||||||
|
@ -518,7 +519,6 @@ impl FilterChainD3D11 {
|
||||||
QuadType::Final,
|
QuadType::Final,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
||||||
pass.draw(
|
pass.draw(
|
||||||
&ctx,
|
&ctx,
|
||||||
index,
|
index,
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
//! See [`librashader::runtime::d3d11`](https://docs.rs/librashader/latest/librashader/runtime/d3d11/index.html) instead.
|
//! See [`librashader::runtime::d3d11`](https://docs.rs/librashader/latest/librashader/runtime/d3d11/index.html) instead.
|
||||||
|
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
#![feature(let_chains)]
|
|
||||||
|
|
||||||
mod draw_quad;
|
mod draw_quad;
|
||||||
mod filter_chain;
|
mod filter_chain;
|
||||||
|
|
|
@ -97,8 +97,11 @@ pub fn d3d11_get_closest_format(
|
||||||
|
|
||||||
for supported in format_support_list {
|
for supported in format_support_list {
|
||||||
unsafe {
|
unsafe {
|
||||||
if let Ok(supported_format) = device.CheckFormatSupport(*supported)
|
if device
|
||||||
&& (supported_format & format_support_mask) == format_support_mask
|
.CheckFormatSupport(*supported)
|
||||||
|
.is_ok_and(|supported_format| {
|
||||||
|
(supported_format & format_support_mask) == format_support_mask
|
||||||
|
})
|
||||||
{
|
{
|
||||||
return *supported;
|
return *supported;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/shaders_slang/crt/crt-royale.slangp";
|
||||||
|
|
||||||
// const FILTER_PATH: &str = "../test/slang-shaders/test/history.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";
|
const IMAGE_PATH: &str = "../triangle.png";
|
||||||
#[test]
|
#[test]
|
||||||
fn triangle_d3d11_args() {
|
fn triangle_d3d11_args() {
|
||||||
|
|
Loading…
Reference in a new issue