mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
fix(naga): don't panic on f16s in pipeline constants (#7801)
This commit is contained in:
parent
620c9d1e8b
commit
f96ac55aa4
@ -80,6 +80,7 @@ Bottom level categories:
|
||||
- Generate vectorized code for `[un]pack4x{I,U}8[Clamp]` on SPIR-V and MSL 2.1+. By @robamler in [#7664](https://github.com/gfx-rs/wgpu/pull/7664).
|
||||
- Fix typing for `select`, which had issues particularly with a lack of automatic type conversion. By @ErichDonGubler in [#7572](https://github.com/gfx-rs/wgpu/pull/7572).
|
||||
- Allow scalars as the first argument of the `distance` built-in function. By @bernhl in [#7530](https://github.com/gfx-rs/wgpu/pull/7530).
|
||||
- Don't panic when handling `f16` for pipeline constants, i.e., `override`s in WGSL. By @ErichDonGubler in [#7801](https://github.com/gfx-rs/wgpu/pull/7801).
|
||||
|
||||
#### DX12
|
||||
|
||||
@ -128,7 +129,6 @@ Bottom level categories:
|
||||
|
||||
- Added initial `no_std` support to `wgpu-hal`. By @bushrat011899 in [#7599](https://github.com/gfx-rs/wgpu/pull/7599)
|
||||
|
||||
|
||||
### Documentation
|
||||
|
||||
#### General
|
||||
|
||||
@ -27,6 +27,7 @@ webgpu:api,operation,uncapturederror:iff_uncaptured:*
|
||||
// There are also two unimplemented SKIPs in uncapturederror not enumerated here.
|
||||
webgpu:api,validation,encoding,queries,general:occlusion_query,query_type:*
|
||||
webgpu:shader,execution,flow_control,return:*
|
||||
webgpu:shader,validation,expression,call,builtin,max:values:*
|
||||
webgpu:shader,validation,statement,statement_behavior:invalid_statements:body="break"
|
||||
webgpu:shader,validation,statement,statement_behavior:invalid_statements:body="break_if"
|
||||
webgpu:shader,validation,statement,statement_behavior:invalid_statements:body="continue"
|
||||
|
||||
@ -945,6 +945,19 @@ fn map_value_to_literal(value: f64, scalar: Scalar) -> Result<Literal, PipelineC
|
||||
let value = value as u32;
|
||||
Ok(Literal::U32(value))
|
||||
}
|
||||
Scalar::F16 => {
|
||||
// https://webidl.spec.whatwg.org/#js-float
|
||||
if !value.is_finite() {
|
||||
return Err(PipelineConstantError::SrcNeedsToBeFinite);
|
||||
}
|
||||
|
||||
let value = half::f16::from_f64(value);
|
||||
if !value.is_finite() {
|
||||
return Err(PipelineConstantError::DstRangeTooSmall);
|
||||
}
|
||||
|
||||
Ok(Literal::F16(value))
|
||||
}
|
||||
Scalar::F32 => {
|
||||
// https://webidl.spec.whatwg.org/#js-float
|
||||
if !value.is_finite() {
|
||||
@ -966,7 +979,10 @@ fn map_value_to_literal(value: f64, scalar: Scalar) -> Result<Literal, PipelineC
|
||||
|
||||
Ok(Literal::F64(value))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
Scalar::ABSTRACT_FLOAT | Scalar::ABSTRACT_INT => {
|
||||
unreachable!("abstract values should not be validated out of override processing")
|
||||
}
|
||||
_ => unreachable!("unrecognized scalar type for override"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user