mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Validate that SampleLevel::Exact isn't used for comparisons
This commit is contained in:
committed by
Dzmitry Malyshau
parent
e59582469c
commit
27e4ba59e4
@@ -2625,7 +2625,7 @@ fn test_stack_size() {
|
||||
let stack_size = addresses.end - addresses.start;
|
||||
// check the size (in debug only)
|
||||
// last observed macOS value: 17504
|
||||
if stack_size < 14000 || stack_size > 19000 {
|
||||
if stack_size < 13000 || stack_size > 19000 {
|
||||
panic!("`put_block` stack size {} has changed!", stack_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,12 @@ impl<I: Iterator<Item = u32>> super::Parser<I> {
|
||||
spirv::ImageOperands::LOD => {
|
||||
let lod_expr = self.next()?;
|
||||
let lod_handle = self.lookup_expression.lookup(lod_expr)?.handle;
|
||||
level = crate::SampleLevel::Exact(lod_handle);
|
||||
level = if options.compare {
|
||||
log::debug!("Assuming {:?} is zero", lod_handle);
|
||||
crate::SampleLevel::Zero
|
||||
} else {
|
||||
crate::SampleLevel::Exact(lod_handle)
|
||||
};
|
||||
words_left -= 1;
|
||||
}
|
||||
spirv::ImageOperands::GRAD => {
|
||||
|
||||
@@ -93,6 +93,8 @@ pub enum ExpressionError {
|
||||
InvalidSampleOffset(crate::ImageDimension, Handle<crate::Constant>),
|
||||
#[error("Depth reference {0:?} is not a scalar float")]
|
||||
InvalidDepthReference(Handle<crate::Expression>),
|
||||
#[error("Depth sample level can only be Auto or Zero")]
|
||||
InvalidDepthSampleLevel,
|
||||
#[error("Sample level (exact) type {0:?} is not a scalar float")]
|
||||
InvalidSampleLevelExactType(Handle<crate::Expression>),
|
||||
#[error("Sample level (bias) type {0:?} is not a scalar float")]
|
||||
@@ -451,6 +453,10 @@ impl super::Validator {
|
||||
} => {}
|
||||
_ => return Err(ExpressionError::InvalidDepthReference(expr)),
|
||||
}
|
||||
match level {
|
||||
crate::SampleLevel::Auto | crate::SampleLevel::Zero => {}
|
||||
_ => return Err(ExpressionError::InvalidDepthSampleLevel),
|
||||
}
|
||||
}
|
||||
|
||||
// check level properties
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
bits: 0,
|
||||
),
|
||||
),
|
||||
ref_count: 1,
|
||||
ref_count: 0,
|
||||
assignable_global: None,
|
||||
ty: Value(Scalar(
|
||||
kind: Float,
|
||||
|
||||
@@ -1039,7 +1039,7 @@
|
||||
coordinate: 72,
|
||||
array_index: Some(74),
|
||||
offset: None,
|
||||
level: Exact(25),
|
||||
level: Zero,
|
||||
depth_ref: Some(69),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user