wgsl-reader: reject identifiers starting with underscrore

Update one test to avoid this error.

Fixed: tint:1179
Change-Id: Id41b0eb0f404648de4e86a835fe43f1729cb4696
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64464
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
David Neto 2021-09-20 14:38:45 +00:00 committed by Tint LUCI CQ
parent 871570bc7b
commit ddc9eb2b85
9 changed files with 504 additions and 478 deletions

View File

@ -9,4 +9,5 @@
### Fixes
* Hex floats: issue an error when the magnitude is non-zero, and the exponent would cause
overflow. https://crbug.com/tint/1150 https://crbug.com/tint/1166
* Reject identifiers beginning with an underscore. https://crbug.com/tint/1179

View File

@ -119,15 +119,15 @@ bool Lexer::is_eof() const {
}
bool Lexer::is_alpha(char ch) const {
return std::isalpha(ch) || ch == '_';
return std::isalpha(ch);
}
bool Lexer::is_digit(char ch) const {
return std::isdigit(ch);
}
bool Lexer::is_alphanum(char ch) const {
return is_alpha(ch) || is_digit(ch);
bool Lexer::is_alphanum_underscore(char ch) const {
return is_alpha(ch) || is_digit(ch) || ch == '_';
}
bool Lexer::is_hex(char ch) const {
@ -660,7 +660,7 @@ Token Lexer::try_integer() {
}
Token Lexer::try_ident() {
// Must begin with an a-zA-Z_
// Must begin with an a-zA-Z
if (!is_alpha(content_->data[pos_])) {
return {};
}
@ -668,7 +668,7 @@ Token Lexer::try_ident() {
auto source = begin_source();
auto s = pos_;
while (!is_eof() && is_alphanum(content_->data[pos_])) {
while (!is_eof() && is_alphanum_underscore(content_->data[pos_])) {
pos_++;
location_.column++;
}

View File

@ -56,10 +56,19 @@ class Lexer {
void end_source(Source&) const;
bool is_eof() const;
/// @param ch a character
/// @returns true if 'ch' is an alphabetic character
bool is_alpha(char ch) const;
/// @param ch a character
/// @returns true if 'ch' is a decimal digit
bool is_digit(char ch) const;
/// @param ch a character
/// @returns true if 'ch' is a hexadecimal digit
bool is_hex(char ch) const;
bool is_alphanum(char ch) const;
/// @param ch a character
/// @returns true if 'ch' is a digit, an alphabetic character,
/// or an underscore.
bool is_alphanum_underscore(char ch) const;
bool matches(size_t pos, const std::string& substr);
/// The source file path

View File

@ -186,10 +186,26 @@ TEST_P(IdentifierTest, Parse) {
EXPECT_EQ(t.source().range.end.column, 1u + strlen(GetParam()));
EXPECT_EQ(t.to_str(), GetParam());
}
INSTANTIATE_TEST_SUITE_P(
LexerTest,
IdentifierTest,
testing::Values("test01", "_test_", "test_", "_test", "_01", "_test01"));
INSTANTIATE_TEST_SUITE_P(LexerTest,
IdentifierTest,
testing::Values("a",
"test",
"test01",
"test_",
"test_01",
"ALLCAPS",
"MiXeD_CaSe",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"alldigits_0123456789"));
TEST_F(LexerTest, IdentifierTest_DoesNotStartWithUnderscore) {
Source::FileContent content("_test");
Lexer l("test.wgsl", &content);
auto t = l.next();
EXPECT_FALSE(t.IsIdentifier());
}
TEST_F(LexerTest, IdentifierTest_DoesNotStartWithNumber) {
Source::FileContent content("01test");

View File

@ -57,40 +57,40 @@ fn Mat4x3GetCol0_(m: Mat4x3_) -> vec3<f32> {
var m1: Mat4x3_;
m1 = m;
let _e2: Mat4x3_ = m1;
let _e5: Mat4x3_ = m1;
let _e8: Mat4x3_ = m1;
return vec3<f32>(_e2.mx.x, _e5.my.x, _e8.mz.x);
let x_e2: Mat4x3_ = m1;
let x_e5: Mat4x3_ = m1;
let x_e8: Mat4x3_ = m1;
return vec3<f32>(x_e2.mx.x, x_e5.my.x, x_e8.mz.x);
}
fn Mat4x3GetCol1_(m2: Mat4x3_) -> vec3<f32> {
var m3: Mat4x3_;
m3 = m2;
let _e2: Mat4x3_ = m3;
let _e5: Mat4x3_ = m3;
let _e8: Mat4x3_ = m3;
return vec3<f32>(_e2.mx.y, _e5.my.y, _e8.mz.y);
let x_e2: Mat4x3_ = m3;
let x_e5: Mat4x3_ = m3;
let x_e8: Mat4x3_ = m3;
return vec3<f32>(x_e2.mx.y, x_e5.my.y, x_e8.mz.y);
}
fn Mat4x3GetCol2_(m4: Mat4x3_) -> vec3<f32> {
var m5: Mat4x3_;
m5 = m4;
let _e2: Mat4x3_ = m5;
let _e5: Mat4x3_ = m5;
let _e8: Mat4x3_ = m5;
return vec3<f32>(_e2.mx.z, _e5.my.z, _e8.mz.z);
let x_e2: Mat4x3_ = m5;
let x_e5: Mat4x3_ = m5;
let x_e8: Mat4x3_ = m5;
return vec3<f32>(x_e2.mx.z, x_e5.my.z, x_e8.mz.z);
}
fn Mat4x3GetCol3_(m6: Mat4x3_) -> vec3<f32> {
var m7: Mat4x3_;
m7 = m6;
let _e2: Mat4x3_ = m7;
let _e5: Mat4x3_ = m7;
let _e8: Mat4x3_ = m7;
return vec3<f32>(_e2.mx.w, _e5.my.w, _e8.mz.w);
let x_e2: Mat4x3_ = m7;
let x_e5: Mat4x3_ = m7;
let x_e8: Mat4x3_ = m7;
return vec3<f32>(x_e2.mx.w, x_e5.my.w, x_e8.mz.w);
}
fn Mul(m8: Mat4x4_, v: vec4<f32>) -> vec4<f32> {
@ -99,15 +99,15 @@ fn Mul(m8: Mat4x4_, v: vec4<f32>) -> vec4<f32> {
m9 = m8;
v1 = v;
let _e4: Mat4x4_ = m9;
let _e6: vec4<f32> = v1;
let _e8: Mat4x4_ = m9;
let _e10: vec4<f32> = v1;
let _e12: Mat4x4_ = m9;
let _e14: vec4<f32> = v1;
let _e16: Mat4x4_ = m9;
let _e18: vec4<f32> = v1;
return vec4<f32>(dot(_e4.mx, _e6), dot(_e8.my, _e10), dot(_e12.mz, _e14), dot(_e16.mw, _e18));
let x_e4: Mat4x4_ = m9;
let x_e6: vec4<f32> = v1;
let x_e8: Mat4x4_ = m9;
let x_e10: vec4<f32> = v1;
let x_e12: Mat4x4_ = m9;
let x_e14: vec4<f32> = v1;
let x_e16: Mat4x4_ = m9;
let x_e18: vec4<f32> = v1;
return vec4<f32>(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14), dot(x_e16.mw, x_e18));
}
fn Mul1(m10: Mat4x3_, v2: vec4<f32>) -> vec3<f32> {
@ -116,13 +116,13 @@ fn Mul1(m10: Mat4x3_, v2: vec4<f32>) -> vec3<f32> {
m11 = m10;
v3 = v2;
let _e4: Mat4x3_ = m11;
let _e6: vec4<f32> = v3;
let _e8: Mat4x3_ = m11;
let _e10: vec4<f32> = v3;
let _e12: Mat4x3_ = m11;
let _e14: vec4<f32> = v3;
return vec3<f32>(dot(_e4.mx, _e6), dot(_e8.my, _e10), dot(_e12.mz, _e14));
let x_e4: Mat4x3_ = m11;
let x_e6: vec4<f32> = v3;
let x_e8: Mat4x3_ = m11;
let x_e10: vec4<f32> = v3;
let x_e12: Mat4x3_ = m11;
let x_e14: vec4<f32> = v3;
return vec3<f32>(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14));
}
fn Mul2(m12: Mat4x2_, v4: vec4<f32>) -> vec2<f32> {
@ -131,11 +131,11 @@ fn Mul2(m12: Mat4x2_, v4: vec4<f32>) -> vec2<f32> {
m13 = m12;
v5 = v4;
let _e4: Mat4x2_ = m13;
let _e6: vec4<f32> = v5;
let _e8: Mat4x2_ = m13;
let _e10: vec4<f32> = v5;
return vec2<f32>(dot(_e4.mx, _e6), dot(_e8.my, _e10));
let x_e4: Mat4x2_ = m13;
let x_e6: vec4<f32> = v5;
let x_e8: Mat4x2_ = m13;
let x_e10: vec4<f32> = v5;
return vec2<f32>(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10));
}
fn Mul3(v6: vec3<f32>, m14: Mat4x3_) -> vec4<f32> {
@ -144,143 +144,143 @@ fn Mul3(v6: vec3<f32>, m14: Mat4x3_) -> vec4<f32> {
v7 = v6;
m15 = m14;
let _e5: Mat4x3_ = m15;
let _e6: vec3<f32> = Mat4x3GetCol0_(_e5);
let _e7: vec3<f32> = v7;
let _e10: Mat4x3_ = m15;
let _e11: vec3<f32> = Mat4x3GetCol1_(_e10);
let _e12: vec3<f32> = v7;
let _e15: Mat4x3_ = m15;
let _e16: vec3<f32> = Mat4x3GetCol2_(_e15);
let _e17: vec3<f32> = v7;
let _e20: Mat4x3_ = m15;
let _e21: vec3<f32> = Mat4x3GetCol3_(_e20);
let _e22: vec3<f32> = v7;
return vec4<f32>(dot(_e6, _e7), dot(_e11, _e12), dot(_e16, _e17), dot(_e21, _e22));
let x_e5: Mat4x3_ = m15;
let x_e6: vec3<f32> = Mat4x3GetCol0_(x_e5);
let x_e7: vec3<f32> = v7;
let x_e10: Mat4x3_ = m15;
let x_e11: vec3<f32> = Mat4x3GetCol1_(x_e10);
let x_e12: vec3<f32> = v7;
let x_e15: Mat4x3_ = m15;
let x_e16: vec3<f32> = Mat4x3GetCol2_(x_e15);
let x_e17: vec3<f32> = v7;
let x_e20: Mat4x3_ = m15;
let x_e21: vec3<f32> = Mat4x3GetCol3_(x_e20);
let x_e22: vec3<f32> = v7;
return vec4<f32>(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, x_e22));
}
fn _Mat4x4_(n: f32) -> Mat4x4_ {
fn x_Mat4x4_(n: f32) -> Mat4x4_ {
var n1: f32;
var o: Mat4x4_;
n1 = n;
let _e4: f32 = n1;
o.mx = vec4<f32>(_e4, 0.0, 0.0, 0.0);
let _e11: f32 = n1;
o.my = vec4<f32>(0.0, _e11, 0.0, 0.0);
let _e18: f32 = n1;
o.mz = vec4<f32>(0.0, 0.0, _e18, 0.0);
let _e25: f32 = n1;
o.mw = vec4<f32>(0.0, 0.0, 0.0, _e25);
let _e27: Mat4x4_ = o;
return _e27;
let x_e4: f32 = n1;
o.mx = vec4<f32>(x_e4, 0.0, 0.0, 0.0);
let x_e11: f32 = n1;
o.my = vec4<f32>(0.0, x_e11, 0.0, 0.0);
let x_e18: f32 = n1;
o.mz = vec4<f32>(0.0, 0.0, x_e18, 0.0);
let x_e25: f32 = n1;
o.mw = vec4<f32>(0.0, 0.0, 0.0, x_e25);
let x_e27: Mat4x4_ = o;
return x_e27;
}
fn _Mat4x4_1(m16: Mat4x3_) -> Mat4x4_ {
fn x_Mat4x4_1(m16: Mat4x3_) -> Mat4x4_ {
var m17: Mat4x3_;
var o1: Mat4x4_;
m17 = m16;
let _e4: Mat4x4_ = _Mat4x4_(1.0);
o1 = _e4;
let _e7: Mat4x3_ = m17;
o1.mx = _e7.mx;
let _e10: Mat4x3_ = m17;
o1.my = _e10.my;
let _e13: Mat4x3_ = m17;
o1.mz = _e13.mz;
let _e15: Mat4x4_ = o1;
return _e15;
let x_e4: Mat4x4_ = x_Mat4x4_(1.0);
o1 = x_e4;
let x_e7: Mat4x3_ = m17;
o1.mx = x_e7.mx;
let x_e10: Mat4x3_ = m17;
o1.my = x_e10.my;
let x_e13: Mat4x3_ = m17;
o1.mz = x_e13.mz;
let x_e15: Mat4x4_ = o1;
return x_e15;
}
fn _Mat4x4_2(m18: Mat4x2_) -> Mat4x4_ {
fn x_Mat4x4_2(m18: Mat4x2_) -> Mat4x4_ {
var m19: Mat4x2_;
var o2: Mat4x4_;
m19 = m18;
let _e4: Mat4x4_ = _Mat4x4_(1.0);
o2 = _e4;
let _e7: Mat4x2_ = m19;
o2.mx = _e7.mx;
let _e10: Mat4x2_ = m19;
o2.my = _e10.my;
let _e12: Mat4x4_ = o2;
return _e12;
let x_e4: Mat4x4_ = x_Mat4x4_(1.0);
o2 = x_e4;
let x_e7: Mat4x2_ = m19;
o2.mx = x_e7.mx;
let x_e10: Mat4x2_ = m19;
o2.my = x_e10.my;
let x_e12: Mat4x4_ = o2;
return x_e12;
}
fn _Mat4x3_(n2: f32) -> Mat4x3_ {
fn x_Mat4x3_(n2: f32) -> Mat4x3_ {
var n3: f32;
var o3: Mat4x3_;
n3 = n2;
let _e4: f32 = n3;
o3.mx = vec4<f32>(_e4, 0.0, 0.0, 0.0);
let _e11: f32 = n3;
o3.my = vec4<f32>(0.0, _e11, 0.0, 0.0);
let _e18: f32 = n3;
o3.mz = vec4<f32>(0.0, 0.0, _e18, 0.0);
let _e21: Mat4x3_ = o3;
return _e21;
let x_e4: f32 = n3;
o3.mx = vec4<f32>(x_e4, 0.0, 0.0, 0.0);
let x_e11: f32 = n3;
o3.my = vec4<f32>(0.0, x_e11, 0.0, 0.0);
let x_e18: f32 = n3;
o3.mz = vec4<f32>(0.0, 0.0, x_e18, 0.0);
let x_e21: Mat4x3_ = o3;
return x_e21;
}
fn _Mat4x3_1(m20: Mat4x4_) -> Mat4x3_ {
fn x_Mat4x3_1(m20: Mat4x4_) -> Mat4x3_ {
var m21: Mat4x4_;
var o4: Mat4x3_;
m21 = m20;
let _e4: Mat4x4_ = m21;
o4.mx = _e4.mx;
let _e7: Mat4x4_ = m21;
o4.my = _e7.my;
let _e10: Mat4x4_ = m21;
o4.mz = _e10.mz;
let _e12: Mat4x3_ = o4;
return _e12;
let x_e4: Mat4x4_ = m21;
o4.mx = x_e4.mx;
let x_e7: Mat4x4_ = m21;
o4.my = x_e7.my;
let x_e10: Mat4x4_ = m21;
o4.mz = x_e10.mz;
let x_e12: Mat4x3_ = o4;
return x_e12;
}
fn main1() {
var t_PosMtx: Mat4x3_;
var t_TexSpaceCoord: vec2<f32>;
let _e15: f32 = a_PosMtxIdx1;
let _e18: Mat4x3_ = global2.u_PosMtx[i32(_e15)];
t_PosMtx = _e18;
let _e23: Mat4x3_ = t_PosMtx;
let _e24: Mat4x4_ = _Mat4x4_1(_e23);
let _e25: vec3<f32> = a_Position1;
let _e29: Mat4x3_ = t_PosMtx;
let _e30: Mat4x4_ = _Mat4x4_1(_e29);
let _e31: vec3<f32> = a_Position1;
let _e34: vec4<f32> = Mul(_e30, vec4<f32>(_e31, 1.0));
let _e35: Mat4x4_ = global.u_Projection;
let _e37: Mat4x3_ = t_PosMtx;
let _e38: Mat4x4_ = _Mat4x4_1(_e37);
let _e39: vec3<f32> = a_Position1;
let _e43: Mat4x3_ = t_PosMtx;
let _e44: Mat4x4_ = _Mat4x4_1(_e43);
let _e45: vec3<f32> = a_Position1;
let _e48: vec4<f32> = Mul(_e44, vec4<f32>(_e45, 1.0));
let _e49: vec4<f32> = Mul(_e35, _e48);
gl_Position = _e49;
let _e50: vec4<f32> = a_Color1;
v_Color = _e50;
let _e52: vec4<f32> = global1.u_Misc0_;
if ((_e52.x == 2.0)) {
let x_e15: f32 = a_PosMtxIdx1;
let x_e18: Mat4x3_ = global2.u_PosMtx[i32(x_e15)];
t_PosMtx = x_e18;
let x_e23: Mat4x3_ = t_PosMtx;
let x_e24: Mat4x4_ = x_Mat4x4_1(x_e23);
let x_e25: vec3<f32> = a_Position1;
let x_e29: Mat4x3_ = t_PosMtx;
let x_e30: Mat4x4_ = x_Mat4x4_1(x_e29);
let x_e31: vec3<f32> = a_Position1;
let x_e34: vec4<f32> = Mul(x_e30, vec4<f32>(x_e31, 1.0));
let x_e35: Mat4x4_ = global.u_Projection;
let x_e37: Mat4x3_ = t_PosMtx;
let x_e38: Mat4x4_ = x_Mat4x4_1(x_e37);
let x_e39: vec3<f32> = a_Position1;
let x_e43: Mat4x3_ = t_PosMtx;
let x_e44: Mat4x4_ = x_Mat4x4_1(x_e43);
let x_e45: vec3<f32> = a_Position1;
let x_e48: vec4<f32> = Mul(x_e44, vec4<f32>(x_e45, 1.0));
let x_e49: vec4<f32> = Mul(x_e35, x_e48);
gl_Position = x_e49;
let x_e50: vec4<f32> = a_Color1;
v_Color = x_e50;
let x_e52: vec4<f32> = global1.u_Misc0_;
if ((x_e52.x == 2.0)) {
{
let _e59: vec3<f32> = a_Normal1;
let _e64: Mat4x2_ = global1.u_TexMtx[0];
let _e65: vec3<f32> = a_Normal1;
let _e68: vec2<f32> = Mul2(_e64, vec4<f32>(_e65, 1.0));
v_TexCoord = _e68.xy;
let x_e59: vec3<f32> = a_Normal1;
let x_e64: Mat4x2_ = global1.u_TexMtx[0];
let x_e65: vec3<f32> = a_Normal1;
let x_e68: vec2<f32> = Mul2(x_e64, vec4<f32>(x_e65, 1.0));
v_TexCoord = x_e68.xy;
return;
}
} else {
{
let _e73: vec2<f32> = a_UV1;
let _e79: Mat4x2_ = global1.u_TexMtx[0];
let _e80: vec2<f32> = a_UV1;
let _e84: vec2<f32> = Mul2(_e79, vec4<f32>(_e80, 1.0, 1.0));
v_TexCoord = _e84.xy;
let x_e73: vec2<f32> = a_UV1;
let x_e79: Mat4x2_ = global1.u_TexMtx[0];
let x_e80: vec2<f32> = a_UV1;
let x_e84: vec2<f32> = Mul2(x_e79, vec4<f32>(x_e80, 1.0, 1.0));
v_TexCoord = x_e84.xy;
return;
}
}
@ -294,8 +294,8 @@ fn main([[location(0)]] a_Position: vec3<f32>, [[location(1)]] a_UV: vec2<f32>,
a_Normal1 = a_Normal;
a_PosMtxIdx1 = a_PosMtxIdx;
main1();
let _e11: vec4<f32> = v_Color;
let _e13: vec2<f32> = v_TexCoord;
let _e15: vec4<f32> = gl_Position;
return VertexOutput(_e11, _e13, _e15);
}
let x_e11: vec4<f32> = v_Color;
let x_e13: vec2<f32> = v_TexCoord;
let x_e15: vec4<f32> = gl_Position;
return VertexOutput(x_e11, x_e13, x_e15);
}

View File

@ -90,17 +90,17 @@ float4 Mul3(float3 v6, Mat4x3_ m14) {
Mat4x3_ m15 = (Mat4x3_)0;
v7 = v6;
m15 = m14;
const float3 _e6 = Mat4x3GetCol0_(m15);
const float3 _e7 = v7;
const float3 _e11 = Mat4x3GetCol1_(m15);
const float3 _e12 = v7;
const float3 _e16 = Mat4x3GetCol2_(m15);
const float3 _e17 = v7;
const float3 _e21 = Mat4x3GetCol3_(m15);
return float4(dot(_e6, _e7), dot(_e11, _e12), dot(_e16, _e17), dot(_e21, v7));
const float3 x_e6 = Mat4x3GetCol0_(m15);
const float3 x_e7 = v7;
const float3 x_e11 = Mat4x3GetCol1_(m15);
const float3 x_e12 = v7;
const float3 x_e16 = Mat4x3GetCol2_(m15);
const float3 x_e17 = v7;
const float3 x_e21 = Mat4x3GetCol3_(m15);
return float4(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, v7));
}
Mat4x4_ _Mat4x4_(float n) {
Mat4x4_ x_Mat4x4_(float n) {
float n1 = 0.0f;
Mat4x4_ o = (Mat4x4_)0;
n1 = n;
@ -111,30 +111,30 @@ Mat4x4_ _Mat4x4_(float n) {
return o;
}
Mat4x4_ _Mat4x4_1(Mat4x3_ m16) {
Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) {
Mat4x3_ m17 = (Mat4x3_)0;
Mat4x4_ o1 = (Mat4x4_)0;
m17 = m16;
const Mat4x4_ _e4 = _Mat4x4_(1.0f);
o1 = _e4;
const Mat4x4_ x_e4 = x_Mat4x4_(1.0f);
o1 = x_e4;
o1.mx = m17.mx;
o1.my = m17.my;
o1.mz = m17.mz;
return o1;
}
Mat4x4_ _Mat4x4_2(Mat4x2_ m18) {
Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) {
Mat4x2_ m19 = (Mat4x2_)0;
Mat4x4_ o2 = (Mat4x4_)0;
m19 = m18;
const Mat4x4_ _e4 = _Mat4x4_(1.0f);
o2 = _e4;
const Mat4x4_ x_e4 = x_Mat4x4_(1.0f);
o2 = x_e4;
o2.mx = m19.mx;
o2.my = m19.my;
return o2;
}
Mat4x3_ _Mat4x3_(float n2) {
Mat4x3_ x_Mat4x3_(float n2) {
float n3 = 0.0f;
Mat4x3_ o3 = (Mat4x3_)0;
n3 = n2;
@ -144,7 +144,7 @@ Mat4x3_ _Mat4x3_(float n2) {
return o3;
}
Mat4x3_ _Mat4x3_1(Mat4x4_ m20) {
Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) {
Mat4x4_ m21 = (Mat4x4_)0;
Mat4x3_ o4 = (Mat4x3_)0;
m21 = m20;
@ -181,35 +181,35 @@ Mat4x2_ tint_symbol_8(uint4 buffer[3], uint offset) {
void main1() {
Mat4x3_ t_PosMtx = (Mat4x3_)0;
float2 t_TexSpaceCoord = float2(0.0f, 0.0f);
const Mat4x3_ _e18 = tint_symbol_3(global2, (48u * uint(int(a_PosMtxIdx1))));
t_PosMtx = _e18;
const Mat4x4_ _e24 = _Mat4x4_1(t_PosMtx);
const float3 _e25 = a_Position1;
const Mat4x4_ _e30 = _Mat4x4_1(t_PosMtx);
const float4 _e34 = Mul(_e30, float4(a_Position1, 1.0f));
const Mat4x4_ _e35 = tint_symbol_5(global, 0u);
const Mat4x4_ _e38 = _Mat4x4_1(t_PosMtx);
const float3 _e39 = a_Position1;
const Mat4x4_ _e44 = _Mat4x4_1(t_PosMtx);
const float4 _e48 = Mul(_e44, float4(a_Position1, 1.0f));
const float4 _e49 = Mul(_e35, _e48);
gl_Position = _e49;
const Mat4x3_ x_e18 = tint_symbol_3(global2, (48u * uint(int(a_PosMtxIdx1))));
t_PosMtx = x_e18;
const Mat4x4_ x_e24 = x_Mat4x4_1(t_PosMtx);
const float3 x_e25 = a_Position1;
const Mat4x4_ x_e30 = x_Mat4x4_1(t_PosMtx);
const float4 x_e34 = Mul(x_e30, float4(a_Position1, 1.0f));
const Mat4x4_ x_e35 = tint_symbol_5(global, 0u);
const Mat4x4_ x_e38 = x_Mat4x4_1(t_PosMtx);
const float3 x_e39 = a_Position1;
const Mat4x4_ x_e44 = x_Mat4x4_1(t_PosMtx);
const float4 x_e48 = Mul(x_e44, float4(a_Position1, 1.0f));
const float4 x_e49 = Mul(x_e35, x_e48);
gl_Position = x_e49;
v_Color = a_Color1;
const float4 _e52 = asfloat(global1[2]);
if ((_e52.x == 2.0f)) {
const float4 x_e52 = asfloat(global1[2]);
if ((x_e52.x == 2.0f)) {
{
const float3 _e59 = a_Normal1;
const Mat4x2_ _e64 = tint_symbol_8(global1, (32u * uint(0)));
const float2 _e68 = Mul2(_e64, float4(a_Normal1, 1.0f));
v_TexCoord = _e68.xy;
const float3 x_e59 = a_Normal1;
const Mat4x2_ x_e64 = tint_symbol_8(global1, (32u * uint(0)));
const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f));
v_TexCoord = x_e68.xy;
return;
}
} else {
{
const float2 _e73 = a_UV1;
const Mat4x2_ _e79 = tint_symbol_8(global1, (32u * uint(0)));
const float2 _e84 = Mul2(_e79, float4(a_UV1, 1.0f, 1.0f));
v_TexCoord = _e84.xy;
const float2 x_e73 = a_UV1;
const Mat4x2_ x_e79 = tint_symbol_8(global1, (32u * uint(0)));
const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f));
v_TexCoord = x_e84.xy;
return;
}
}

View File

@ -53,37 +53,37 @@ struct tint_symbol_3 {
float3 Mat4x3GetCol0_(Mat4x3_ m) {
Mat4x3_ m1 = {};
m1 = m;
Mat4x3_ const _e2 = m1;
Mat4x3_ const _e5 = m1;
Mat4x3_ const _e8 = m1;
return float3(_e2.mx.x, _e5.my.x, _e8.mz.x);
Mat4x3_ const x_e2 = m1;
Mat4x3_ const x_e5 = m1;
Mat4x3_ const x_e8 = m1;
return float3(x_e2.mx.x, x_e5.my.x, x_e8.mz.x);
}
float3 Mat4x3GetCol1_(Mat4x3_ m2) {
Mat4x3_ m3 = {};
m3 = m2;
Mat4x3_ const _e2 = m3;
Mat4x3_ const _e5 = m3;
Mat4x3_ const _e8 = m3;
return float3(_e2.mx.y, _e5.my.y, _e8.mz.y);
Mat4x3_ const x_e2 = m3;
Mat4x3_ const x_e5 = m3;
Mat4x3_ const x_e8 = m3;
return float3(x_e2.mx.y, x_e5.my.y, x_e8.mz.y);
}
float3 Mat4x3GetCol2_(Mat4x3_ m4) {
Mat4x3_ m5 = {};
m5 = m4;
Mat4x3_ const _e2 = m5;
Mat4x3_ const _e5 = m5;
Mat4x3_ const _e8 = m5;
return float3(_e2.mx.z, _e5.my.z, _e8.mz.z);
Mat4x3_ const x_e2 = m5;
Mat4x3_ const x_e5 = m5;
Mat4x3_ const x_e8 = m5;
return float3(x_e2.mx.z, x_e5.my.z, x_e8.mz.z);
}
float3 Mat4x3GetCol3_(Mat4x3_ m6) {
Mat4x3_ m7 = {};
m7 = m6;
Mat4x3_ const _e2 = m7;
Mat4x3_ const _e5 = m7;
Mat4x3_ const _e8 = m7;
return float3(_e2.mx.w, _e5.my.w, _e8.mz.w);
Mat4x3_ const x_e2 = m7;
Mat4x3_ const x_e5 = m7;
Mat4x3_ const x_e8 = m7;
return float3(x_e2.mx.w, x_e5.my.w, x_e8.mz.w);
}
float4 Mul(Mat4x4_ m8, float4 v) {
@ -91,15 +91,15 @@ float4 Mul(Mat4x4_ m8, float4 v) {
float4 v1 = 0.0f;
m9 = m8;
v1 = v;
Mat4x4_ const _e4 = m9;
float4 const _e6 = v1;
Mat4x4_ const _e8 = m9;
float4 const _e10 = v1;
Mat4x4_ const _e12 = m9;
float4 const _e14 = v1;
Mat4x4_ const _e16 = m9;
float4 const _e18 = v1;
return float4(dot(_e4.mx, _e6), dot(_e8.my, _e10), dot(_e12.mz, _e14), dot(_e16.mw, _e18));
Mat4x4_ const x_e4 = m9;
float4 const x_e6 = v1;
Mat4x4_ const x_e8 = m9;
float4 const x_e10 = v1;
Mat4x4_ const x_e12 = m9;
float4 const x_e14 = v1;
Mat4x4_ const x_e16 = m9;
float4 const x_e18 = v1;
return float4(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14), dot(x_e16.mw, x_e18));
}
float3 Mul1(Mat4x3_ m10, float4 v2) {
@ -107,13 +107,13 @@ float3 Mul1(Mat4x3_ m10, float4 v2) {
float4 v3 = 0.0f;
m11 = m10;
v3 = v2;
Mat4x3_ const _e4 = m11;
float4 const _e6 = v3;
Mat4x3_ const _e8 = m11;
float4 const _e10 = v3;
Mat4x3_ const _e12 = m11;
float4 const _e14 = v3;
return float3(dot(_e4.mx, _e6), dot(_e8.my, _e10), dot(_e12.mz, _e14));
Mat4x3_ const x_e4 = m11;
float4 const x_e6 = v3;
Mat4x3_ const x_e8 = m11;
float4 const x_e10 = v3;
Mat4x3_ const x_e12 = m11;
float4 const x_e14 = v3;
return float3(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14));
}
float2 Mul2(Mat4x2_ m12, float4 v4) {
@ -121,11 +121,11 @@ float2 Mul2(Mat4x2_ m12, float4 v4) {
float4 v5 = 0.0f;
m13 = m12;
v5 = v4;
Mat4x2_ const _e4 = m13;
float4 const _e6 = v5;
Mat4x2_ const _e8 = m13;
float4 const _e10 = v5;
return float2(dot(_e4.mx, _e6), dot(_e8.my, _e10));
Mat4x2_ const x_e4 = m13;
float4 const x_e6 = v5;
Mat4x2_ const x_e8 = m13;
float4 const x_e10 = v5;
return float2(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10));
}
float4 Mul3(float3 v6, Mat4x3_ m14) {
@ -133,137 +133,137 @@ float4 Mul3(float3 v6, Mat4x3_ m14) {
Mat4x3_ m15 = {};
v7 = v6;
m15 = m14;
Mat4x3_ const _e5 = m15;
float3 const _e6 = Mat4x3GetCol0_(_e5);
float3 const _e7 = v7;
Mat4x3_ const _e10 = m15;
float3 const _e11 = Mat4x3GetCol1_(_e10);
float3 const _e12 = v7;
Mat4x3_ const _e15 = m15;
float3 const _e16 = Mat4x3GetCol2_(_e15);
float3 const _e17 = v7;
Mat4x3_ const _e20 = m15;
float3 const _e21 = Mat4x3GetCol3_(_e20);
float3 const _e22 = v7;
return float4(dot(_e6, _e7), dot(_e11, _e12), dot(_e16, _e17), dot(_e21, _e22));
Mat4x3_ const x_e5 = m15;
float3 const x_e6 = Mat4x3GetCol0_(x_e5);
float3 const x_e7 = v7;
Mat4x3_ const x_e10 = m15;
float3 const x_e11 = Mat4x3GetCol1_(x_e10);
float3 const x_e12 = v7;
Mat4x3_ const x_e15 = m15;
float3 const x_e16 = Mat4x3GetCol2_(x_e15);
float3 const x_e17 = v7;
Mat4x3_ const x_e20 = m15;
float3 const x_e21 = Mat4x3GetCol3_(x_e20);
float3 const x_e22 = v7;
return float4(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, x_e22));
}
Mat4x4_ _Mat4x4_(float n) {
Mat4x4_ x_Mat4x4_(float n) {
float n1 = 0.0f;
Mat4x4_ o = {};
n1 = n;
float const _e4 = n1;
o.mx = float4(_e4, 0.0f, 0.0f, 0.0f);
float const _e11 = n1;
o.my = float4(0.0f, _e11, 0.0f, 0.0f);
float const _e18 = n1;
o.mz = float4(0.0f, 0.0f, _e18, 0.0f);
float const _e25 = n1;
o.mw = float4(0.0f, 0.0f, 0.0f, _e25);
Mat4x4_ const _e27 = o;
return _e27;
float const x_e4 = n1;
o.mx = float4(x_e4, 0.0f, 0.0f, 0.0f);
float const x_e11 = n1;
o.my = float4(0.0f, x_e11, 0.0f, 0.0f);
float const x_e18 = n1;
o.mz = float4(0.0f, 0.0f, x_e18, 0.0f);
float const x_e25 = n1;
o.mw = float4(0.0f, 0.0f, 0.0f, x_e25);
Mat4x4_ const x_e27 = o;
return x_e27;
}
Mat4x4_ _Mat4x4_1(Mat4x3_ m16) {
Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) {
Mat4x3_ m17 = {};
Mat4x4_ o1 = {};
m17 = m16;
Mat4x4_ const _e4 = _Mat4x4_(1.0f);
o1 = _e4;
Mat4x3_ const _e7 = m17;
o1.mx = _e7.mx;
Mat4x3_ const _e10 = m17;
o1.my = _e10.my;
Mat4x3_ const _e13 = m17;
o1.mz = _e13.mz;
Mat4x4_ const _e15 = o1;
return _e15;
Mat4x4_ const x_e4 = x_Mat4x4_(1.0f);
o1 = x_e4;
Mat4x3_ const x_e7 = m17;
o1.mx = x_e7.mx;
Mat4x3_ const x_e10 = m17;
o1.my = x_e10.my;
Mat4x3_ const x_e13 = m17;
o1.mz = x_e13.mz;
Mat4x4_ const x_e15 = o1;
return x_e15;
}
Mat4x4_ _Mat4x4_2(Mat4x2_ m18) {
Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) {
Mat4x2_ m19 = {};
Mat4x4_ o2 = {};
m19 = m18;
Mat4x4_ const _e4 = _Mat4x4_(1.0f);
o2 = _e4;
Mat4x2_ const _e7 = m19;
o2.mx = _e7.mx;
Mat4x2_ const _e10 = m19;
o2.my = _e10.my;
Mat4x4_ const _e12 = o2;
return _e12;
Mat4x4_ const x_e4 = x_Mat4x4_(1.0f);
o2 = x_e4;
Mat4x2_ const x_e7 = m19;
o2.mx = x_e7.mx;
Mat4x2_ const x_e10 = m19;
o2.my = x_e10.my;
Mat4x4_ const x_e12 = o2;
return x_e12;
}
Mat4x3_ _Mat4x3_(float n2) {
Mat4x3_ x_Mat4x3_(float n2) {
float n3 = 0.0f;
Mat4x3_ o3 = {};
n3 = n2;
float const _e4 = n3;
o3.mx = float4(_e4, 0.0f, 0.0f, 0.0f);
float const _e11 = n3;
o3.my = float4(0.0f, _e11, 0.0f, 0.0f);
float const _e18 = n3;
o3.mz = float4(0.0f, 0.0f, _e18, 0.0f);
Mat4x3_ const _e21 = o3;
return _e21;
float const x_e4 = n3;
o3.mx = float4(x_e4, 0.0f, 0.0f, 0.0f);
float const x_e11 = n3;
o3.my = float4(0.0f, x_e11, 0.0f, 0.0f);
float const x_e18 = n3;
o3.mz = float4(0.0f, 0.0f, x_e18, 0.0f);
Mat4x3_ const x_e21 = o3;
return x_e21;
}
Mat4x3_ _Mat4x3_1(Mat4x4_ m20) {
Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) {
Mat4x4_ m21 = {};
Mat4x3_ o4 = {};
m21 = m20;
Mat4x4_ const _e4 = m21;
o4.mx = _e4.mx;
Mat4x4_ const _e7 = m21;
o4.my = _e7.my;
Mat4x4_ const _e10 = m21;
o4.mz = _e10.mz;
Mat4x3_ const _e12 = o4;
return _e12;
Mat4x4_ const x_e4 = m21;
o4.mx = x_e4.mx;
Mat4x4_ const x_e7 = m21;
o4.my = x_e7.my;
Mat4x4_ const x_e10 = m21;
o4.mz = x_e10.mz;
Mat4x3_ const x_e12 = o4;
return x_e12;
}
void main1(constant ub_PacketParams& global2, constant ub_SceneParams& global, constant ub_MaterialParams& global1, thread float* const tint_symbol_5, thread float3* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9, thread float3* const tint_symbol_10, thread float2* const tint_symbol_11, thread float2* const tint_symbol_12) {
Mat4x3_ t_PosMtx = {};
float2 t_TexSpaceCoord = 0.0f;
float const _e15 = *(tint_symbol_5);
Mat4x3_ const _e18 = global2.u_PosMtx.arr[int(_e15)];
t_PosMtx = _e18;
Mat4x3_ const _e23 = t_PosMtx;
Mat4x4_ const _e24 = _Mat4x4_1(_e23);
float3 const _e25 = *(tint_symbol_6);
Mat4x3_ const _e29 = t_PosMtx;
Mat4x4_ const _e30 = _Mat4x4_1(_e29);
float3 const _e31 = *(tint_symbol_6);
float4 const _e34 = Mul(_e30, float4(_e31, 1.0f));
Mat4x4_ const _e35 = global.u_Projection;
Mat4x3_ const _e37 = t_PosMtx;
Mat4x4_ const _e38 = _Mat4x4_1(_e37);
float3 const _e39 = *(tint_symbol_6);
Mat4x3_ const _e43 = t_PosMtx;
Mat4x4_ const _e44 = _Mat4x4_1(_e43);
float3 const _e45 = *(tint_symbol_6);
float4 const _e48 = Mul(_e44, float4(_e45, 1.0f));
float4 const _e49 = Mul(_e35, _e48);
*(tint_symbol_7) = _e49;
float4 const _e50 = *(tint_symbol_8);
*(tint_symbol_9) = _e50;
float4 const _e52 = global1.u_Misc0_;
if ((_e52.x == 2.0f)) {
float const x_e15 = *(tint_symbol_5);
Mat4x3_ const x_e18 = global2.u_PosMtx.arr[int(x_e15)];
t_PosMtx = x_e18;
Mat4x3_ const x_e23 = t_PosMtx;
Mat4x4_ const x_e24 = x_Mat4x4_1(x_e23);
float3 const x_e25 = *(tint_symbol_6);
Mat4x3_ const x_e29 = t_PosMtx;
Mat4x4_ const x_e30 = x_Mat4x4_1(x_e29);
float3 const x_e31 = *(tint_symbol_6);
float4 const x_e34 = Mul(x_e30, float4(x_e31, 1.0f));
Mat4x4_ const x_e35 = global.u_Projection;
Mat4x3_ const x_e37 = t_PosMtx;
Mat4x4_ const x_e38 = x_Mat4x4_1(x_e37);
float3 const x_e39 = *(tint_symbol_6);
Mat4x3_ const x_e43 = t_PosMtx;
Mat4x4_ const x_e44 = x_Mat4x4_1(x_e43);
float3 const x_e45 = *(tint_symbol_6);
float4 const x_e48 = Mul(x_e44, float4(x_e45, 1.0f));
float4 const x_e49 = Mul(x_e35, x_e48);
*(tint_symbol_7) = x_e49;
float4 const x_e50 = *(tint_symbol_8);
*(tint_symbol_9) = x_e50;
float4 const x_e52 = global1.u_Misc0_;
if ((x_e52.x == 2.0f)) {
{
float3 const _e59 = *(tint_symbol_10);
Mat4x2_ const _e64 = global1.u_TexMtx.arr[0];
float3 const _e65 = *(tint_symbol_10);
float2 const _e68 = Mul2(_e64, float4(_e65, 1.0f));
*(tint_symbol_11) = _e68.xy;
float3 const x_e59 = *(tint_symbol_10);
Mat4x2_ const x_e64 = global1.u_TexMtx.arr[0];
float3 const x_e65 = *(tint_symbol_10);
float2 const x_e68 = Mul2(x_e64, float4(x_e65, 1.0f));
*(tint_symbol_11) = x_e68.xy;
return;
}
} else {
{
float2 const _e73 = *(tint_symbol_12);
Mat4x2_ const _e79 = global1.u_TexMtx.arr[0];
float2 const _e80 = *(tint_symbol_12);
float2 const _e84 = Mul2(_e79, float4(_e80, 1.0f, 1.0f));
*(tint_symbol_11) = _e84.xy;
float2 const x_e73 = *(tint_symbol_12);
Mat4x2_ const x_e79 = global1.u_TexMtx.arr[0];
float2 const x_e80 = *(tint_symbol_12);
float2 const x_e84 = Mul2(x_e79, float4(x_e80, 1.0f, 1.0f));
*(tint_symbol_11) = x_e84.xy;
return;
}
}
@ -276,10 +276,10 @@ VertexOutput tint_symbol_inner(constant ub_PacketParams& global2, constant ub_Sc
*(tint_symbol_16) = a_Normal;
*(tint_symbol_17) = a_PosMtxIdx;
main1(global2, global, global1, tint_symbol_17, tint_symbol_13, tint_symbol_18, tint_symbol_15, tint_symbol_19, tint_symbol_16, tint_symbol_20, tint_symbol_14);
float4 const _e11 = *(tint_symbol_19);
float2 const _e13 = *(tint_symbol_20);
float4 const _e15 = *(tint_symbol_18);
VertexOutput const tint_symbol_4 = {.v_Color=_e11, .v_TexCoord=_e13, .member=_e15};
float4 const x_e11 = *(tint_symbol_19);
float2 const x_e13 = *(tint_symbol_20);
float4 const x_e15 = *(tint_symbol_18);
VertexOutput const tint_symbol_4 = {.v_Color=x_e11, .v_TexCoord=x_e13, .member=x_e15};
return tint_symbol_4;
}

View File

@ -77,23 +77,23 @@
OpName %m14 "m14"
OpName %v7 "v7"
OpName %m15 "m15"
OpName %_Mat4x4_ "_Mat4x4_"
OpName %x_Mat4x4_ "x_Mat4x4_"
OpName %n "n"
OpName %n1 "n1"
OpName %o "o"
OpName %_Mat4x4_1 "_Mat4x4_1"
OpName %x_Mat4x4_1 "x_Mat4x4_1"
OpName %m16 "m16"
OpName %m17 "m17"
OpName %o1 "o1"
OpName %_Mat4x4_2 "_Mat4x4_2"
OpName %x_Mat4x4_2 "x_Mat4x4_2"
OpName %m18 "m18"
OpName %m19 "m19"
OpName %o2 "o2"
OpName %_Mat4x3_ "_Mat4x3_"
OpName %x_Mat4x3_ "x_Mat4x3_"
OpName %n2 "n2"
OpName %n3 "n3"
OpName %o3 "o3"
OpName %_Mat4x3_1 "_Mat4x3_1"
OpName %x_Mat4x3_1 "x_Mat4x3_1"
OpName %m20 "m20"
OpName %m21 "m21"
OpName %o4 "o4"
@ -404,7 +404,7 @@
%202 = OpCompositeConstruct %v4float %198 %199 %200 %201
OpReturnValue %202
OpFunctionEnd
%_Mat4x4_ = OpFunction %Mat4x4_ None %203
%x_Mat4x4_ = OpFunction %Mat4x4_ None %203
%n = OpFunctionParameter %float
%206 = OpLabel
%n1 = OpVariable %_ptr_Function_float Function %23
@ -429,13 +429,13 @@
%226 = OpLoad %Mat4x4_ %o
OpReturnValue %226
OpFunctionEnd
%_Mat4x4_1 = OpFunction %Mat4x4_ None %227
%x_Mat4x4_1 = OpFunction %Mat4x4_ None %227
%m16 = OpFunctionParameter %Mat4x3_
%230 = OpLabel
%m17 = OpVariable %_ptr_Function_Mat4x3_ Function %60
%o1 = OpVariable %_ptr_Function_Mat4x4_ Function %120
OpStore %m17 %m16
%233 = OpFunctionCall %Mat4x4_ %_Mat4x4_ %float_1
%233 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1
OpStore %o1 %233
%235 = OpLoad %Mat4x3_ %m17
%236 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0
@ -452,13 +452,13 @@
%244 = OpLoad %Mat4x4_ %o1
OpReturnValue %244
OpFunctionEnd
%_Mat4x4_2 = OpFunction %Mat4x4_ None %245
%x_Mat4x4_2 = OpFunction %Mat4x4_ None %245
%m18 = OpFunctionParameter %Mat4x2_
%248 = OpLabel
%m19 = OpVariable %_ptr_Function_Mat4x2_ Function %167
%o2 = OpVariable %_ptr_Function_Mat4x4_ Function %120
OpStore %m19 %m18
%251 = OpFunctionCall %Mat4x4_ %_Mat4x4_ %float_1
%251 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1
OpStore %o2 %251
%252 = OpLoad %Mat4x2_ %m19
%253 = OpAccessChain %_ptr_Function_v4float %o2 %uint_0
@ -471,7 +471,7 @@
%258 = OpLoad %Mat4x4_ %o2
OpReturnValue %258
OpFunctionEnd
%_Mat4x3_ = OpFunction %Mat4x3_ None %259
%x_Mat4x3_ = OpFunction %Mat4x3_ None %259
%n2 = OpFunctionParameter %float
%262 = OpLabel
%n3 = OpVariable %_ptr_Function_float Function %23
@ -492,7 +492,7 @@
%274 = OpLoad %Mat4x3_ %o3
OpReturnValue %274
OpFunctionEnd
%_Mat4x3_1 = OpFunction %Mat4x3_ None %275
%x_Mat4x3_1 = OpFunction %Mat4x3_ None %275
%m20 = OpFunctionParameter %Mat4x4_
%278 = OpLabel
%m21 = OpVariable %_ptr_Function_Mat4x4_ Function %120
@ -523,10 +523,10 @@
%303 = OpLoad %Mat4x3_ %302
OpStore %t_PosMtx %303
%304 = OpLoad %Mat4x3_ %t_PosMtx
%305 = OpFunctionCall %Mat4x4_ %_Mat4x4_1 %304
%305 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %304
%306 = OpLoad %v3float %a_Position1
%307 = OpLoad %Mat4x3_ %t_PosMtx
%308 = OpFunctionCall %Mat4x4_ %_Mat4x4_1 %307
%308 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %307
%309 = OpLoad %v3float %a_Position1
%311 = OpCompositeExtract %float %309 0
%312 = OpCompositeExtract %float %309 1
@ -536,10 +536,10 @@
%316 = OpAccessChain %_ptr_Uniform_Mat4x4_ %global %uint_0
%317 = OpLoad %Mat4x4_ %316
%318 = OpLoad %Mat4x3_ %t_PosMtx
%319 = OpFunctionCall %Mat4x4_ %_Mat4x4_1 %318
%319 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %318
%320 = OpLoad %v3float %a_Position1
%321 = OpLoad %Mat4x3_ %t_PosMtx
%322 = OpFunctionCall %Mat4x4_ %_Mat4x4_1 %321
%322 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %321
%323 = OpLoad %v3float %a_Position1
%325 = OpCompositeExtract %float %323 0
%326 = OpCompositeExtract %float %323 1

View File

@ -66,37 +66,37 @@ var<private> gl_Position : vec4<f32>;
fn Mat4x3GetCol0_(m : Mat4x3_) -> vec3<f32> {
var m1 : Mat4x3_;
m1 = m;
let _e2 : Mat4x3_ = m1;
let _e5 : Mat4x3_ = m1;
let _e8 : Mat4x3_ = m1;
return vec3<f32>(_e2.mx.x, _e5.my.x, _e8.mz.x);
let x_e2 : Mat4x3_ = m1;
let x_e5 : Mat4x3_ = m1;
let x_e8 : Mat4x3_ = m1;
return vec3<f32>(x_e2.mx.x, x_e5.my.x, x_e8.mz.x);
}
fn Mat4x3GetCol1_(m2 : Mat4x3_) -> vec3<f32> {
var m3 : Mat4x3_;
m3 = m2;
let _e2 : Mat4x3_ = m3;
let _e5 : Mat4x3_ = m3;
let _e8 : Mat4x3_ = m3;
return vec3<f32>(_e2.mx.y, _e5.my.y, _e8.mz.y);
let x_e2 : Mat4x3_ = m3;
let x_e5 : Mat4x3_ = m3;
let x_e8 : Mat4x3_ = m3;
return vec3<f32>(x_e2.mx.y, x_e5.my.y, x_e8.mz.y);
}
fn Mat4x3GetCol2_(m4 : Mat4x3_) -> vec3<f32> {
var m5 : Mat4x3_;
m5 = m4;
let _e2 : Mat4x3_ = m5;
let _e5 : Mat4x3_ = m5;
let _e8 : Mat4x3_ = m5;
return vec3<f32>(_e2.mx.z, _e5.my.z, _e8.mz.z);
let x_e2 : Mat4x3_ = m5;
let x_e5 : Mat4x3_ = m5;
let x_e8 : Mat4x3_ = m5;
return vec3<f32>(x_e2.mx.z, x_e5.my.z, x_e8.mz.z);
}
fn Mat4x3GetCol3_(m6 : Mat4x3_) -> vec3<f32> {
var m7 : Mat4x3_;
m7 = m6;
let _e2 : Mat4x3_ = m7;
let _e5 : Mat4x3_ = m7;
let _e8 : Mat4x3_ = m7;
return vec3<f32>(_e2.mx.w, _e5.my.w, _e8.mz.w);
let x_e2 : Mat4x3_ = m7;
let x_e5 : Mat4x3_ = m7;
let x_e8 : Mat4x3_ = m7;
return vec3<f32>(x_e2.mx.w, x_e5.my.w, x_e8.mz.w);
}
fn Mul(m8 : Mat4x4_, v : vec4<f32>) -> vec4<f32> {
@ -104,15 +104,15 @@ fn Mul(m8 : Mat4x4_, v : vec4<f32>) -> vec4<f32> {
var v1 : vec4<f32>;
m9 = m8;
v1 = v;
let _e4 : Mat4x4_ = m9;
let _e6 : vec4<f32> = v1;
let _e8 : Mat4x4_ = m9;
let _e10 : vec4<f32> = v1;
let _e12 : Mat4x4_ = m9;
let _e14 : vec4<f32> = v1;
let _e16 : Mat4x4_ = m9;
let _e18 : vec4<f32> = v1;
return vec4<f32>(dot(_e4.mx, _e6), dot(_e8.my, _e10), dot(_e12.mz, _e14), dot(_e16.mw, _e18));
let x_e4 : Mat4x4_ = m9;
let x_e6 : vec4<f32> = v1;
let x_e8 : Mat4x4_ = m9;
let x_e10 : vec4<f32> = v1;
let x_e12 : Mat4x4_ = m9;
let x_e14 : vec4<f32> = v1;
let x_e16 : Mat4x4_ = m9;
let x_e18 : vec4<f32> = v1;
return vec4<f32>(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14), dot(x_e16.mw, x_e18));
}
fn Mul1(m10 : Mat4x3_, v2 : vec4<f32>) -> vec3<f32> {
@ -120,13 +120,13 @@ fn Mul1(m10 : Mat4x3_, v2 : vec4<f32>) -> vec3<f32> {
var v3 : vec4<f32>;
m11 = m10;
v3 = v2;
let _e4 : Mat4x3_ = m11;
let _e6 : vec4<f32> = v3;
let _e8 : Mat4x3_ = m11;
let _e10 : vec4<f32> = v3;
let _e12 : Mat4x3_ = m11;
let _e14 : vec4<f32> = v3;
return vec3<f32>(dot(_e4.mx, _e6), dot(_e8.my, _e10), dot(_e12.mz, _e14));
let x_e4 : Mat4x3_ = m11;
let x_e6 : vec4<f32> = v3;
let x_e8 : Mat4x3_ = m11;
let x_e10 : vec4<f32> = v3;
let x_e12 : Mat4x3_ = m11;
let x_e14 : vec4<f32> = v3;
return vec3<f32>(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14));
}
fn Mul2(m12 : Mat4x2_, v4 : vec4<f32>) -> vec2<f32> {
@ -134,11 +134,11 @@ fn Mul2(m12 : Mat4x2_, v4 : vec4<f32>) -> vec2<f32> {
var v5 : vec4<f32>;
m13 = m12;
v5 = v4;
let _e4 : Mat4x2_ = m13;
let _e6 : vec4<f32> = v5;
let _e8 : Mat4x2_ = m13;
let _e10 : vec4<f32> = v5;
return vec2<f32>(dot(_e4.mx, _e6), dot(_e8.my, _e10));
let x_e4 : Mat4x2_ = m13;
let x_e6 : vec4<f32> = v5;
let x_e8 : Mat4x2_ = m13;
let x_e10 : vec4<f32> = v5;
return vec2<f32>(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10));
}
fn Mul3(v6 : vec3<f32>, m14 : Mat4x3_) -> vec4<f32> {
@ -146,137 +146,137 @@ fn Mul3(v6 : vec3<f32>, m14 : Mat4x3_) -> vec4<f32> {
var m15 : Mat4x3_;
v7 = v6;
m15 = m14;
let _e5 : Mat4x3_ = m15;
let _e6 : vec3<f32> = Mat4x3GetCol0_(_e5);
let _e7 : vec3<f32> = v7;
let _e10 : Mat4x3_ = m15;
let _e11 : vec3<f32> = Mat4x3GetCol1_(_e10);
let _e12 : vec3<f32> = v7;
let _e15 : Mat4x3_ = m15;
let _e16 : vec3<f32> = Mat4x3GetCol2_(_e15);
let _e17 : vec3<f32> = v7;
let _e20 : Mat4x3_ = m15;
let _e21 : vec3<f32> = Mat4x3GetCol3_(_e20);
let _e22 : vec3<f32> = v7;
return vec4<f32>(dot(_e6, _e7), dot(_e11, _e12), dot(_e16, _e17), dot(_e21, _e22));
let x_e5 : Mat4x3_ = m15;
let x_e6 : vec3<f32> = Mat4x3GetCol0_(x_e5);
let x_e7 : vec3<f32> = v7;
let x_e10 : Mat4x3_ = m15;
let x_e11 : vec3<f32> = Mat4x3GetCol1_(x_e10);
let x_e12 : vec3<f32> = v7;
let x_e15 : Mat4x3_ = m15;
let x_e16 : vec3<f32> = Mat4x3GetCol2_(x_e15);
let x_e17 : vec3<f32> = v7;
let x_e20 : Mat4x3_ = m15;
let x_e21 : vec3<f32> = Mat4x3GetCol3_(x_e20);
let x_e22 : vec3<f32> = v7;
return vec4<f32>(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, x_e22));
}
fn _Mat4x4_(n : f32) -> Mat4x4_ {
fn x_Mat4x4_(n : f32) -> Mat4x4_ {
var n1 : f32;
var o : Mat4x4_;
n1 = n;
let _e4 : f32 = n1;
o.mx = vec4<f32>(_e4, 0.0, 0.0, 0.0);
let _e11 : f32 = n1;
o.my = vec4<f32>(0.0, _e11, 0.0, 0.0);
let _e18 : f32 = n1;
o.mz = vec4<f32>(0.0, 0.0, _e18, 0.0);
let _e25 : f32 = n1;
o.mw = vec4<f32>(0.0, 0.0, 0.0, _e25);
let _e27 : Mat4x4_ = o;
return _e27;
let x_e4 : f32 = n1;
o.mx = vec4<f32>(x_e4, 0.0, 0.0, 0.0);
let x_e11 : f32 = n1;
o.my = vec4<f32>(0.0, x_e11, 0.0, 0.0);
let x_e18 : f32 = n1;
o.mz = vec4<f32>(0.0, 0.0, x_e18, 0.0);
let x_e25 : f32 = n1;
o.mw = vec4<f32>(0.0, 0.0, 0.0, x_e25);
let x_e27 : Mat4x4_ = o;
return x_e27;
}
fn _Mat4x4_1(m16 : Mat4x3_) -> Mat4x4_ {
fn x_Mat4x4_1(m16 : Mat4x3_) -> Mat4x4_ {
var m17 : Mat4x3_;
var o1 : Mat4x4_;
m17 = m16;
let _e4 : Mat4x4_ = _Mat4x4_(1.0);
o1 = _e4;
let _e7 : Mat4x3_ = m17;
o1.mx = _e7.mx;
let _e10 : Mat4x3_ = m17;
o1.my = _e10.my;
let _e13 : Mat4x3_ = m17;
o1.mz = _e13.mz;
let _e15 : Mat4x4_ = o1;
return _e15;
let x_e4 : Mat4x4_ = x_Mat4x4_(1.0);
o1 = x_e4;
let x_e7 : Mat4x3_ = m17;
o1.mx = x_e7.mx;
let x_e10 : Mat4x3_ = m17;
o1.my = x_e10.my;
let x_e13 : Mat4x3_ = m17;
o1.mz = x_e13.mz;
let x_e15 : Mat4x4_ = o1;
return x_e15;
}
fn _Mat4x4_2(m18 : Mat4x2_) -> Mat4x4_ {
fn x_Mat4x4_2(m18 : Mat4x2_) -> Mat4x4_ {
var m19 : Mat4x2_;
var o2 : Mat4x4_;
m19 = m18;
let _e4 : Mat4x4_ = _Mat4x4_(1.0);
o2 = _e4;
let _e7 : Mat4x2_ = m19;
o2.mx = _e7.mx;
let _e10 : Mat4x2_ = m19;
o2.my = _e10.my;
let _e12 : Mat4x4_ = o2;
return _e12;
let x_e4 : Mat4x4_ = x_Mat4x4_(1.0);
o2 = x_e4;
let x_e7 : Mat4x2_ = m19;
o2.mx = x_e7.mx;
let x_e10 : Mat4x2_ = m19;
o2.my = x_e10.my;
let x_e12 : Mat4x4_ = o2;
return x_e12;
}
fn _Mat4x3_(n2 : f32) -> Mat4x3_ {
fn x_Mat4x3_(n2 : f32) -> Mat4x3_ {
var n3 : f32;
var o3 : Mat4x3_;
n3 = n2;
let _e4 : f32 = n3;
o3.mx = vec4<f32>(_e4, 0.0, 0.0, 0.0);
let _e11 : f32 = n3;
o3.my = vec4<f32>(0.0, _e11, 0.0, 0.0);
let _e18 : f32 = n3;
o3.mz = vec4<f32>(0.0, 0.0, _e18, 0.0);
let _e21 : Mat4x3_ = o3;
return _e21;
let x_e4 : f32 = n3;
o3.mx = vec4<f32>(x_e4, 0.0, 0.0, 0.0);
let x_e11 : f32 = n3;
o3.my = vec4<f32>(0.0, x_e11, 0.0, 0.0);
let x_e18 : f32 = n3;
o3.mz = vec4<f32>(0.0, 0.0, x_e18, 0.0);
let x_e21 : Mat4x3_ = o3;
return x_e21;
}
fn _Mat4x3_1(m20 : Mat4x4_) -> Mat4x3_ {
fn x_Mat4x3_1(m20 : Mat4x4_) -> Mat4x3_ {
var m21 : Mat4x4_;
var o4 : Mat4x3_;
m21 = m20;
let _e4 : Mat4x4_ = m21;
o4.mx = _e4.mx;
let _e7 : Mat4x4_ = m21;
o4.my = _e7.my;
let _e10 : Mat4x4_ = m21;
o4.mz = _e10.mz;
let _e12 : Mat4x3_ = o4;
return _e12;
let x_e4 : Mat4x4_ = m21;
o4.mx = x_e4.mx;
let x_e7 : Mat4x4_ = m21;
o4.my = x_e7.my;
let x_e10 : Mat4x4_ = m21;
o4.mz = x_e10.mz;
let x_e12 : Mat4x3_ = o4;
return x_e12;
}
fn main1() {
var t_PosMtx : Mat4x3_;
var t_TexSpaceCoord : vec2<f32>;
let _e15 : f32 = a_PosMtxIdx1;
let _e18 : Mat4x3_ = global2.u_PosMtx[i32(_e15)];
t_PosMtx = _e18;
let _e23 : Mat4x3_ = t_PosMtx;
let _e24 : Mat4x4_ = _Mat4x4_1(_e23);
let _e25 : vec3<f32> = a_Position1;
let _e29 : Mat4x3_ = t_PosMtx;
let _e30 : Mat4x4_ = _Mat4x4_1(_e29);
let _e31 : vec3<f32> = a_Position1;
let _e34 : vec4<f32> = Mul(_e30, vec4<f32>(_e31, 1.0));
let _e35 : Mat4x4_ = global.u_Projection;
let _e37 : Mat4x3_ = t_PosMtx;
let _e38 : Mat4x4_ = _Mat4x4_1(_e37);
let _e39 : vec3<f32> = a_Position1;
let _e43 : Mat4x3_ = t_PosMtx;
let _e44 : Mat4x4_ = _Mat4x4_1(_e43);
let _e45 : vec3<f32> = a_Position1;
let _e48 : vec4<f32> = Mul(_e44, vec4<f32>(_e45, 1.0));
let _e49 : vec4<f32> = Mul(_e35, _e48);
gl_Position = _e49;
let _e50 : vec4<f32> = a_Color1;
v_Color = _e50;
let _e52 : vec4<f32> = global1.u_Misc0_;
if ((_e52.x == 2.0)) {
let x_e15 : f32 = a_PosMtxIdx1;
let x_e18 : Mat4x3_ = global2.u_PosMtx[i32(x_e15)];
t_PosMtx = x_e18;
let x_e23 : Mat4x3_ = t_PosMtx;
let x_e24 : Mat4x4_ = x_Mat4x4_1(x_e23);
let x_e25 : vec3<f32> = a_Position1;
let x_e29 : Mat4x3_ = t_PosMtx;
let x_e30 : Mat4x4_ = x_Mat4x4_1(x_e29);
let x_e31 : vec3<f32> = a_Position1;
let x_e34 : vec4<f32> = Mul(x_e30, vec4<f32>(x_e31, 1.0));
let x_e35 : Mat4x4_ = global.u_Projection;
let x_e37 : Mat4x3_ = t_PosMtx;
let x_e38 : Mat4x4_ = x_Mat4x4_1(x_e37);
let x_e39 : vec3<f32> = a_Position1;
let x_e43 : Mat4x3_ = t_PosMtx;
let x_e44 : Mat4x4_ = x_Mat4x4_1(x_e43);
let x_e45 : vec3<f32> = a_Position1;
let x_e48 : vec4<f32> = Mul(x_e44, vec4<f32>(x_e45, 1.0));
let x_e49 : vec4<f32> = Mul(x_e35, x_e48);
gl_Position = x_e49;
let x_e50 : vec4<f32> = a_Color1;
v_Color = x_e50;
let x_e52 : vec4<f32> = global1.u_Misc0_;
if ((x_e52.x == 2.0)) {
{
let _e59 : vec3<f32> = a_Normal1;
let _e64 : Mat4x2_ = global1.u_TexMtx[0];
let _e65 : vec3<f32> = a_Normal1;
let _e68 : vec2<f32> = Mul2(_e64, vec4<f32>(_e65, 1.0));
v_TexCoord = _e68.xy;
let x_e59 : vec3<f32> = a_Normal1;
let x_e64 : Mat4x2_ = global1.u_TexMtx[0];
let x_e65 : vec3<f32> = a_Normal1;
let x_e68 : vec2<f32> = Mul2(x_e64, vec4<f32>(x_e65, 1.0));
v_TexCoord = x_e68.xy;
return;
}
} else {
{
let _e73 : vec2<f32> = a_UV1;
let _e79 : Mat4x2_ = global1.u_TexMtx[0];
let _e80 : vec2<f32> = a_UV1;
let _e84 : vec2<f32> = Mul2(_e79, vec4<f32>(_e80, 1.0, 1.0));
v_TexCoord = _e84.xy;
let x_e73 : vec2<f32> = a_UV1;
let x_e79 : Mat4x2_ = global1.u_TexMtx[0];
let x_e80 : vec2<f32> = a_UV1;
let x_e84 : vec2<f32> = Mul2(x_e79, vec4<f32>(x_e80, 1.0, 1.0));
v_TexCoord = x_e84.xy;
return;
}
}
@ -290,8 +290,8 @@ fn main([[location(0)]] a_Position : vec3<f32>, [[location(1)]] a_UV : vec2<f32>
a_Normal1 = a_Normal;
a_PosMtxIdx1 = a_PosMtxIdx;
main1();
let _e11 : vec4<f32> = v_Color;
let _e13 : vec2<f32> = v_TexCoord;
let _e15 : vec4<f32> = gl_Position;
return VertexOutput(_e11, _e13, _e15);
let x_e11 : vec4<f32> = v_Color;
let x_e13 : vec2<f32> = v_TexCoord;
let x_e15 : vec4<f32> = gl_Position;
return VertexOutput(x_e11, x_e13, x_e15);
}