refactor: reuse texture descriptor predicate

Amp-Thread-ID: https://ampcode.com/threads/T-019f9d91-77c1-7206-a60f-ed6554ce92ab

Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-07-29 02:36:56 +00:00
co-authored by heaust
parent 4ff33e4079
commit 204cb744df
+2 -19
View File
@@ -401,23 +401,6 @@ fn texture_descriptor<'a>(
} }
} }
fn single_view_d2(d: &NormalizedTextureDescriptor) -> bool {
d.dimension == TextureDimension::D2
&& d.mip_level_count == 1
&& d.sample_count == 1
&& d.view_formats.is_empty()
&& matches!(
d.extent,
NormalizedTextureExtent::Absolute {
depth_or_array_layers: 1,
..
} | NormalizedTextureExtent::SurfaceRelative {
depth_or_array_layers: 1,
..
}
)
}
fn validate_fullscreen_execution( fn validate_fullscreen_execution(
graph: &CompiledGraph, graph: &CompiledGraph,
producers: &[Option<u32>], producers: &[Option<u32>],
@@ -653,12 +636,12 @@ fn validate_fullscreen_execution(
let target_d = texture_descriptor(graph, output.resource) let target_d = texture_descriptor(graph, output.resource)
.ok_or_else(|| invalid("fullscreen target descriptor missing", path("inputs")))?; .ok_or_else(|| invalid("fullscreen target descriptor missing", path("inputs")))?;
let hdr = |d: &NormalizedTextureDescriptor| { let hdr = |d: &NormalizedTextureDescriptor| {
single_view_d2(d) && d.format == TextureFormat::Rgba16Float super::compiler::is_single_view_d2(d) && d.format == TextureFormat::Rgba16Float
}; };
let descriptors_valid = hdr(source) let descriptors_valid = hdr(source)
&& match policy { && match policy {
FullscreenPolicy::Copy => { FullscreenPolicy::Copy => {
single_view_d2(target_d) super::compiler::is_single_view_d2(target_d)
&& target_d.format != TextureFormat::Depth32Float && target_d.format != TextureFormat::Depth32Float
&& target_d.extent == source.extent && target_d.extent == source.extent
} }