[transform] Rename generated variables.

This Cl prefixes the generated variable names from the vertex pulling
transform to prefix a '_' as you can not have an identifier in WGSL with
a leading '_'

Change-Id: Ic9ad873ac5f3ac25f96013f96e6d9a4c17964f22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28942
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
dan sinclair 2020-09-24 14:32:48 +00:00 committed by Commit Bot service account
parent 5c948e4f8f
commit 93801bebd1
2 changed files with 100 additions and 100 deletions

View File

@ -40,11 +40,11 @@ namespace transform {
namespace { namespace {
static const char kVertexBufferNamePrefix[] = "tint_pulling_vertex_buffer_"; static const char kVertexBufferNamePrefix[] = "_tint_pulling_vertex_buffer_";
static const char kStructBufferName[] = "data"; static const char kStructBufferName[] = "_tint_vertex_data";
static const char kPullingPosVarName[] = "tint_pulling_pos"; static const char kPullingPosVarName[] = "_tint_pulling_pos";
static const char kDefaultVertexIndexName[] = "tint_pulling_vertex_index"; static const char kDefaultVertexIndexName[] = "_tint_pulling_vertex_index";
static const char kDefaultInstanceIndexName[] = "tint_pulling_instance_index"; static const char kDefaultInstanceIndexName[] = "_tint_pulling_instance_index";
} // namespace } // namespace

View File

@ -145,7 +145,7 @@ TEST_F(VertexPullingTransformTest, OneAttribute) {
Decorations{ Decorations{
BuiltinDecoration{vertex_idx} BuiltinDecoration{vertex_idx}
} }
tint_pulling_vertex_index _tint_pulling_vertex_index
in in
__i32 __i32
} }
@ -154,7 +154,7 @@ TEST_F(VertexPullingTransformTest, OneAttribute) {
BindingDecoration{0} BindingDecoration{0}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_0 _tint_pulling_vertex_buffer_0
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -165,16 +165,16 @@ TEST_F(VertexPullingTransformTest, OneAttribute) {
Block{ Block{
VariableDeclStatement{ VariableDeclStatement{
Variable{ Variable{
tint_pulling_pos _tint_pulling_pos
function function
__i32 __i32
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -187,11 +187,11 @@ TEST_F(VertexPullingTransformTest, OneAttribute) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -226,7 +226,7 @@ TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
Decorations{ Decorations{
BuiltinDecoration{instance_idx} BuiltinDecoration{instance_idx}
} }
tint_pulling_instance_index _tint_pulling_instance_index
in in
__i32 __i32
} }
@ -235,7 +235,7 @@ TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
BindingDecoration{0} BindingDecoration{0}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_0 _tint_pulling_vertex_buffer_0
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -246,16 +246,16 @@ TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
Block{ Block{
VariableDeclStatement{ VariableDeclStatement{
Variable{ Variable{
tint_pulling_pos _tint_pulling_pos
function function
__i32 __i32
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_instance_index} Identifier{_tint_pulling_instance_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -268,11 +268,11 @@ TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -307,7 +307,7 @@ TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
Decorations{ Decorations{
BuiltinDecoration{vertex_idx} BuiltinDecoration{vertex_idx}
} }
tint_pulling_vertex_index _tint_pulling_vertex_index
in in
__i32 __i32
} }
@ -316,7 +316,7 @@ TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
BindingDecoration{0} BindingDecoration{0}
SetDecoration{5} SetDecoration{5}
} }
tint_pulling_vertex_buffer_0 _tint_pulling_vertex_buffer_0
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -327,16 +327,16 @@ TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
Block{ Block{
VariableDeclStatement{ VariableDeclStatement{
Variable{ Variable{
tint_pulling_pos _tint_pulling_pos
function function
__i32 __i32
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -349,11 +349,11 @@ TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -440,7 +440,7 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
BindingDecoration{0} BindingDecoration{0}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_0 _tint_pulling_vertex_buffer_0
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -449,7 +449,7 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
BindingDecoration{1} BindingDecoration{1}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_1 _tint_pulling_vertex_buffer_1
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -460,13 +460,13 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
Block{ Block{
VariableDeclStatement{ VariableDeclStatement{
Variable{ Variable{
tint_pulling_pos _tint_pulling_pos
function function
__i32 __i32
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{custom_vertex_index} Identifier{custom_vertex_index}
@ -482,11 +482,11 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -494,7 +494,7 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{custom_instance_index} Identifier{custom_instance_index}
@ -510,11 +510,11 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_1} Identifier{_tint_pulling_vertex_buffer_1}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -559,7 +559,7 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Decorations{ Decorations{
BuiltinDecoration{vertex_idx} BuiltinDecoration{vertex_idx}
} }
tint_pulling_vertex_index _tint_pulling_vertex_index
in in
__i32 __i32
} }
@ -568,7 +568,7 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
BindingDecoration{0} BindingDecoration{0}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_0 _tint_pulling_vertex_buffer_0
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -579,16 +579,16 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Block{ Block{
VariableDeclStatement{ VariableDeclStatement{
Variable{ Variable{
tint_pulling_pos _tint_pulling_pos
function function
__i32 __i32
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{16} ScalarConstructor{16}
} }
@ -601,11 +601,11 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -613,10 +613,10 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{16} ScalarConstructor{16}
} }
@ -631,12 +631,12 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor{0}
} }
@ -648,12 +648,12 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -665,12 +665,12 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{8} ScalarConstructor{8}
} }
@ -682,12 +682,12 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{12} ScalarConstructor{12}
} }
@ -745,7 +745,7 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Decorations{ Decorations{
BuiltinDecoration{vertex_idx} BuiltinDecoration{vertex_idx}
} }
tint_pulling_vertex_index _tint_pulling_vertex_index
in in
__i32 __i32
} }
@ -754,7 +754,7 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
BindingDecoration{0} BindingDecoration{0}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_0 _tint_pulling_vertex_buffer_0
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -763,7 +763,7 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
BindingDecoration{1} BindingDecoration{1}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_1 _tint_pulling_vertex_buffer_1
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -772,7 +772,7 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
BindingDecoration{2} BindingDecoration{2}
SetDecoration{4} SetDecoration{4}
} }
tint_pulling_vertex_buffer_2 _tint_pulling_vertex_buffer_2
storage_buffer storage_buffer
__struct_ __struct_
} }
@ -783,16 +783,16 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Block{ Block{
VariableDeclStatement{ VariableDeclStatement{
Variable{ Variable{
tint_pulling_pos _tint_pulling_pos
function function
__i32 __i32
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{8} ScalarConstructor{8}
} }
@ -807,12 +807,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor{0}
} }
@ -824,12 +824,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_0} Identifier{_tint_pulling_vertex_buffer_0}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -841,10 +841,10 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{12} ScalarConstructor{12}
} }
@ -859,12 +859,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_1} Identifier{_tint_pulling_vertex_buffer_1}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor{0}
} }
@ -876,12 +876,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_1} Identifier{_tint_pulling_vertex_buffer_1}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -893,12 +893,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_1} Identifier{_tint_pulling_vertex_buffer_1}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{8} ScalarConstructor{8}
} }
@ -910,10 +910,10 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
} }
} }
Assignment{ Assignment{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_vertex_index} Identifier{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{16} ScalarConstructor{16}
} }
@ -928,12 +928,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_2} Identifier{_tint_pulling_vertex_buffer_2}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor{0}
} }
@ -945,12 +945,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_2} Identifier{_tint_pulling_vertex_buffer_2}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor{4}
} }
@ -962,12 +962,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_2} Identifier{_tint_pulling_vertex_buffer_2}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{8} ScalarConstructor{8}
} }
@ -979,12 +979,12 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
Bitcast<__f32>{ Bitcast<__f32>{
ArrayAccessor{ ArrayAccessor{
MemberAccessor{ MemberAccessor{
Identifier{tint_pulling_vertex_buffer_2} Identifier{_tint_pulling_vertex_buffer_2}
Identifier{data} Identifier{_tint_vertex_data}
} }
Binary{ Binary{
Binary{ Binary{
Identifier{tint_pulling_pos} Identifier{_tint_pulling_pos}
add add
ScalarConstructor{12} ScalarConstructor{12}
} }