mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 10:51:35 +00:00
IntrinsicTable: remove double underscores
'__' is reserved in C++, and the 'match__' and 'build__' functions are causing OSS-fuzz builds to fail. Add the change in tint behavior to the OT notes. Add end to end tests for underscores. While the GLSL and MSL compilers seem to accept leading and double underscores in identifiers, the tint build failure has highlighted we have more work to do here (crbug.com/tint/1319) Fixed: oss-fuzz:41214 Bug: tint:1292 Bug: tint:1319 Change-Id: I32b7bf4e0cff26e678b788457f90452c2503da50 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70480 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
4183051b54
commit
177e7bfa5d
@ -9,6 +9,7 @@
|
|||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
* The `dot()` builtin now supports integer vector types.
|
* The `dot()` builtin now supports integer vector types.
|
||||||
|
* Identifiers can now start with a single leading underscore. [tint:1292](https://crbug.com/tint/1292)
|
||||||
|
|
||||||
## Changes for M97
|
## Changes for M97
|
||||||
|
|
||||||
@ -45,4 +46,4 @@
|
|||||||
|
|
||||||
* Hex floats: now correctly errors when the magnitude is non-zero, and the exponent would cause overflow. [tint:1150](https://crbug.com/tint/1150), [tint:1166](https://crbug.com/tint/1166)
|
* Hex floats: now correctly errors when the magnitude is non-zero, and the exponent would cause overflow. [tint:1150](https://crbug.com/tint/1150), [tint:1166](https://crbug.com/tint/1166)
|
||||||
* Identifiers beginning with an underscore are now correctly rejected. [tint:1179](https://crbug.com/tint/1179)
|
* Identifiers beginning with an underscore are now correctly rejected. [tint:1179](https://crbug.com/tint/1179)
|
||||||
* `abs()` fixed for unsigned integers on SPIR-V backend [tint:1179](https://crbug.com/tint/1194)
|
* `abs()` fixed for unsigned integers on SPIR-V backend
|
||||||
|
@ -657,20 +657,20 @@ const sem::ExternalTexture* build_texture_external(MatchState& state) {
|
|||||||
// Builtin types starting with a _ prefix cannot be declared in WGSL, so they
|
// Builtin types starting with a _ prefix cannot be declared in WGSL, so they
|
||||||
// can only be used as return types. Because of this, they must only match Any,
|
// can only be used as return types. Because of this, they must only match Any,
|
||||||
// which is used as the return type matcher.
|
// which is used as the return type matcher.
|
||||||
bool match__modf_result(const sem::Type* ty) {
|
bool match_modf_result(const sem::Type* ty) {
|
||||||
return ty->Is<Any>();
|
return ty->Is<Any>();
|
||||||
}
|
}
|
||||||
bool match__modf_result_vec(const sem::Type* ty, Number& N) {
|
bool match_modf_result_vec(const sem::Type* ty, Number& N) {
|
||||||
if (!ty->Is<Any>()) {
|
if (!ty->Is<Any>()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
N = Number::any;
|
N = Number::any;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool match__frexp_result(const sem::Type* ty) {
|
bool match_frexp_result(const sem::Type* ty) {
|
||||||
return ty->Is<Any>();
|
return ty->Is<Any>();
|
||||||
}
|
}
|
||||||
bool match__frexp_result_vec(const sem::Type* ty, Number& N) {
|
bool match_frexp_result_vec(const sem::Type* ty, Number& N) {
|
||||||
if (!ty->Is<Any>()) {
|
if (!ty->Is<Any>()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -715,22 +715,22 @@ const sem::Struct* build_struct(
|
|||||||
/* size_no_padding */ size_without_padding);
|
/* size_no_padding */ size_without_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
const sem::Struct* build__modf_result(MatchState& state) {
|
const sem::Struct* build_modf_result(MatchState& state) {
|
||||||
auto* f32 = state.builder.create<sem::F32>();
|
auto* f32 = state.builder.create<sem::F32>();
|
||||||
return build_struct(state, "__modf_result", {{"fract", f32}, {"whole", f32}});
|
return build_struct(state, "__modf_result", {{"fract", f32}, {"whole", f32}});
|
||||||
}
|
}
|
||||||
const sem::Struct* build__modf_result_vec(MatchState& state, Number& n) {
|
const sem::Struct* build_modf_result_vec(MatchState& state, Number& n) {
|
||||||
auto* vec_f32 = state.builder.create<sem::Vector>(
|
auto* vec_f32 = state.builder.create<sem::Vector>(
|
||||||
state.builder.create<sem::F32>(), n.Value());
|
state.builder.create<sem::F32>(), n.Value());
|
||||||
return build_struct(state, "__modf_result_vec" + std::to_string(n.Value()),
|
return build_struct(state, "__modf_result_vec" + std::to_string(n.Value()),
|
||||||
{{"fract", vec_f32}, {"whole", vec_f32}});
|
{{"fract", vec_f32}, {"whole", vec_f32}});
|
||||||
}
|
}
|
||||||
const sem::Struct* build__frexp_result(MatchState& state) {
|
const sem::Struct* build_frexp_result(MatchState& state) {
|
||||||
auto* f32 = state.builder.create<sem::F32>();
|
auto* f32 = state.builder.create<sem::F32>();
|
||||||
auto* i32 = state.builder.create<sem::I32>();
|
auto* i32 = state.builder.create<sem::I32>();
|
||||||
return build_struct(state, "__frexp_result", {{"sig", f32}, {"exp", i32}});
|
return build_struct(state, "__frexp_result", {{"sig", f32}, {"exp", i32}});
|
||||||
}
|
}
|
||||||
const sem::Struct* build__frexp_result_vec(MatchState& state, Number& n) {
|
const sem::Struct* build_frexp_result_vec(MatchState& state, Number& n) {
|
||||||
auto* vec_f32 = state.builder.create<sem::Vector>(
|
auto* vec_f32 = state.builder.create<sem::Vector>(
|
||||||
state.builder.create<sem::F32>(), n.Value());
|
state.builder.create<sem::F32>(), n.Value());
|
||||||
auto* vec_i32 = state.builder.create<sem::Vector>(
|
auto* vec_i32 = state.builder.create<sem::Vector>(
|
||||||
|
@ -1050,10 +1050,10 @@ class ModfResult : public TypeMatcher {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const sem::Type* ModfResult::Match(MatchState& state, const sem::Type* ty) const {
|
const sem::Type* ModfResult::Match(MatchState& state, const sem::Type* ty) const {
|
||||||
if (!match__modf_result(ty)) {
|
if (!match_modf_result(ty)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return build__modf_result(state);
|
return build_modf_result(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModfResult::String(MatchState&) const {
|
std::string ModfResult::String(MatchState&) const {
|
||||||
@ -1078,14 +1078,14 @@ class ModfResultVec : public TypeMatcher {
|
|||||||
|
|
||||||
const sem::Type* ModfResultVec::Match(MatchState& state, const sem::Type* ty) const {
|
const sem::Type* ModfResultVec::Match(MatchState& state, const sem::Type* ty) const {
|
||||||
Number N = Number::invalid;
|
Number N = Number::invalid;
|
||||||
if (!match__modf_result_vec(ty, N)) {
|
if (!match_modf_result_vec(ty, N)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
N = state.Num(N);
|
N = state.Num(N);
|
||||||
if (!N.IsValid()) {
|
if (!N.IsValid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return build__modf_result_vec(state, N);
|
return build_modf_result_vec(state, N);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModfResultVec::String(MatchState& state) const {
|
std::string ModfResultVec::String(MatchState& state) const {
|
||||||
@ -1112,10 +1112,10 @@ class FrexpResult : public TypeMatcher {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const sem::Type* FrexpResult::Match(MatchState& state, const sem::Type* ty) const {
|
const sem::Type* FrexpResult::Match(MatchState& state, const sem::Type* ty) const {
|
||||||
if (!match__frexp_result(ty)) {
|
if (!match_frexp_result(ty)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return build__frexp_result(state);
|
return build_frexp_result(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FrexpResult::String(MatchState&) const {
|
std::string FrexpResult::String(MatchState&) const {
|
||||||
@ -1140,14 +1140,14 @@ class FrexpResultVec : public TypeMatcher {
|
|||||||
|
|
||||||
const sem::Type* FrexpResultVec::Match(MatchState& state, const sem::Type* ty) const {
|
const sem::Type* FrexpResultVec::Match(MatchState& state, const sem::Type* ty) const {
|
||||||
Number N = Number::invalid;
|
Number N = Number::invalid;
|
||||||
if (!match__frexp_result_vec(ty, N)) {
|
if (!match_frexp_result_vec(ty, N)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
N = state.Num(N);
|
N = state.Num(N);
|
||||||
if (!N.IsValid()) {
|
if (!N.IsValid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return build__frexp_result_vec(state, N);
|
return build_frexp_result_vec(state, N);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FrexpResultVec::String(MatchState& state) const {
|
std::string FrexpResultVec::String(MatchState& state) const {
|
||||||
|
@ -148,7 +148,7 @@ const sem::Type* {{$class}}::Match(MatchState& state, const sem::Type* ty) const
|
|||||||
{{- range .TemplateParams }}
|
{{- range .TemplateParams }}
|
||||||
{{- template "DeclareLocalTemplateParam" . }}
|
{{- template "DeclareLocalTemplateParam" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
if (!match_{{TrimPrefix .Name "_"}}(ty{{range .TemplateParams}}, {{.GetName}}{{end}})) {
|
if (!match_{{TrimLeft .Name "_"}}(ty{{range .TemplateParams}}, {{.GetName}}{{end}})) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
{{- range .TemplateParams }}
|
{{- range .TemplateParams }}
|
||||||
@ -157,7 +157,7 @@ const sem::Type* {{$class}}::Match(MatchState& state, const sem::Type* ty) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
return build_{{TrimPrefix .Name "_"}}(state{{range .TemplateParams}}, {{.GetName}}{{end}});
|
return build_{{TrimLeft .Name "_"}}(state{{range .TemplateParams}}, {{.GetName}}{{end}});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string {{$class}}::String(MatchState&{{if .TemplateParams}} state{{end}}) const {
|
std::string {{$class}}::String(MatchState&{{if .TemplateParams}} state{{end}}) const {
|
||||||
|
9
test/identifiers/underscore/double/alias.wgsl
Normal file
9
test/identifiers/underscore/double/alias.wgsl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
type a = i32;
|
||||||
|
type a__ = i32;
|
||||||
|
type b = a;
|
||||||
|
type b__ = a__;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var c : b;
|
||||||
|
var d : b__;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int c = 0;
|
||||||
|
int d = 0;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int c = 0;
|
||||||
|
int d = 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 12
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %c "c"
|
||||||
|
OpName %d "d"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%_ptr_Function_int = OpTypePointer Function %int
|
||||||
|
%10 = OpConstantNull %int
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
%c = OpVariable %_ptr_Function_int Function %10
|
||||||
|
%d = OpVariable %_ptr_Function_int Function %10
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
12
test/identifiers/underscore/double/alias.wgsl.expected.wgsl
Normal file
12
test/identifiers/underscore/double/alias.wgsl.expected.wgsl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
type a = i32;
|
||||||
|
|
||||||
|
type a__ = i32;
|
||||||
|
|
||||||
|
type b = a;
|
||||||
|
|
||||||
|
type b__ = a__;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var c : b;
|
||||||
|
var d : b__;
|
||||||
|
}
|
5
test/identifiers/underscore/double/fn.wgsl
Normal file
5
test/identifiers/underscore/double/fn.wgsl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
fn a() {}
|
||||||
|
fn a__() {}
|
||||||
|
|
||||||
|
fn b() { a(); }
|
||||||
|
fn b__() { a__(); }
|
18
test/identifiers/underscore/double/fn.wgsl.expected.hlsl
Normal file
18
test/identifiers/underscore/double/fn.wgsl.expected.hlsl
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void a__() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void b() {
|
||||||
|
a();
|
||||||
|
}
|
||||||
|
|
||||||
|
void b__() {
|
||||||
|
a__();
|
||||||
|
}
|
17
test/identifiers/underscore/double/fn.wgsl.expected.msl
Normal file
17
test/identifiers/underscore/double/fn.wgsl.expected.msl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void a__() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void b() {
|
||||||
|
a();
|
||||||
|
}
|
||||||
|
|
||||||
|
void b__() {
|
||||||
|
a__();
|
||||||
|
}
|
||||||
|
|
38
test/identifiers/underscore/double/fn.wgsl.expected.spvasm
Normal file
38
test/identifiers/underscore/double/fn.wgsl.expected.spvasm
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 15
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %a "a"
|
||||||
|
OpName %a__ "a__"
|
||||||
|
OpName %b "b"
|
||||||
|
OpName %b__ "b__"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%a = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%a__ = OpFunction %void None %1
|
||||||
|
%8 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%b = OpFunction %void None %1
|
||||||
|
%10 = OpLabel
|
||||||
|
%11 = OpFunctionCall %void %a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%b__ = OpFunction %void None %1
|
||||||
|
%13 = OpLabel
|
||||||
|
%14 = OpFunctionCall %void %a__
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
13
test/identifiers/underscore/double/fn.wgsl.expected.wgsl
Normal file
13
test/identifiers/underscore/double/fn.wgsl.expected.wgsl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
fn a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn a__() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn b() {
|
||||||
|
a();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn b__() {
|
||||||
|
a__();
|
||||||
|
}
|
7
test/identifiers/underscore/double/let.wgsl
Normal file
7
test/identifiers/underscore/double/let.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
let a : i32 = 1;
|
||||||
|
let a__ : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let b = a;
|
||||||
|
let b__ = a__;
|
||||||
|
}
|
12
test/identifiers/underscore/double/let.wgsl.expected.hlsl
Normal file
12
test/identifiers/underscore/double/let.wgsl.expected.hlsl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int a = 1;
|
||||||
|
static const int a__ = 2;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
const int b = a;
|
||||||
|
const int b__ = a__;
|
||||||
|
}
|
10
test/identifiers/underscore/double/let.wgsl.expected.msl
Normal file
10
test/identifiers/underscore/double/let.wgsl.expected.msl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
constant int a = 1;
|
||||||
|
constant int a__ = 2;
|
||||||
|
void f() {
|
||||||
|
int const b = a;
|
||||||
|
int const b__ = a__;
|
||||||
|
}
|
||||||
|
|
26
test/identifiers/underscore/double/let.wgsl.expected.spvasm
Normal file
26
test/identifiers/underscore/double/let.wgsl.expected.spvasm
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 10
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %a "a"
|
||||||
|
OpName %a__ "a__"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%a = OpConstant %int 1
|
||||||
|
%a__ = OpConstant %int 2
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%4 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %4
|
||||||
|
%7 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %4
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,8 @@
|
|||||||
|
let a : i32 = 1;
|
||||||
|
|
||||||
|
let a__ : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let b = a;
|
||||||
|
let b__ = a__;
|
||||||
|
}
|
3
test/identifiers/underscore/double/parameter.wgsl
Normal file
3
test/identifiers/underscore/double/parameter.wgsl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn f(a__ : i32) {
|
||||||
|
let b = a__;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f(int a__) {
|
||||||
|
const int b = a__;
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void f(int a__) {
|
||||||
|
int const b = a__;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 10
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %a__ "a__"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%5 = OpTypeFunction %void %int
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %5
|
||||||
|
%a__ = OpFunctionParameter %int
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,3 @@
|
|||||||
|
fn f(a__ : i32) {
|
||||||
|
let b = a__;
|
||||||
|
}
|
10
test/identifiers/underscore/double/struct.wgsl
Normal file
10
test/identifiers/underscore/double/struct.wgsl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
struct a {
|
||||||
|
b : i32;
|
||||||
|
};
|
||||||
|
struct a__ {
|
||||||
|
b__ : i32;
|
||||||
|
};
|
||||||
|
fn f() {
|
||||||
|
let c = a__();
|
||||||
|
let d = c.b__;
|
||||||
|
}
|
13
test/identifiers/underscore/double/struct.wgsl.expected.hlsl
Normal file
13
test/identifiers/underscore/double/struct.wgsl.expected.hlsl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct a__ {
|
||||||
|
int b__;
|
||||||
|
};
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
const a__ c = (a__)0;
|
||||||
|
const int d = c.b__;
|
||||||
|
}
|
15
test/identifiers/underscore/double/struct.wgsl.expected.msl
Normal file
15
test/identifiers/underscore/double/struct.wgsl.expected.msl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
struct a {
|
||||||
|
int b;
|
||||||
|
};
|
||||||
|
struct a__ {
|
||||||
|
int b__;
|
||||||
|
};
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
a__ const c = {};
|
||||||
|
int const d = c.b__;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 11
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %a__ "a__"
|
||||||
|
OpMemberName %a__ 0 "b__"
|
||||||
|
OpMemberDecorate %a__ 0 Offset 0
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%a__ = OpTypeStruct %int
|
||||||
|
%9 = OpConstantNull %a__
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
%10 = OpCompositeExtract %int %9 0
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
12
test/identifiers/underscore/double/struct.wgsl.expected.wgsl
Normal file
12
test/identifiers/underscore/double/struct.wgsl.expected.wgsl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
struct a {
|
||||||
|
b : i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct a__ {
|
||||||
|
b__ : i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let c = a__();
|
||||||
|
let d = c.b__;
|
||||||
|
}
|
7
test/identifiers/underscore/double/var.wgsl
Normal file
7
test/identifiers/underscore/double/var.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var<private> a : i32 = 1;
|
||||||
|
var<private> a__ : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var b : i32 = a;
|
||||||
|
var b__ : i32 = a__;
|
||||||
|
}
|
12
test/identifiers/underscore/double/var.wgsl.expected.hlsl
Normal file
12
test/identifiers/underscore/double/var.wgsl.expected.hlsl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int a = 1;
|
||||||
|
static int a__ = 2;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int b = a;
|
||||||
|
int b__ = a__;
|
||||||
|
}
|
8
test/identifiers/underscore/double/var.wgsl.expected.msl
Normal file
8
test/identifiers/underscore/double/var.wgsl.expected.msl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void f(thread int* const tint_symbol, thread int* const tint_symbol_1) {
|
||||||
|
int b = *(tint_symbol);
|
||||||
|
int b__ = *(tint_symbol_1);
|
||||||
|
}
|
||||||
|
|
39
test/identifiers/underscore/double/var.wgsl.expected.spvasm
Normal file
39
test/identifiers/underscore/double/var.wgsl.expected.spvasm
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 19
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %a "a"
|
||||||
|
OpName %a__ "a__"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %b "b"
|
||||||
|
OpName %b__ "b__"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%int_1 = OpConstant %int 1
|
||||||
|
%_ptr_Private_int = OpTypePointer Private %int
|
||||||
|
%a = OpVariable %_ptr_Private_int Private %int_1
|
||||||
|
%int_2 = OpConstant %int 2
|
||||||
|
%a__ = OpVariable %_ptr_Private_int Private %int_2
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%7 = OpTypeFunction %void
|
||||||
|
%_ptr_Function_int = OpTypePointer Function %int
|
||||||
|
%16 = OpConstantNull %int
|
||||||
|
%unused_entry_point = OpFunction %void None %7
|
||||||
|
%10 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %7
|
||||||
|
%12 = OpLabel
|
||||||
|
%b = OpVariable %_ptr_Function_int Function %16
|
||||||
|
%b__ = OpVariable %_ptr_Function_int Function %16
|
||||||
|
%13 = OpLoad %int %a
|
||||||
|
OpStore %b %13
|
||||||
|
%17 = OpLoad %int %a__
|
||||||
|
OpStore %b__ %17
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,8 @@
|
|||||||
|
var<private> a : i32 = 1;
|
||||||
|
|
||||||
|
var<private> a__ : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var b : i32 = a;
|
||||||
|
var b__ : i32 = a__;
|
||||||
|
}
|
9
test/identifiers/underscore/prefix/lower/alias.wgsl
Normal file
9
test/identifiers/underscore/prefix/lower/alias.wgsl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
type a = i32;
|
||||||
|
type _a = i32;
|
||||||
|
type b = a;
|
||||||
|
type _b = _a;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var c : b;
|
||||||
|
var d : _b;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int c = 0;
|
||||||
|
int d = 0;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int c = 0;
|
||||||
|
int d = 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 12
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %c "c"
|
||||||
|
OpName %d "d"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%_ptr_Function_int = OpTypePointer Function %int
|
||||||
|
%10 = OpConstantNull %int
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
%c = OpVariable %_ptr_Function_int Function %10
|
||||||
|
%d = OpVariable %_ptr_Function_int Function %10
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,12 @@
|
|||||||
|
type a = i32;
|
||||||
|
|
||||||
|
type _a = i32;
|
||||||
|
|
||||||
|
type b = a;
|
||||||
|
|
||||||
|
type _b = _a;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var c : b;
|
||||||
|
var d : _b;
|
||||||
|
}
|
5
test/identifiers/underscore/prefix/lower/fn.wgsl
Normal file
5
test/identifiers/underscore/prefix/lower/fn.wgsl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
fn a() {}
|
||||||
|
fn _a() {}
|
||||||
|
|
||||||
|
fn b() { a(); }
|
||||||
|
fn _b() { _a(); }
|
@ -0,0 +1,18 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void _a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void b() {
|
||||||
|
a();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _b() {
|
||||||
|
_a();
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void _a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void b() {
|
||||||
|
a();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _b() {
|
||||||
|
_a();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 15
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %a "a"
|
||||||
|
OpName %_a "_a"
|
||||||
|
OpName %b "b"
|
||||||
|
OpName %_b "_b"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%a = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%_a = OpFunction %void None %1
|
||||||
|
%8 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%b = OpFunction %void None %1
|
||||||
|
%10 = OpLabel
|
||||||
|
%11 = OpFunctionCall %void %a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%_b = OpFunction %void None %1
|
||||||
|
%13 = OpLabel
|
||||||
|
%14 = OpFunctionCall %void %_a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,13 @@
|
|||||||
|
fn a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn b() {
|
||||||
|
a();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _b() {
|
||||||
|
_a();
|
||||||
|
}
|
7
test/identifiers/underscore/prefix/lower/let.wgsl
Normal file
7
test/identifiers/underscore/prefix/lower/let.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
let a : i32 = 1;
|
||||||
|
let _a : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let b = a;
|
||||||
|
let _b = _a;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int a = 1;
|
||||||
|
static const int _a = 2;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
const int b = a;
|
||||||
|
const int _b = _a;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
constant int a = 1;
|
||||||
|
constant int _a = 2;
|
||||||
|
void f() {
|
||||||
|
int const b = a;
|
||||||
|
int const _b = _a;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 10
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %a "a"
|
||||||
|
OpName %_a "_a"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%a = OpConstant %int 1
|
||||||
|
%_a = OpConstant %int 2
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%4 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %4
|
||||||
|
%7 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %4
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,8 @@
|
|||||||
|
let a : i32 = 1;
|
||||||
|
|
||||||
|
let _a : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let b = a;
|
||||||
|
let _b = _a;
|
||||||
|
}
|
3
test/identifiers/underscore/prefix/lower/parameter.wgsl
Normal file
3
test/identifiers/underscore/prefix/lower/parameter.wgsl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn f(_a : i32) {
|
||||||
|
let b = _a;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f(int _a) {
|
||||||
|
const int b = _a;
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void f(int _a) {
|
||||||
|
int const b = _a;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 10
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %_a "_a"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%5 = OpTypeFunction %void %int
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %5
|
||||||
|
%_a = OpFunctionParameter %int
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,3 @@
|
|||||||
|
fn f(_a : i32) {
|
||||||
|
let b = _a;
|
||||||
|
}
|
10
test/identifiers/underscore/prefix/lower/struct.wgsl
Normal file
10
test/identifiers/underscore/prefix/lower/struct.wgsl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
struct a {
|
||||||
|
b : i32;
|
||||||
|
};
|
||||||
|
struct _a {
|
||||||
|
_b : i32;
|
||||||
|
};
|
||||||
|
fn f() {
|
||||||
|
let c = _a();
|
||||||
|
let d = c._b;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct _a {
|
||||||
|
int _b;
|
||||||
|
};
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
const _a c = (_a)0;
|
||||||
|
const int d = c._b;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
struct a {
|
||||||
|
int b;
|
||||||
|
};
|
||||||
|
struct _a {
|
||||||
|
int _b;
|
||||||
|
};
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
_a const c = {};
|
||||||
|
int const d = c._b;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 11
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %_a "_a"
|
||||||
|
OpMemberName %_a 0 "_b"
|
||||||
|
OpMemberDecorate %_a 0 Offset 0
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%_a = OpTypeStruct %int
|
||||||
|
%9 = OpConstantNull %_a
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
%10 = OpCompositeExtract %int %9 0
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,12 @@
|
|||||||
|
struct a {
|
||||||
|
b : i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _a {
|
||||||
|
_b : i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let c = _a();
|
||||||
|
let d = c._b;
|
||||||
|
}
|
7
test/identifiers/underscore/prefix/lower/var.wgsl
Normal file
7
test/identifiers/underscore/prefix/lower/var.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var<private> a : i32 = 1;
|
||||||
|
var<private> _a : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var b : i32 = a;
|
||||||
|
var _b : i32 = _a;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int a = 1;
|
||||||
|
static int _a = 2;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int b = a;
|
||||||
|
int _b = _a;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void f(thread int* const tint_symbol, thread int* const tint_symbol_1) {
|
||||||
|
int b = *(tint_symbol);
|
||||||
|
int _b = *(tint_symbol_1);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 19
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %a "a"
|
||||||
|
OpName %_a "_a"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %b "b"
|
||||||
|
OpName %_b "_b"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%int_1 = OpConstant %int 1
|
||||||
|
%_ptr_Private_int = OpTypePointer Private %int
|
||||||
|
%a = OpVariable %_ptr_Private_int Private %int_1
|
||||||
|
%int_2 = OpConstant %int 2
|
||||||
|
%_a = OpVariable %_ptr_Private_int Private %int_2
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%7 = OpTypeFunction %void
|
||||||
|
%_ptr_Function_int = OpTypePointer Function %int
|
||||||
|
%16 = OpConstantNull %int
|
||||||
|
%unused_entry_point = OpFunction %void None %7
|
||||||
|
%10 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %7
|
||||||
|
%12 = OpLabel
|
||||||
|
%b = OpVariable %_ptr_Function_int Function %16
|
||||||
|
%_b = OpVariable %_ptr_Function_int Function %16
|
||||||
|
%13 = OpLoad %int %a
|
||||||
|
OpStore %b %13
|
||||||
|
%17 = OpLoad %int %_a
|
||||||
|
OpStore %_b %17
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,8 @@
|
|||||||
|
var<private> a : i32 = 1;
|
||||||
|
|
||||||
|
var<private> _a : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var b : i32 = a;
|
||||||
|
var _b : i32 = _a;
|
||||||
|
}
|
9
test/identifiers/underscore/prefix/upper/alias.wgsl
Normal file
9
test/identifiers/underscore/prefix/upper/alias.wgsl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
type A = i32;
|
||||||
|
type _A = i32;
|
||||||
|
type B = A;
|
||||||
|
type _B = _A;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var c : B;
|
||||||
|
var d : _B;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int c = 0;
|
||||||
|
int d = 0;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int c = 0;
|
||||||
|
int d = 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 12
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %c "c"
|
||||||
|
OpName %d "d"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%_ptr_Function_int = OpTypePointer Function %int
|
||||||
|
%10 = OpConstantNull %int
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
%c = OpVariable %_ptr_Function_int Function %10
|
||||||
|
%d = OpVariable %_ptr_Function_int Function %10
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,12 @@
|
|||||||
|
type A = i32;
|
||||||
|
|
||||||
|
type _A = i32;
|
||||||
|
|
||||||
|
type B = A;
|
||||||
|
|
||||||
|
type _B = _A;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var c : B;
|
||||||
|
var d : _B;
|
||||||
|
}
|
5
test/identifiers/underscore/prefix/upper/fn.wgsl
Normal file
5
test/identifiers/underscore/prefix/upper/fn.wgsl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
fn A() {}
|
||||||
|
fn _A() {}
|
||||||
|
|
||||||
|
fn B() { A(); }
|
||||||
|
fn _B() { _A(); }
|
@ -0,0 +1,18 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void _A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void B() {
|
||||||
|
A();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _B() {
|
||||||
|
_A();
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void _A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void B() {
|
||||||
|
A();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _B() {
|
||||||
|
_A();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 15
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %A "A"
|
||||||
|
OpName %_A "_A"
|
||||||
|
OpName %B "B"
|
||||||
|
OpName %_B "_B"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%A = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%_A = OpFunction %void None %1
|
||||||
|
%8 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%B = OpFunction %void None %1
|
||||||
|
%10 = OpLabel
|
||||||
|
%11 = OpFunctionCall %void %A
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%_B = OpFunction %void None %1
|
||||||
|
%13 = OpLabel
|
||||||
|
%14 = OpFunctionCall %void %_A
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,13 @@
|
|||||||
|
fn A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn B() {
|
||||||
|
A();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _B() {
|
||||||
|
_A();
|
||||||
|
}
|
7
test/identifiers/underscore/prefix/upper/let.wgsl
Normal file
7
test/identifiers/underscore/prefix/upper/let.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
let A : i32 = 1;
|
||||||
|
let _A : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let B = A;
|
||||||
|
let _B = _A;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int A = 1;
|
||||||
|
static const int _A = 2;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
const int B = A;
|
||||||
|
const int _B = _A;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
constant int A = 1;
|
||||||
|
constant int _A = 2;
|
||||||
|
void f() {
|
||||||
|
int const B = A;
|
||||||
|
int const _B = _A;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 10
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %A "A"
|
||||||
|
OpName %_A "_A"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%A = OpConstant %int 1
|
||||||
|
%_A = OpConstant %int 2
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%4 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %4
|
||||||
|
%7 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %4
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,8 @@
|
|||||||
|
let A : i32 = 1;
|
||||||
|
|
||||||
|
let _A : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let B = A;
|
||||||
|
let _B = _A;
|
||||||
|
}
|
3
test/identifiers/underscore/prefix/upper/parameter.wgsl
Normal file
3
test/identifiers/underscore/prefix/upper/parameter.wgsl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn f(_A : i32) {
|
||||||
|
let B = _A;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f(int _A) {
|
||||||
|
const int B = _A;
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void f(int _A) {
|
||||||
|
int const B = _A;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 10
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %_A "_A"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%5 = OpTypeFunction %void %int
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %5
|
||||||
|
%_A = OpFunctionParameter %int
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,3 @@
|
|||||||
|
fn f(_A : i32) {
|
||||||
|
let B = _A;
|
||||||
|
}
|
10
test/identifiers/underscore/prefix/upper/struct.wgsl
Normal file
10
test/identifiers/underscore/prefix/upper/struct.wgsl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
struct A {
|
||||||
|
B : i32;
|
||||||
|
};
|
||||||
|
struct _A {
|
||||||
|
_B : i32;
|
||||||
|
};
|
||||||
|
fn f() {
|
||||||
|
let c = _A();
|
||||||
|
let d = c._B;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct _A {
|
||||||
|
int _B;
|
||||||
|
};
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
const _A c = (_A)0;
|
||||||
|
const int d = c._B;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
struct A {
|
||||||
|
int B;
|
||||||
|
};
|
||||||
|
struct _A {
|
||||||
|
int _B;
|
||||||
|
};
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
_A const c = {};
|
||||||
|
int const d = c._B;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 11
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %_A "_A"
|
||||||
|
OpMemberName %_A 0 "_B"
|
||||||
|
OpMemberDecorate %_A 0 Offset 0
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%_A = OpTypeStruct %int
|
||||||
|
%9 = OpConstantNull %_A
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %1
|
||||||
|
%6 = OpLabel
|
||||||
|
%10 = OpCompositeExtract %int %9 0
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,12 @@
|
|||||||
|
struct A {
|
||||||
|
B : i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _A {
|
||||||
|
_B : i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let c = _A();
|
||||||
|
let d = c._B;
|
||||||
|
}
|
7
test/identifiers/underscore/prefix/upper/var.wgsl
Normal file
7
test/identifiers/underscore/prefix/upper/var.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var<private> A : i32 = 1;
|
||||||
|
var<private> _A : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var B : i32 = A;
|
||||||
|
var _B : i32 = _A;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int A = 1;
|
||||||
|
static int _A = 2;
|
||||||
|
|
||||||
|
void f() {
|
||||||
|
int B = A;
|
||||||
|
int _B = _A;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void f(thread int* const tint_symbol, thread int* const tint_symbol_1) {
|
||||||
|
int B = *(tint_symbol);
|
||||||
|
int _B = *(tint_symbol_1);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 19
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %A "A"
|
||||||
|
OpName %_A "_A"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %f "f"
|
||||||
|
OpName %B "B"
|
||||||
|
OpName %_B "_B"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%int_1 = OpConstant %int 1
|
||||||
|
%_ptr_Private_int = OpTypePointer Private %int
|
||||||
|
%A = OpVariable %_ptr_Private_int Private %int_1
|
||||||
|
%int_2 = OpConstant %int 2
|
||||||
|
%_A = OpVariable %_ptr_Private_int Private %int_2
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%7 = OpTypeFunction %void
|
||||||
|
%_ptr_Function_int = OpTypePointer Function %int
|
||||||
|
%16 = OpConstantNull %int
|
||||||
|
%unused_entry_point = OpFunction %void None %7
|
||||||
|
%10 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%f = OpFunction %void None %7
|
||||||
|
%12 = OpLabel
|
||||||
|
%B = OpVariable %_ptr_Function_int Function %16
|
||||||
|
%_B = OpVariable %_ptr_Function_int Function %16
|
||||||
|
%13 = OpLoad %int %A
|
||||||
|
OpStore %B %13
|
||||||
|
%17 = OpLoad %int %_A
|
||||||
|
OpStore %_B %17
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,8 @@
|
|||||||
|
var<private> A : i32 = 1;
|
||||||
|
|
||||||
|
var<private> _A : i32 = 2;
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
var B : i32 = A;
|
||||||
|
var _B : i32 = _A;
|
||||||
|
}
|
@ -60,6 +60,8 @@ func (g *generator) generate(tmpl string, w io.Writer, writeFile WriteFile) erro
|
|||||||
"HasSuffix": strings.HasSuffix,
|
"HasSuffix": strings.HasSuffix,
|
||||||
"TrimPrefix": strings.TrimPrefix,
|
"TrimPrefix": strings.TrimPrefix,
|
||||||
"TrimSuffix": strings.TrimSuffix,
|
"TrimSuffix": strings.TrimSuffix,
|
||||||
|
"TrimLeft": strings.TrimLeft,
|
||||||
|
"TrimRight": strings.TrimRight,
|
||||||
"IsEnumEntry": is(sem.EnumEntry{}),
|
"IsEnumEntry": is(sem.EnumEntry{}),
|
||||||
"IsEnumMatcher": is(sem.EnumMatcher{}),
|
"IsEnumMatcher": is(sem.EnumMatcher{}),
|
||||||
"IsFQN": is(sem.FullyQualifiedName{}),
|
"IsFQN": is(sem.FullyQualifiedName{}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user