mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +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
21
test/tint/const/inferred/function.wgsl
Normal file
21
test/tint/const/inferred/function.wgsl
Normal file
@@ -0,0 +1,21 @@
|
||||
type MyArray = array<f32, 10>;
|
||||
|
||||
// Function-scope consts
|
||||
fn const_decls() {
|
||||
const v1 = 1;
|
||||
const v2 = 1u;
|
||||
const v3 = 1.0;
|
||||
|
||||
const v4 = vec3<i32>(1, 1, 1);
|
||||
const v5 = vec3<u32>(1u, 1u, 1u);
|
||||
const v6 = vec3<f32>(1.0, 1.0, 1.0);
|
||||
|
||||
const v7 = mat3x3<f32>(v6, v6, v6);
|
||||
|
||||
const v8 = MyArray();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main() -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(0.0,0.0,0.0,0.0);
|
||||
}
|
||||
13
test/tint/const/inferred/function.wgsl.expected.glsl
Normal file
13
test/tint/const/inferred/function.wgsl.expected.glsl
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) out vec4 value;
|
||||
vec4 tint_symbol() {
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 inner_result = tint_symbol();
|
||||
value = inner_result;
|
||||
return;
|
||||
}
|
||||
17
test/tint/const/inferred/function.wgsl.expected.hlsl
Normal file
17
test/tint/const/inferred/function.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,17 @@
|
||||
void const_decls() {
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main_inner() {
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol main() {
|
||||
const float4 inner_result = main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
21
test/tint/const/inferred/function.wgsl.expected.msl
Normal file
21
test/tint/const/inferred/function.wgsl.expected.msl
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void const_decls() {
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[color(0)]];
|
||||
};
|
||||
|
||||
float4 tint_symbol_inner() {
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol() {
|
||||
float4 const inner_result = tint_symbol_inner();
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
36
test/tint/const/inferred/function.wgsl.expected.spvasm
Normal file
36
test/tint/const/inferred/function.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,36 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 16
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %value
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %value "value"
|
||||
OpName %const_decls "const_decls"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %main "main"
|
||||
OpDecorate %value Location 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%10 = OpTypeFunction %v4float
|
||||
%const_decls = OpFunction %void None %6
|
||||
%9 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main_inner = OpFunction %v4float None %10
|
||||
%12 = OpLabel
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %6
|
||||
%14 = OpLabel
|
||||
%15 = OpFunctionCall %v4float %main_inner
|
||||
OpStore %value %15
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
17
test/tint/const/inferred/function.wgsl.expected.wgsl
Normal file
17
test/tint/const/inferred/function.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,17 @@
|
||||
type MyArray = array<f32, 10>;
|
||||
|
||||
fn const_decls() {
|
||||
const v1 = 1;
|
||||
const v2 = 1u;
|
||||
const v3 = 1.0;
|
||||
const v4 = vec3<i32>(1, 1, 1);
|
||||
const v5 = vec3<u32>(1u, 1u, 1u);
|
||||
const v6 = vec3<f32>(1.0, 1.0, 1.0);
|
||||
const v7 = mat3x3<f32>(v6, v6, v6);
|
||||
const v8 = MyArray();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main() -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
Reference in New Issue
Block a user