[wgsl] Move backend keyword list into its own module

This commit is contained in:
Igor Shaposhnik authored and Dzmitry Malyshau committed 2021-11-24 16:34:17 -05:00
1 parent ae0c7355ca
commit cb6d3fa815
5 files changed
+138 -136

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
mod keywords;
mod writer;
use thiserror::Error;
+1 -1
View File
@@ -73,7 +73,7 @@ impl<W: Write> Writer<W> {
fn reset(&mut self, module: &Module) {
self.names.clear();
self.namer
.reset(module, super::keywords::RESERVED, &[], &mut self.names);
.reset(module, crate::keywords::wgsl::RESERVED, &[], &mut self.names);
self.named_expressions.clear();
self.ep_results.clear();
}
+2
View File
@@ -0,0 +1,2 @@
#[cfg(any(feature = "wgsl-in", feature = "wgsl-out"))]
pub mod wgsl;
+134 -134
View File
@@ -1,134 +1,134 @@
// https://gpuweb.github.io/gpuweb/wgsl/#keyword-summary
pub const RESERVED: &[&str] = &[
// type-defining keywords
"array",
"atomic",
"bool",
"float32",
"int32",
"mat2x2",
"mat2x3",
"mat2x4",
"mat3x2",
"mat3x3",
"mat3x4",
"mat4x2",
"mat4x3",
"mat4x4",
"pointer",
"sampler",
"sampler_comparison",
"struct",
"texture_1d",
"texture_2d",
"texture_2d_array",
"texture_3d",
"texture_cube",
"texture_cube_array",
"texture_multisampled_2d",
"texture_storage_1d",
"texture_storage_2d",
"texture_storage_2d_array",
"texture_storage_3d",
"texture_depth_2d",
"texture_depth_2d_array",
"texture_depth_cube",
"texture_depth_cube_array",
"texture_depth_multisampled_2d",
"uint32",
"vec2",
"vec3",
"vec4",
// other keywords
"bitcast",
"block",
"break",
"case",
"continue",
"continuing",
"default",
"discard",
"else",
"else_if",
"enable",
"fallthrough",
"false",
"fn",
"for",
"function",
"if",
"let",
"loop",
"private",
"read",
"read_write",
"return",
"storage",
"switch",
"true",
"type",
"uniform",
"var",
"workgroup",
"write",
// image format keywords
"r8unorm",
"r8snorm",
"r8uint",
"r8sint",
"r16uint",
"r16sint",
"r16float",
"rg8unorm",
"rg8snorm",
"rg8uint",
"rg8sint",
"r32uint",
"r32sint",
"r32float",
"rg16uint",
"rg16sint",
"rg16float",
"rgba8unorm",
"rgba8unorm_srgb",
"rgba8snorm",
"rgba8uint",
"rgba8sint",
"bgra8unorm",
"bgra8unorm_srgb",
"rgb10a2unorm",
"rg11b10float",
"rg32uint",
"rg32sint",
"rg32float",
"rgba16uint",
"rgba16sint",
"rgba16float",
"rgba32uint",
"rgba32sint",
"rgba32float",
// reserved keywords
"asm",
"bf16",
"const",
"do",
"enum",
"f16",
"f64",
"handle",
"i8",
"i16",
"i64",
"mat",
"premerge",
"regardless",
"typedef",
"u8",
"u16",
"u64",
"unless",
"using",
"vec",
"void",
"while",
];
// https://gpuweb.github.io/gpuweb/wgsl/#keyword-summary
pub const RESERVED: &[&str] = &[
// type-defining keywords
"array",
"atomic",
"bool",
"float32",
"int32",
"mat2x2",
"mat2x3",
"mat2x4",
"mat3x2",
"mat3x3",
"mat3x4",
"mat4x2",
"mat4x3",
"mat4x4",
"pointer",
"sampler",
"sampler_comparison",
"struct",
"texture_1d",
"texture_2d",
"texture_2d_array",
"texture_3d",
"texture_cube",
"texture_cube_array",
"texture_multisampled_2d",
"texture_storage_1d",
"texture_storage_2d",
"texture_storage_2d_array",
"texture_storage_3d",
"texture_depth_2d",
"texture_depth_2d_array",
"texture_depth_cube",
"texture_depth_cube_array",
"texture_depth_multisampled_2d",
"uint32",
"vec2",
"vec3",
"vec4",
// other keywords
"bitcast",
"block",
"break",
"case",
"continue",
"continuing",
"default",
"discard",
"else",
"else_if",
"enable",
"fallthrough",
"false",
"fn",
"for",
"function",
"if",
"let",
"loop",
"private",
"read",
"read_write",
"return",
"storage",
"switch",
"true",
"type",
"uniform",
"var",
"workgroup",
"write",
// image format keywords
"r8unorm",
"r8snorm",
"r8uint",
"r8sint",
"r16uint",
"r16sint",
"r16float",
"rg8unorm",
"rg8snorm",
"rg8uint",
"rg8sint",
"r32uint",
"r32sint",
"r32float",
"rg16uint",
"rg16sint",
"rg16float",
"rgba8unorm",
"rgba8unorm_srgb",
"rgba8snorm",
"rgba8uint",
"rgba8sint",
"bgra8unorm",
"bgra8unorm_srgb",
"rgb10a2unorm",
"rg11b10float",
"rg32uint",
"rg32sint",
"rg32float",
"rgba16uint",
"rgba16sint",
"rgba16float",
"rgba32uint",
"rgba32sint",
"rgba32float",
// reserved keywords
"asm",
"bf16",
"const",
"do",
"enum",
"f16",
"f64",
"handle",
"i8",
"i16",
"i64",
"mat",
"premerge",
"regardless",
"typedef",
"u8",
"u16",
"u64",
"unless",
"using",
"vec",
"void",
"while",
];
+1
View File
@@ -212,6 +212,7 @@ pub mod front;
pub mod proc;
mod span;
pub mod valid;
pub(crate) mod keywords;
pub use crate::arena::{Arena, Handle, Range, UniqueArena};