Skip to content

Commit 9aaed2c

Browse files
authored
[naga] Ensure validation rejects invalid sample operations of ImageClass::External images. (#8121)
textureSampleBaseClampToEdge() is valid when called on a `texture_external` texture, but all other sample operations are invalid. Previously validation was succeeding for these operations on an external texture in cases where the same operation on a `texture_2d<f32>` would be allowed. We must therefore explicitly check for ImageClass::External and disallow invalid sample operations.
1 parent 8752503 commit 9aaed2c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

naga/src/valid/expression.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,11 @@ impl super::Validator {
590590
}
591591
}
592592

593+
// External textures can only be sampled using clamp_to_edge.
594+
if matches!(class, crate::ImageClass::External) && !clamp_to_edge {
595+
return Err(ExpressionError::InvalidImageClass(class));
596+
}
597+
593598
// check level properties
594599
match level {
595600
crate::SampleLevel::Auto => ShaderStages::FRAGMENT,

0 commit comments

Comments
 (0)