mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-26 01:11:22 +01:00
fix(naga): Disallow derivatives for f16 (#9154)
This commit is contained in:
1 parent
6ebd5bfd4a
commit
8ddbd2d236
5 files changed
+11
-15
No files matched your search
@@ -71,6 +71,7 @@ Bottom level categories:
|
||||
#### naga
|
||||
|
||||
- Fixed overflow detection and argument domain validation for `acosh`, `length`, `normalize`, and `pow` in constant evaluation. By @ecoricemon in [#9249](https://github.com/gfx-rs/wgpu/pull/9249).
|
||||
- Naga no longer allows derivative operations on `f16`. WGSL does not currently allow this, although [it may be added in the future](https://github.com/gpuweb/gpuweb/issues/5482). By @andyleiserson in [#9154](https://github.com/gfx-rs/wgpu/pull/9154).
|
||||
|
||||
#### Metal
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ webgpu:shader,validation,expression,call,builtin,countLeadingZeros:* // 98%, ato
|
||||
webgpu:shader,validation,expression,call,builtin,countOneBits:* // 98%, atomic type validation gap, https://github.com/gfx-rs/wgpu/issues/5474
|
||||
webgpu:shader,validation,expression,call,builtin,countTrailingZeros:* // 98%, atomic type validation gap, https://github.com/gfx-rs/wgpu/issues/5474
|
||||
webgpu:shader,validation,expression,call,builtin,cross:* // 86%, abstract int/float overflow issues in const eval
|
||||
webgpu:shader,validation,expression,call,builtin,derivatives:* // 83%, f16 support not properly validated
|
||||
webgpu:shader,validation,expression,call,builtin,determinant:* // 71%, abstract int/float const eval issues
|
||||
webgpu:shader,validation,expression,call,builtin,distance:* // 66%, scalar distance uses wrong formula (sqrt instead of abs)
|
||||
webgpu:shader,validation,expression,call,builtin,dot4I8Packed:* // 91%, missing const eval (#4507)
|
||||
|
||||
@@ -383,6 +383,7 @@ webgpu:shader,validation,expression,call,builtin,ceil:*
|
||||
webgpu:shader,validation,expression,call,builtin,cos:*
|
||||
webgpu:shader,validation,expression,call,builtin,cosh:*
|
||||
webgpu:shader,validation,expression,call,builtin,degrees:*
|
||||
webgpu:shader,validation,expression,call,builtin,derivatives:*
|
||||
webgpu:shader,validation,expression,call,builtin,distance:values:stage="constant";type="f32"
|
||||
webgpu:shader,validation,expression,call,builtin,dot:*
|
||||
webgpu:shader,validation,expression,call,builtin,exp:*
|
||||
|
||||
@@ -422,8 +422,8 @@ impl crate::TypeInner {
|
||||
})
|
||||
}
|
||||
|
||||
/// If the type is a Vector or a Scalar return a tuple of the vector size (or None
|
||||
/// for Scalars), and the scalar kind. Returns (None, None) for other types.
|
||||
/// If the type is a scalar or vector (not a matrix), return a tuple of the vector
|
||||
/// size (or `None` for scalars), and the scalar kind. Returns `None` for other types.
|
||||
pub const fn vector_size_and_scalar(
|
||||
&self,
|
||||
) -> Option<(Option<crate::VectorSize>, crate::Scalar)> {
|
||||
|
||||
@@ -1182,18 +1182,13 @@ impl super::Validator {
|
||||
ShaderStages::all()
|
||||
}
|
||||
E::Derivative { expr, .. } => {
|
||||
match resolver[expr] {
|
||||
Ti::Scalar(Sc {
|
||||
kind: Sk::Float, ..
|
||||
})
|
||||
| Ti::Vector {
|
||||
scalar:
|
||||
Sc {
|
||||
kind: Sk::Float, ..
|
||||
},
|
||||
..
|
||||
} => {}
|
||||
_ => return Err(ExpressionError::InvalidDerivative),
|
||||
let Some((_, scalar)) = resolver[expr].vector_size_and_scalar() else {
|
||||
return Err(ExpressionError::InvalidDerivative);
|
||||
};
|
||||
if scalar.kind != Sk::Float || scalar.width < 4 {
|
||||
// Derivatives are not supported for `f16`, although support may be added
|
||||
// in the future, see https://github.com/gpuweb/gpuweb/issues/5482.
|
||||
return Err(ExpressionError::InvalidDerivative);
|
||||
}
|
||||
ShaderStages::FRAGMENT
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user