mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
tint: Deprecated module-scope 'let' for 'const'
Enable the parsing of 'const'. Warn on use of module-scope 'let', and automatically replace with 'const'. Fixed: tint:1580 Change-Id: I214aabca80686dc6b60ae21a7a57fbfb4898ea83 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93786 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
03f88e6f49
commit
c64ca23d94
13
test/tint/types/module_scope_const.wgsl
Normal file
13
test/tint/types/module_scope_const.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
const const_bool : bool = bool();
|
||||
const const_i32 : i32 = i32();
|
||||
const const_u32 : u32 = u32();
|
||||
const const_f32 : f32 = f32();
|
||||
const const_v2i32 : vec2<i32> = vec2<i32>();
|
||||
const const_v3u32 : vec3<u32> = vec3<u32>();
|
||||
const const_v4f32 : vec4<f32> = vec4<f32>();
|
||||
const const_m3x4 : mat3x4<f32> = mat3x4<f32>();
|
||||
const const_arr : array<f32, 4> = array<f32, 4>();
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
float a;
|
||||
};
|
||||
|
||||
void tint_symbol() {
|
||||
}
|
||||
|
||||
4
test/tint/types/module_scope_const.wgsl.expected.hlsl
Normal file
4
test/tint/types/module_scope_const.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,4 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
return;
|
||||
}
|
||||
7
test/tint/types/module_scope_const.wgsl.expected.msl
Normal file
7
test/tint/types/module_scope_const.wgsl.expected.msl
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol() {
|
||||
return;
|
||||
}
|
||||
|
||||
16
test/tint/types/module_scope_const.wgsl.expected.spvasm
Normal file
16
test/tint/types/module_scope_const.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,16 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 5
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
21
test/tint/types/module_scope_const.wgsl.expected.wgsl
Normal file
21
test/tint/types/module_scope_const.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,21 @@
|
||||
const const_bool : bool = bool();
|
||||
|
||||
const const_i32 : i32 = i32();
|
||||
|
||||
const const_u32 : u32 = u32();
|
||||
|
||||
const const_f32 : f32 = f32();
|
||||
|
||||
const const_v2i32 : vec2<i32> = vec2<i32>();
|
||||
|
||||
const const_v3u32 : vec3<u32> = vec3<u32>();
|
||||
|
||||
const const_v4f32 : vec4<f32> = vec4<f32>();
|
||||
|
||||
const const_m3x4 : mat3x4<f32> = mat3x4<f32>();
|
||||
|
||||
const const_arr : array<f32, 4> = array<f32, 4>();
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
struct S {
|
||||
a : f32,
|
||||
};
|
||||
|
||||
let bool_let : bool = bool();
|
||||
let i32_let : i32 = i32();
|
||||
let u32_let : u32 = u32();
|
||||
let f32_let : f32 = f32();
|
||||
let v2i32_let : vec2<i32> = vec2<i32>();
|
||||
let v3u32_let : vec3<u32> = vec3<u32>();
|
||||
let v4f32_let : vec4<f32> = vec4<f32>();
|
||||
let m3x4_let : mat3x4<f32> = mat3x4<f32>();
|
||||
let arr_let : array<f32, 4> = array<f32, 4>();
|
||||
let struct_let : S = S();
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
struct S {
|
||||
float a;
|
||||
};
|
||||
|
||||
static const bool bool_let = false;
|
||||
static const int i32_let = 0;
|
||||
static const uint u32_let = 0u;
|
||||
static const float f32_let = 0.0f;
|
||||
static const int2 v2i32_let = (0).xx;
|
||||
static const uint3 v3u32_let = (0u).xxx;
|
||||
static const float4 v4f32_let = (0.0f).xxxx;
|
||||
static const float3x4 m3x4_let = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
|
||||
static const float arr_let[4] = (float[4])0;
|
||||
static const S struct_let = (S)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
return;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
float a;
|
||||
};
|
||||
|
||||
constant bool bool_let = false;
|
||||
|
||||
constant int i32_let = 0;
|
||||
|
||||
constant uint u32_let = 0u;
|
||||
|
||||
constant float f32_let = 0.0f;
|
||||
|
||||
constant int2 v2i32_let = int2(0);
|
||||
|
||||
constant uint3 v3u32_let = uint3(0u);
|
||||
|
||||
constant float4 v4f32_let = float4(0.0f);
|
||||
|
||||
constant float3x4 m3x4_let = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
|
||||
|
||||
constant tint_array<float, 4> arr_let = tint_array<float, 4>{};
|
||||
|
||||
constant S struct_let = {};
|
||||
|
||||
kernel void tint_symbol() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %bool_let "bool_let"
|
||||
OpName %i32_let "i32_let"
|
||||
OpName %u32_let "u32_let"
|
||||
OpName %f32_let "f32_let"
|
||||
OpName %v2i32_let "v2i32_let"
|
||||
OpName %v3u32_let "v3u32_let"
|
||||
OpName %v4f32_let "v4f32_let"
|
||||
OpName %m3x4_let "m3x4_let"
|
||||
OpName %arr_let "arr_let"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "a"
|
||||
OpName %struct_let "struct_let"
|
||||
OpName %main "main"
|
||||
OpDecorate %_arr_float_uint_4 ArrayStride 4
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
%bool = OpTypeBool
|
||||
%bool_let = OpConstantNull %bool
|
||||
%int = OpTypeInt 32 1
|
||||
%i32_let = OpConstantNull %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%u32_let = OpConstantNull %uint
|
||||
%float = OpTypeFloat 32
|
||||
%f32_let = OpConstantNull %float
|
||||
%v2int = OpTypeVector %int 2
|
||||
%v2i32_let = OpConstantNull %v2int
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%v3u32_let = OpConstantNull %v3uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%v4f32_let = OpConstantNull %v4float
|
||||
%mat3v4float = OpTypeMatrix %v4float 3
|
||||
%m3x4_let = OpConstantNull %mat3v4float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%arr_let = OpConstantNull %_arr_float_uint_4
|
||||
%S = OpTypeStruct %float
|
||||
%struct_let = OpConstantNull %S
|
||||
%void = OpTypeVoid
|
||||
%22 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %22
|
||||
%25 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -1,27 +0,0 @@
|
||||
struct S {
|
||||
a : f32,
|
||||
}
|
||||
|
||||
let bool_let : bool = bool();
|
||||
|
||||
let i32_let : i32 = i32();
|
||||
|
||||
let u32_let : u32 = u32();
|
||||
|
||||
let f32_let : f32 = f32();
|
||||
|
||||
let v2i32_let : vec2<i32> = vec2<i32>();
|
||||
|
||||
let v3u32_let : vec3<u32> = vec3<u32>();
|
||||
|
||||
let v4f32_let : vec4<f32> = vec4<f32>();
|
||||
|
||||
let m3x4_let : mat3x4<f32> = mat3x4<f32>();
|
||||
|
||||
let arr_let : array<f32, 4> = array<f32, 4>();
|
||||
|
||||
let struct_let : S = S();
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
}
|
||||
Reference in New Issue
Block a user