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:
Ben Clayton
2022-06-29 00:55:36 +00:00
committed by Dawn LUCI CQ
parent 03f88e6f49
commit c64ca23d94
224 changed files with 1443 additions and 2495 deletions

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
int f() {
int a[8] = int[8](1, 2, 3, 4, 5, 6, 7, 8);
return 2;
return a[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
int f() {
const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8};
return 2;
return a[1];
}

View File

@@ -16,6 +16,6 @@ struct tint_array {
int f() {
tint_array<int, 8> const a = tint_array<int, 8>{1, 2, 3, 4, 5, 6, 7, 8};
return 2;
return a[1];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -32,5 +32,6 @@
OpFunctionEnd
%f = OpFunction %int None %5
%8 = OpLabel
OpReturnValue %int_2
%21 = OpCompositeExtract %int %20 1
OpReturnValue %21
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
vec3 f() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
return vec3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
float3 f() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
return float3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -3,6 +3,6 @@
using namespace metal;
float3 f() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
return float3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 27
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -28,11 +28,14 @@
%float_9 = OpConstant %float 9
%22 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%23 = OpConstantComposite %mat3v3float %14 %18 %22
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %v3float None %5
%9 = OpLabel
OpReturnValue %18
%26 = OpCompositeExtract %v3float %23 1
OpReturnValue %26
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
float f() {
vec3 v = vec3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
float f() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -3,6 +3,6 @@
using namespace metal;
float f() {
float3 const v = float3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -18,11 +18,14 @@
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%13 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %float None %5
%8 = OpLabel
OpReturnValue %float_2
%16 = OpCompositeExtract %float %13 1
OpReturnValue %16
OpFunctionEnd