From 204cb744df15f83f9b5840c10bcd3f470ed8d1db Mon Sep 17 00:00:00 2001 From: Amp Date: Wed, 29 Jul 2026 02:36:56 +0000 Subject: [PATCH] refactor: reuse texture descriptor predicate Amp-Thread-ID: https://ampcode.com/threads/T-019f9d91-77c1-7206-a60f-ed6554ce92ab Co-authored-by: Heaust Azure --- renderer/src/render_graph/runtime.rs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/renderer/src/render_graph/runtime.rs b/renderer/src/render_graph/runtime.rs index 8bafa57..154a568 100644 --- a/renderer/src/render_graph/runtime.rs +++ b/renderer/src/render_graph/runtime.rs @@ -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( graph: &CompiledGraph, producers: &[Option], @@ -653,12 +636,12 @@ fn validate_fullscreen_execution( let target_d = texture_descriptor(graph, output.resource) .ok_or_else(|| invalid("fullscreen target descriptor missing", path("inputs")))?; 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) && match policy { FullscreenPolicy::Copy => { - single_view_d2(target_d) + super::compiler::is_single_view_d2(target_d) && target_d.format != TextureFormat::Depth32Float && target_d.extent == source.extent }