Skip to content

Commit fc69eab

Browse files
committed
Comments
1 parent 393b3c5 commit fc69eab

File tree

9 files changed

+25
-98
lines changed

9 files changed

+25
-98
lines changed

Cargo.lock

Lines changed: 2 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ fern = "0.7"
108108
flume = "0.11"
109109
futures-lite = "2"
110110
glam = "0.29"
111-
# TODO: Use `half` directly again after <https://github.com/starkat99/half-rs/pull/111> is released upstream.
112-
half = { package = "half-2", version = "2.4.1" }
111+
half = "2.5" # We require 2.5 to have `Arbitrary` support.
113112
hashbrown = { version = "0.14.5", default-features = false, features = [
114113
"ahash",
115114
"inline-more",

naga/src/front/wgsl/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,12 +1023,12 @@ impl<'a> Error<'a> {
10231023
)],
10241024
},
10251025
Error::EnableExtensionNotEnabled { kind, span } => ParseError {
1026-
message: format!("the `{}` language extension is not enabled", kind.to_ident()),
1026+
message: format!("the `{}` enable extension is not enabled", kind.to_ident()),
10271027
labels: vec![(
10281028
span,
10291029
format!(
10301030
concat!(
1031-
"the `{0}` language extension is needed for this functionality, ",
1031+
"the `{}` \"Enable Extension\" is needed for this functionality, ",
10321032
"but it is not currently enabled."
10331033
),
10341034
kind.to_ident()
@@ -1038,7 +1038,7 @@ impl<'a> Error<'a> {
10381038
notes: if let EnableExtension::Unimplemented(kind) = kind {
10391039
vec![format!(
10401040
concat!(
1041-
"This enable-extension is not yet implemented. ",
1041+
"This \"Enable Extension\" is not yet implemented. ",
10421042
"Let Naga maintainers know that you ran into this at ",
10431043
"<https://github.com/gfx-rs/wgpu/issues/{}>, ",
10441044
"so they can prioritize it!"
@@ -1048,7 +1048,7 @@ impl<'a> Error<'a> {
10481048
} else {
10491049
vec![
10501050
format!(
1051-
"You can enable this extension by adding `enable {};` at the top of the shader.",
1051+
"You can enable this extension by adding `enable {};` at the top of the shader, before any other items.",
10521052
kind.to_ident()
10531053
),
10541054
]

naga/src/front/wgsl/parse/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ impl Parser {
840840
let _ = lexer.next();
841841
let num = res.map_err(|err| Error::BadNumber(span, err))?;
842842

843-
if let Some(enable_extension) = num.required_enable_extension() {
843+
if let Some(enable_extension) = num.requires_enable_extension() {
844844
if !lexer.enable_extensions.contains(enable_extension) {
845845
return Err(Error::EnableExtensionNotEnabled {
846846
kind: enable_extension.into(),

naga/src/front/wgsl/parse/number.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub enum Number {
2929
}
3030

3131
impl Number {
32-
pub(super) const fn required_enable_extension(&self) -> Option<ImplementedEnableExtension> {
32+
pub(super) const fn requires_enable_extension(&self) -> Option<ImplementedEnableExtension> {
3333
match *self {
3434
Number::F16(_) => Some(ImplementedEnableExtension::F16),
3535
_ => None,

naga/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ pub enum Literal {
897897
F64(f64),
898898
/// May not be NaN or infinity.
899899
F32(f32),
900+
/// May not be NaN or infinity.
900901
F16(f16),
901902
U32(u32),
902903
I32(i32),

naga/tests/wgsl_errors.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,13 @@ fn float16_requires_enable() {
847847
r#"
848848
const a: f16 = 1.0;
849849
"#,
850-
r#"error: the `f16` language extension is not enabled
850+
r#"error: the `f16` enable extension is not enabled
851851
┌─ wgsl:2:22
852852
853853
2 │ const a: f16 = 1.0;
854-
│ ^^^ the `f16` language extension is needed for this functionality, but it is not currently enabled.
854+
│ ^^^ the `f16` "Enable Extension" is needed for this functionality, but it is not currently enabled.
855855
856-
= note: You can enable this extension by adding `enable f16;` at the top of the shader.
856+
= note: You can enable this extension by adding `enable f16;` at the top of the shader, before any other items.
857857
858858
"#,
859859
);
@@ -862,13 +862,13 @@ fn float16_requires_enable() {
862862
r#"
863863
const a = 1.0h;
864864
"#,
865-
r#"error: the `f16` language extension is not enabled
865+
r#"error: the `f16` enable extension is not enabled
866866
┌─ wgsl:2:23
867867
868868
2 │ const a = 1.0h;
869-
│ ^^^^ the `f16` language extension is needed for this functionality, but it is not currently enabled.
869+
│ ^^^^ the `f16` "Enable Extension" is needed for this functionality, but it is not currently enabled.
870870
871-
= note: You can enable this extension by adding `enable f16;` at the top of the shader.
871+
= note: You can enable this extension by adding `enable f16;` at the top of the shader, before any other items.
872872
873873
"#,
874874
);
@@ -1461,11 +1461,13 @@ fn invalid_blend_src() {
14611461
@fragment
14621462
fn main(@builtin(position) position: vec4<f32>) -> FragmentOutput { return FragmentOutput(vec4(0.0), vec4(0.0)); }
14631463
",
1464-
r###"error: `dual_source_blending` enable-extension is not enabled
1464+
r###"error: the `dual_source_blending` enable extension is not enabled
14651465
┌─ wgsl:3:27
14661466
14671467
3 │ @location(0) @blend_src(0) output0: vec4<f32>,
1468-
│ ^^^^^^^^^ the `dual_source_blending` enable-extension is needed for this functionality, but it is not currently enabled
1468+
│ ^^^^^^^^^ the `dual_source_blending` "Enable Extension" is needed for this functionality, but it is not currently enabled.
1469+
1470+
= note: You can enable this extension by adding `enable dual_source_blending;` at the top of the shader, before any other items.
14691471
14701472
"###,
14711473
);

tests/gpu-tests/shader/struct_layout.rs

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -617,73 +617,6 @@ fn create_16bit_struct_layout_test() -> Vec<ShaderTest> {
617617
));
618618
}
619619

620-
// // Nested struct and array test.
621-
// //
622-
// // This tries to exploit all the weird edge cases of the struct layout algorithm.
623-
// // We dont go as all-out as the other nested struct test because
624-
// // all our primitives are twice as wide and we have only so much buffer to spare.
625-
// {
626-
// let header = String::from(
627-
// "struct Inner { scalar: u64, scalar32: u32, member: array<vec3<u64>, 2> }",
628-
// );
629-
// let members = String::from("inner: Inner");
630-
// let direct = String::from(
631-
// "\
632-
633-
// ",
634-
// );
635-
636-
// tests.push(
637-
// ShaderTest::new(
638-
// String::from("nested struct and array"),
639-
// members,
640-
// direct,
641-
// &input_values,
642-
// &[
643-
// 0, 1, // inner.scalar
644-
// 2, // inner.scalar32
645-
// 8, 9, 10, 11, 12, 13, // inner.member[0]
646-
// 16, 17, 18, 19, 20, 21, // inner.member[1]
647-
// ],
648-
// )
649-
// .header(header),
650-
// );
651-
// }
652-
// {
653-
// let header = String::from("struct Inner { scalar32: u32, scalar: u64, scalar32_2: u32 }");
654-
// let members = String::from("inner: Inner, vector: vec3<i64>");
655-
// let direct = String::from(
656-
// "\
657-
// output[0] = bitcast<u32>(input.inner.scalar32);
658-
// output[1] = u32(bitcast<u64>(input.inner.scalar) & 0xFFFFFFFF);
659-
// output[2] = u32((bitcast<u64>(input.inner.scalar) >> 32) & 0xFFFFFFFF);
660-
// output[3] = bitcast<u32>(input.inner.scalar32_2);
661-
// output[4] = u32(bitcast<u64>(input.vector.x) & 0xFFFFFFFF);
662-
// output[5] = u32((bitcast<u64>(input.vector.x) >> 32) & 0xFFFFFFFF);
663-
// output[6] = u32(bitcast<u64>(input.vector.y) & 0xFFFFFFFF);
664-
// output[7] = u32((bitcast<u64>(input.vector.y) >> 32) & 0xFFFFFFFF);
665-
// output[8] = u32(bitcast<u64>(input.vector.z) & 0xFFFFFFFF);
666-
// output[9] = u32((bitcast<u64>(input.vector.z) >> 32) & 0xFFFFFFFF);
667-
// ",
668-
// );
669-
670-
// tests.push(
671-
// ShaderTest::new(
672-
// String::from("nested struct and array"),
673-
// members,
674-
// direct,
675-
// &input_values,
676-
// &[
677-
// 0, // inner.scalar32
678-
// 2, 3, // inner.scalar
679-
// 4, // inner.scalar32_2
680-
// 8, 9, 10, 11, 12, 13, // vector
681-
// ],
682-
// )
683-
// .header(header),
684-
// );
685-
// }
686-
687620
// Insert `enable f16;` header
688621
tests
689622
.into_iter()

wgpu-types/src/features.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,18 +1340,20 @@ bitflags_array! {
13401340
/// This is a web and native feature.
13411341
const INDIRECT_FIRST_INSTANCE = WEBGPU_FEATURE_INDIRECT_FIRST_INSTANCE;
13421342

1343-
/// Allows shaders to acquire the FP16 ability
1343+
/// Allows shaders to use 16-bit floating point types. You may use them uniform buffers,
1344+
/// storage buffers, and local variables. You may not use them in push constants.
13441345
///
1345-
/// Note: this is not supported in `naga` yet, only through `spirv-passthrough` right now.
1346+
/// In order to use this in WGSL shaders, you must add `enable f16;` to the top of your shader,
1347+
/// before any global items.
13461348
///
13471349
/// Supported Platforms:
13481350
/// - Vulkan
13491351
/// - Metal
1352+
/// - DX12
13501353
///
13511354
/// This is a web and native feature.
13521355
const SHADER_F16 = WEBGPU_FEATURE_SHADER_F16;
13531356

1354-
13551357
/// Allows for usage of textures of format [`TextureFormat::Rg11b10Ufloat`] as a render target
13561358
///
13571359
/// Supported platforms:

0 commit comments

Comments
 (0)