[tint] Move bits of core.def to common.def
Use these in spirv.def
These are useful for other dialects.
Fixed: tint:2036
Change-Id: Iad975d50d83bdd34d1fb4c0d7c6ef5a9c471e9d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152406
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/core/access.def b/src/tint/lang/core/access.def
new file mode 100644
index 0000000..c6a77a1
--- /dev/null
+++ b/src/tint/lang/core/access.def
@@ -0,0 +1,6 @@
+// https://gpuweb.github.io/gpuweb/wgsl/#memory-access-mode
+enum access {
+ read
+ write
+ read_write
+}
diff --git a/src/tint/lang/core/address_space.def b/src/tint/lang/core/address_space.def
new file mode 100644
index 0000000..66a928a
--- /dev/null
+++ b/src/tint/lang/core/address_space.def
@@ -0,0 +1,13 @@
+// https://gpuweb.github.io/gpuweb/wgsl/#storage-class
+enum address_space {
+ function
+ private
+ workgroup
+ uniform
+ storage
+ push_constant
+ pixel_local
+ __in
+ __out
+ @internal handle
+}
diff --git a/src/tint/lang/core/core.def b/src/tint/lang/core/core.def
index 77b445a..3ca17b9 100644
--- a/src/tint/lang/core/core.def
+++ b/src/tint/lang/core/core.def
@@ -13,7 +13,7 @@
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
-// WGSL builtin definition file //
+// core builtin definition file //
// //
// This file is used to generate parts of the Tint BuiltinTable, various //
// enum definition files, as well as test .wgsl files. //
@@ -23,6 +23,10 @@
// from the Dawn source directory. //
////////////////////////////////////////////////////////////////////////////////
+import "src/tint/lang/core/address_space.def"
+import "src/tint/lang/core/access.def"
+import "src/tint/lang/core/texel_format.def"
+
////////////////////////////////////////////////////////////////////////////////
// Enumerators //
////////////////////////////////////////////////////////////////////////////////
@@ -46,48 +50,6 @@
__point_size
}
-// https://gpuweb.github.io/gpuweb/wgsl/#storage-class
-enum address_space {
- function
- private
- workgroup
- uniform
- storage
- push_constant
- pixel_local
- __in
- __out
- @internal handle
-}
-
-// https://gpuweb.github.io/gpuweb/wgsl/#memory-access-mode
-enum access {
- read
- write
- read_write
-}
-
-// https://gpuweb.github.io/gpuweb/wgsl/#texel-formats
-enum texel_format {
- bgra8unorm
- rgba8unorm
- rgba8snorm
- rgba8uint
- rgba8sint
- rgba16uint
- rgba16sint
- rgba16float
- r32uint
- r32sint
- r32float
- rg32uint
- rg32sint
- rg32float
- rgba32uint
- rgba32sint
- rgba32float
-}
-
// https://www.w3.org/TR/WGSL/#interpolation
enum interpolation_type {
perspective
diff --git a/src/tint/lang/core/texel_format.def b/src/tint/lang/core/texel_format.def
new file mode 100644
index 0000000..89e5f65
--- /dev/null
+++ b/src/tint/lang/core/texel_format.def
@@ -0,0 +1,20 @@
+// https://gpuweb.github.io/gpuweb/wgsl/#texel-formats
+enum texel_format {
+ bgra8unorm
+ rgba8unorm
+ rgba8snorm
+ rgba8uint
+ rgba8sint
+ rgba16uint
+ rgba16sint
+ rgba16float
+ r32uint
+ r32sint
+ r32float
+ rg32uint
+ rg32sint
+ rg32float
+ rgba32uint
+ rgba32sint
+ rgba32float
+}
diff --git a/src/tint/lang/spirv/spirv.def b/src/tint/lang/spirv/spirv.def
index 814352c..e386f4d 100644
--- a/src/tint/lang/spirv/spirv.def
+++ b/src/tint/lang/spirv/spirv.def
@@ -16,8 +16,9 @@
// Spirv builtin definition file //
////////////////////////////////////////////////////////////////////////////////
-// TODO(crbug.com/2036): add an include facility and move these duplicate match and type lines
-// into a common file.
+import "src/tint/lang/core/address_space.def"
+import "src/tint/lang/core/access.def"
+import "src/tint/lang/core/texel_format.def"
type bool
type f32
@@ -62,42 +63,6 @@
type struct_with_runtime_array
type sampled_image<T>
-enum address_space {
- function
- private
- workgroup
- uniform
- storage
- push_constant
- pixel_local
-}
-
-enum access {
- read
- write
- read_write
-}
-
-enum texel_format {
- bgra8unorm
- rgba8unorm
- rgba8snorm
- rgba8uint
- rgba8sint
- rgba16uint
- rgba16sint
- rgba16float
- r32uint
- r32sint
- r32float
- rg32uint
- rg32sint
- rg32float
- rgba32uint
- rgba32sint
- rgba32float
-}
-
match f32_f16: f32 | f16
match iu32: i32 | u32
match fiu32: f32 | i32 | u32