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

@@ -13,10 +13,9 @@
// limitations under the License.
// Vertex shader
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(0.0, 0.5),
vec2<f32>(-0.5, -0.5),
vec2<f32>(0.5, -0.5));
const pos = array<vec2<f32>, 3>(vec2(0.0, 0.5),
vec2(-0.5, -0.5),
vec2(0.5, -0.5));
@vertex
fn vtx_main(@builtin(vertex_index) VertexIndex : u32)

View File

@@ -1,8 +1,8 @@
#version 310 es
const vec2 pos[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f), vec2(0.5f, -0.5f));
vec4 vtx_main(uint VertexIndex) {
return vec4(pos[VertexIndex], 0.0f, 1.0f);
vec2 tint_symbol[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f), vec2(0.5f, -0.5f));
return vec4(tint_symbol[VertexIndex], 0.0f, 1.0f);
}
void main() {

View File

@@ -1,5 +1,3 @@
static const float2 pos[3] = {float2(0.0f, 0.5f), (-0.5f).xx, float2(0.5f, -0.5f)};
struct tint_symbol_1 {
uint VertexIndex : SV_VertexID;
};
@@ -8,7 +6,8 @@ struct tint_symbol_2 {
};
float4 vtx_main_inner(uint VertexIndex) {
return float4(pos[VertexIndex], 0.0f, 1.0f);
const float2 tint_symbol_4[3] = {float2(0.0f, 0.5f), (-0.5f).xx, float2(0.5f, -0.5f)};
return float4(tint_symbol_4[VertexIndex], 0.0f, 1.0f);
}
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {

View File

@@ -14,14 +14,13 @@ struct tint_array {
T elements[N];
};
constant tint_array<float2, 3> pos = tint_array<float2, 3>{float2(0.0f, 0.5f), float2(-0.5f), float2(0.5f, -0.5f)};
struct tint_symbol {
float4 value [[position]];
};
float4 vtx_main_inner(uint VertexIndex) {
return float4(pos[VertexIndex], 0.0f, 1.0f);
tint_array<float2, 3> const tint_symbol_2 = tint_array<float2, 3>{float2(0.0f, 0.5f), float2(-0.5f), float2(0.5f, -0.5f)};
return float4(tint_symbol_2[VertexIndex], 0.0f, 1.0f);
}
vertex tint_symbol vtx_main(uint VertexIndex [[vertex_id]]) {

View File

@@ -12,7 +12,6 @@
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %value_1 "value_1"
OpName %pos "pos"
OpName %vtx_main_inner "vtx_main_inner"
OpName %VertexIndex "VertexIndex"
OpName %var_for_index "var_for_index"
@@ -36,16 +35,16 @@
%11 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %11
%value_1 = OpVariable %_ptr_Output_v4float Output %8
%13 = OpTypeFunction %v4float %uint
%v2float = OpTypeVector %float 2
%uint_3 = OpConstant %uint 3
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
%float_0_5 = OpConstant %float 0.5
%17 = OpConstantComposite %v2float %11 %float_0_5
%21 = OpConstantComposite %v2float %11 %float_0_5
%float_n0_5 = OpConstant %float -0.5
%19 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
%20 = OpConstantComposite %v2float %float_0_5 %float_n0_5
%pos = OpConstantComposite %_arr_v2float_uint_3 %17 %19 %20
%22 = OpTypeFunction %v4float %uint
%23 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
%24 = OpConstantComposite %v2float %float_0_5 %float_n0_5
%25 = OpConstantComposite %_arr_v2float_uint_3 %21 %23 %24
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
%28 = OpConstantNull %_arr_v2float_uint_3
%_ptr_Function_v2float = OpTypePointer Function %v2float
@@ -54,11 +53,11 @@
%36 = OpTypeFunction %void
%42 = OpTypeFunction %v4float
%45 = OpConstantComposite %v4float %float_1 %11 %11 %float_1
%vtx_main_inner = OpFunction %v4float None %22
%vtx_main_inner = OpFunction %v4float None %13
%VertexIndex = OpFunctionParameter %uint
%25 = OpLabel
%16 = OpLabel
%var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %28
OpStore %var_for_index %pos
OpStore %var_for_index %25
%30 = OpAccessChain %_ptr_Function_v2float %var_for_index %VertexIndex
%31 = OpLoad %v2float %30
%32 = OpCompositeExtract %float %31 0

View File

@@ -1,4 +1,4 @@
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(0.0, 0.5), vec2<f32>(-0.5, -0.5), vec2<f32>(0.5, -0.5));
const pos = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5));
@vertex
fn vtx_main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4<f32> {