Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cts_runner/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 17 additions & 1 deletion naga/src/back/pipeline_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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"),
}
}

Expand Down