mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[naga valid]: Clean up validation of Statement::ImageStore.
Move image class validation to a more natural spot.
This commit is contained in:
@@ -1060,6 +1060,14 @@ impl super::Validator {
|
||||
.with_handle(image, context.expressions));
|
||||
};
|
||||
|
||||
// It had better be a storage image, since we're writing to it.
|
||||
let crate::ImageClass::Storage { format, .. } = class else {
|
||||
return Err(FunctionError::InvalidImageStore(
|
||||
ExpressionError::InvalidImageClass(class),
|
||||
)
|
||||
.with_span_handle(image, context.expressions));
|
||||
};
|
||||
|
||||
// The `coordinate` operand must be a vector of the appropriate size.
|
||||
if !context
|
||||
.resolve_type(coordinate, &self.valid_expression_set)?
|
||||
@@ -1097,14 +1105,6 @@ impl super::Validator {
|
||||
}
|
||||
}
|
||||
|
||||
// It had better be a storage image, since we're writing to it.
|
||||
let crate::ImageClass::Storage { format, .. } = class else {
|
||||
return Err(FunctionError::InvalidImageStore(
|
||||
ExpressionError::InvalidImageClass(class),
|
||||
)
|
||||
.with_span_handle(image, context.expressions));
|
||||
};
|
||||
|
||||
let value_ty = crate::TypeInner::Vector {
|
||||
size: crate::VectorSize::Quad,
|
||||
scalar: format.into(),
|
||||
|
||||
Reference in New Issue
Block a user