Add e2e test for crbug.com/tint/1118

Bug: tint:1118
Change-Id: I1a833ea377fe2f11f58186cdb2e160907c1f05e6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84400
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2022-03-23 15:17:03 +00:00 committed by Tint LUCI CQ
parent 7419f0e26a
commit 1006b06c7d
6 changed files with 903 additions and 0 deletions

View File

@ -0,0 +1,117 @@
struct Scene {
vEyePosition : vec4<f32>;
};
struct Material {
vDiffuseColor : vec4<f32>;
vAmbientColor : vec3<f32>;
dummy: f32;
vEmissiveColor : vec3<f32>;
dummy2: f32;
};
struct Mesh {
visibility : f32;
};
var<private> fClipDistance3 : f32;
var<private> fClipDistance4 : f32;
@group(0) @binding(0) var<uniform> x_29 : Scene;
@group(0) @binding(1) var<uniform> x_49 : Material;
@group(0) @binding(2) var<uniform> x_137 : Mesh;
var<private> glFragColor : vec4<f32>;
fn main_1() {
var viewDirectionW : vec3<f32>;
var baseColor : vec4<f32>;
var diffuseColor : vec3<f32>;
var alpha : f32;
var normalW : vec3<f32>;
var uvOffset : vec2<f32>;
var baseAmbientColor : vec3<f32>;
var glossiness : f32;
var diffuseBase : vec3<f32>;
var shadow : f32;
var refractionColor : vec4<f32>;
var reflectionColor : vec4<f32>;
var emissiveColor : vec3<f32>;
var finalDiffuse : vec3<f32>;
var finalSpecular : vec3<f32>;
var color : vec4<f32>;
let x_9 : f32 = fClipDistance3;
if ((x_9 > 0.0)) {
discard;
}
let x_17 : f32 = fClipDistance4;
if ((x_17 > 0.0)) {
discard;
}
let x_34 : vec4<f32> = x_29.vEyePosition;
let x_38 : vec3<f32> = vec3<f32>(0., 0., 0.);
viewDirectionW = normalize((vec3<f32>(x_34.x, x_34.y, x_34.z) - x_38));
baseColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
let x_52 : vec4<f32> = x_49.vDiffuseColor;
diffuseColor = vec3<f32>(x_52.x, x_52.y, x_52.z);
let x_60 : f32 = x_49.vDiffuseColor.w;
alpha = x_60;
let x_62 : vec3<f32> = vec3<f32>(0., 0., 0.);
let x_64 : vec3<f32> = vec3<f32>(0., 0., 0.);
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
uvOffset = vec2<f32>(0.0, 0.0);
let x_74 : vec4<f32> = vec4<f32>(0., 0., 0., 0.);
let x_76 : vec4<f32> = baseColor;
let x_78 : vec3<f32> = (vec3<f32>(x_76.x, x_76.y, x_76.z) * vec3<f32>(x_74.x, x_74.y, x_74.z));
let x_79 : vec4<f32> = baseColor;
baseColor = vec4<f32>(x_78.x, x_78.y, x_78.z, x_79.w);
baseAmbientColor = vec3<f32>(1.0, 1.0, 1.0);
glossiness = 0.0;
diffuseBase = vec3<f32>(0.0, 0.0, 0.0);
shadow = 1.0;
refractionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0);
reflectionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0);
let x_94 : vec3<f32> = x_49.vEmissiveColor;
emissiveColor = x_94;
let x_96 : vec3<f32> = diffuseBase;
let x_97 : vec3<f32> = diffuseColor;
let x_99 : vec3<f32> = emissiveColor;
let x_103 : vec3<f32> = x_49.vAmbientColor;
let x_108 : vec4<f32> = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(1.0, 1.0, 1.0)) * vec3<f32>(x_108.x, x_108.y, x_108.z));
finalSpecular = vec3<f32>(0.0, 0.0, 0.0);
let x_113 : vec3<f32> = finalDiffuse;
let x_114 : vec3<f32> = baseAmbientColor;
let x_116 : vec3<f32> = finalSpecular;
let x_118 : vec4<f32> = reflectionColor;
let x_121 : vec4<f32> = refractionColor;
let x_123 : vec3<f32> = ((((x_113 * x_114) + x_116) + vec3<f32>(x_118.x, x_118.y, x_118.z)) + vec3<f32>(x_121.x, x_121.y, x_121.z));
let x_124 : f32 = alpha;
color = vec4<f32>(x_123.x, x_123.y, x_123.z, x_124);
let x_129 : vec4<f32> = color;
let x_132 : vec3<f32> = max(vec3<f32>(x_129.x, x_129.y, x_129.z), vec3<f32>(0.0, 0.0, 0.0));
let x_133 : vec4<f32> = color;
color = vec4<f32>(x_132.x, x_132.y, x_132.z, x_133.w);
let x_140 : f32 = x_137.visibility;
let x_142 : f32 = color.w;
color.w = (x_142 * x_140);
let x_147 : vec4<f32> = color;
glFragColor = x_147;
return;
}
struct main_out {
@location(0)
glFragColor_1 : vec4<f32>;
};
@stage(fragment)
fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out {
fClipDistance3 = fClipDistance3_param;
fClipDistance4 = fClipDistance4_param;
main_1();
return main_out(glFragColor);
}

View File

@ -0,0 +1,126 @@
#version 310 es
precision mediump float;
layout(location = 2) in float fClipDistance3_param_1;
layout(location = 3) in float fClipDistance4_param_1;
layout(location = 0) out vec4 glFragColor_1_1;
struct Scene {
vec4 vEyePosition;
};
struct Material {
vec4 vDiffuseColor;
vec3 vAmbientColor;
float dummy;
vec3 vEmissiveColor;
float dummy2;
};
struct Mesh {
float visibility;
};
float fClipDistance3 = 0.0f;
float fClipDistance4 = 0.0f;
layout(binding = 0) uniform Scene_1 {
vec4 vEyePosition;
} x_29;
layout(binding = 1) uniform Material_1 {
vec4 vDiffuseColor;
vec3 vAmbientColor;
float dummy;
vec3 vEmissiveColor;
float dummy2;
} x_49;
layout(binding = 2) uniform Mesh_1 {
float visibility;
} x_137;
vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
vec3 viewDirectionW = vec3(0.0f, 0.0f, 0.0f);
vec4 baseColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
vec3 diffuseColor = vec3(0.0f, 0.0f, 0.0f);
float alpha = 0.0f;
vec3 normalW = vec3(0.0f, 0.0f, 0.0f);
vec2 uvOffset = vec2(0.0f, 0.0f);
vec3 baseAmbientColor = vec3(0.0f, 0.0f, 0.0f);
float glossiness = 0.0f;
vec3 diffuseBase = vec3(0.0f, 0.0f, 0.0f);
float shadow = 0.0f;
vec4 refractionColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
vec4 reflectionColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
vec3 emissiveColor = vec3(0.0f, 0.0f, 0.0f);
vec3 finalDiffuse = vec3(0.0f, 0.0f, 0.0f);
vec3 finalSpecular = vec3(0.0f, 0.0f, 0.0f);
vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((fClipDistance3 > 0.0f)) {
discard;
}
if ((fClipDistance4 > 0.0f)) {
discard;
}
vec4 x_34 = x_29.vEyePosition;
vec3 x_38 = vec3(0.0f, 0.0f, 0.0f);
viewDirectionW = normalize((vec3(x_34.x, x_34.y, x_34.z) - x_38));
baseColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);
vec4 x_52 = x_49.vDiffuseColor;
diffuseColor = vec3(x_52.x, x_52.y, x_52.z);
float x_60 = x_49.vDiffuseColor.w;
alpha = x_60;
vec3 x_62 = vec3(0.0f, 0.0f, 0.0f);
vec3 x_64 = vec3(0.0f, 0.0f, 0.0f);
normalW = normalize(-(cross(dFdx(x_62), dFdy(x_64))));
uvOffset = vec2(0.0f, 0.0f);
vec4 x_74 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
vec4 x_76 = baseColor;
vec3 x_78 = (vec3(x_76.x, x_76.y, x_76.z) * vec3(x_74.x, x_74.y, x_74.z));
baseColor = vec4(x_78.x, x_78.y, x_78.z, baseColor.w);
baseAmbientColor = vec3(1.0f, 1.0f, 1.0f);
glossiness = 0.0f;
diffuseBase = vec3(0.0f, 0.0f, 0.0f);
shadow = 1.0f;
refractionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
reflectionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
vec3 x_94 = x_49.vEmissiveColor;
emissiveColor = x_94;
vec3 x_96 = diffuseBase;
vec3 x_97 = diffuseColor;
vec3 x_99 = emissiveColor;
vec3 x_103 = x_49.vAmbientColor;
vec4 x_108 = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3(0.0f, 0.0f, 0.0f), vec3(1.0f, 1.0f, 1.0f)) * vec3(x_108.x, x_108.y, x_108.z));
finalSpecular = vec3(0.0f, 0.0f, 0.0f);
vec4 x_118 = reflectionColor;
vec4 x_121 = refractionColor;
vec3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + vec3(x_118.x, x_118.y, x_118.z)) + vec3(x_121.x, x_121.y, x_121.z));
color = vec4(x_123.x, x_123.y, x_123.z, alpha);
vec4 x_129 = color;
vec3 x_132 = max(vec3(x_129.x, x_129.y, x_129.z), vec3(0.0f, 0.0f, 0.0f));
color = vec4(x_132.x, x_132.y, x_132.z, color.w);
float x_140 = x_137.visibility;
float x_142 = color.w;
color.w = (x_142 * x_140);
glFragColor = color;
return;
}
struct main_out {
vec4 glFragColor_1;
};
main_out tint_symbol(float fClipDistance3_param, float fClipDistance4_param) {
fClipDistance3 = fClipDistance3_param;
fClipDistance4 = fClipDistance4_param;
main_1();
main_out tint_symbol_1 = main_out(glFragColor);
return tint_symbol_1;
}
void main() {
main_out inner_result = tint_symbol(fClipDistance3_param_1, fClipDistance4_param_1);
glFragColor_1_1 = inner_result.glFragColor_1;
return;
}

View File

@ -0,0 +1,110 @@
SKIP: FAILED
static float fClipDistance3 = 0.0f;
static float fClipDistance4 = 0.0f;
cbuffer cbuffer_x_29 : register(b0, space0) {
uint4 x_29[1];
};
cbuffer cbuffer_x_49 : register(b1, space0) {
uint4 x_49[3];
};
cbuffer cbuffer_x_137 : register(b2, space0) {
uint4 x_137[1];
};
static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f);
float4 baseColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
float3 diffuseColor = float3(0.0f, 0.0f, 0.0f);
float alpha = 0.0f;
float3 normalW = float3(0.0f, 0.0f, 0.0f);
float2 uvOffset = float2(0.0f, 0.0f);
float3 baseAmbientColor = float3(0.0f, 0.0f, 0.0f);
float glossiness = 0.0f;
float3 diffuseBase = float3(0.0f, 0.0f, 0.0f);
float shadow = 0.0f;
float4 refractionColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
float4 reflectionColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
float3 emissiveColor = float3(0.0f, 0.0f, 0.0f);
float3 finalDiffuse = float3(0.0f, 0.0f, 0.0f);
float3 finalSpecular = float3(0.0f, 0.0f, 0.0f);
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((fClipDistance3 > 0.0f)) {
discard;
}
if ((fClipDistance4 > 0.0f)) {
discard;
}
const float4 x_34 = asfloat(x_29[0]);
const float3 x_38 = float3(0.0f, 0.0f, 0.0f);
viewDirectionW = normalize((float3(x_34.x, x_34.y, x_34.z) - x_38));
baseColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
const float4 x_52 = asfloat(x_49[0]);
diffuseColor = float3(x_52.x, x_52.y, x_52.z);
const float x_60 = asfloat(x_49[0].w);
alpha = x_60;
const float3 x_62 = float3(0.0f, 0.0f, 0.0f);
const float3 x_64 = float3(0.0f, 0.0f, 0.0f);
normalW = normalize(-(cross(ddx(x_62), ddy(x_64))));
uvOffset = float2(0.0f, 0.0f);
const float4 x_74 = float4(0.0f, 0.0f, 0.0f, 0.0f);
const float4 x_76 = baseColor;
const float3 x_78 = (float3(x_76.x, x_76.y, x_76.z) * float3(x_74.x, x_74.y, x_74.z));
baseColor = float4(x_78.x, x_78.y, x_78.z, baseColor.w);
baseAmbientColor = float3(1.0f, 1.0f, 1.0f);
glossiness = 0.0f;
diffuseBase = float3(0.0f, 0.0f, 0.0f);
shadow = 1.0f;
refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
const float3 x_94 = asfloat(x_49[2].xyz);
emissiveColor = x_94;
const float3 x_96 = diffuseBase;
const float3 x_97 = diffuseColor;
const float3 x_99 = emissiveColor;
const float3 x_103 = asfloat(x_49[1].xyz);
const float4 x_108 = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f, 0.0f, 0.0f), float3(1.0f, 1.0f, 1.0f)) * float3(x_108.x, x_108.y, x_108.z));
finalSpecular = float3(0.0f, 0.0f, 0.0f);
const float4 x_118 = reflectionColor;
const float4 x_121 = refractionColor;
const float3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + float3(x_118.x, x_118.y, x_118.z)) + float3(x_121.x, x_121.y, x_121.z));
color = float4(x_123.x, x_123.y, x_123.z, alpha);
const float4 x_129 = color;
const float3 x_132 = max(float3(x_129.x, x_129.y, x_129.z), float3(0.0f, 0.0f, 0.0f));
color = float4(x_132.x, x_132.y, x_132.z, color.w);
const float x_140 = asfloat(x_137[0].x);
const float x_142 = color.w;
color.w = (x_142 * x_140);
glFragColor = color;
return;
}
struct main_out {
float4 glFragColor_1;
};
struct tint_symbol_1 {
float fClipDistance3_param : TEXCOORD2;
float fClipDistance4_param : TEXCOORD3;
};
struct tint_symbol_2 {
float4 glFragColor_1 : SV_Target0;
};
main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) {
fClipDistance3 = fClipDistance3_param;
fClipDistance4 = fClipDistance4_param;
main_1();
const main_out tint_symbol_8 = {glFragColor};
return tint_symbol_8;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
return wrapper_result;
}
Internal error: unread predicate

View File

@ -0,0 +1,138 @@
#include <metal_stdlib>
using namespace metal;
template<typename T, int N, int M>
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
return lhs * vec<T, N>(rhs);
}
template<typename T, int N, int M>
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
return vec<T, M>(lhs) * rhs;
}
struct Scene {
/* 0x0000 */ float4 vEyePosition;
};
struct Material {
/* 0x0000 */ float4 vDiffuseColor;
/* 0x0010 */ packed_float3 vAmbientColor;
/* 0x001c */ float dummy;
/* 0x0020 */ packed_float3 vEmissiveColor;
/* 0x002c */ float dummy2;
};
struct Mesh {
/* 0x0000 */ float visibility;
};
void main_1(thread float* const tint_symbol_5, thread float* const tint_symbol_6, const constant Scene* const tint_symbol_7, const constant Material* const tint_symbol_8, const constant Mesh* const tint_symbol_9, thread float4* const tint_symbol_10) {
float3 viewDirectionW = 0.0f;
float4 baseColor = 0.0f;
float3 diffuseColor = 0.0f;
float alpha = 0.0f;
float3 normalW = 0.0f;
float2 uvOffset = 0.0f;
float3 baseAmbientColor = 0.0f;
float glossiness = 0.0f;
float3 diffuseBase = 0.0f;
float shadow = 0.0f;
float4 refractionColor = 0.0f;
float4 reflectionColor = 0.0f;
float3 emissiveColor = 0.0f;
float3 finalDiffuse = 0.0f;
float3 finalSpecular = 0.0f;
float4 color = 0.0f;
float const x_9 = *(tint_symbol_5);
if ((x_9 > 0.0f)) {
discard_fragment();
}
float const x_17 = *(tint_symbol_6);
if ((x_17 > 0.0f)) {
discard_fragment();
}
float4 const x_34 = (*(tint_symbol_7)).vEyePosition;
float3 const x_38 = float3(0.0f, 0.0f, 0.0f);
viewDirectionW = normalize((float3(x_34[0], x_34[1], x_34[2]) - x_38));
baseColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
float4 const x_52 = (*(tint_symbol_8)).vDiffuseColor;
diffuseColor = float3(x_52[0], x_52[1], x_52[2]);
float const x_60 = (*(tint_symbol_8)).vDiffuseColor[3];
alpha = x_60;
float3 const x_62 = float3(0.0f, 0.0f, 0.0f);
float3 const x_64 = float3(0.0f, 0.0f, 0.0f);
normalW = normalize(-(cross(dfdx(x_62), dfdy(x_64))));
uvOffset = float2(0.0f, 0.0f);
float4 const x_74 = float4(0.0f, 0.0f, 0.0f, 0.0f);
float4 const x_76 = baseColor;
float3 const x_78 = (float3(x_76[0], x_76[1], x_76[2]) * float3(x_74[0], x_74[1], x_74[2]));
float4 const x_79 = baseColor;
baseColor = float4(x_78[0], x_78[1], x_78[2], x_79[3]);
baseAmbientColor = float3(1.0f, 1.0f, 1.0f);
glossiness = 0.0f;
diffuseBase = float3(0.0f, 0.0f, 0.0f);
shadow = 1.0f;
refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
float3 const x_94 = (*(tint_symbol_8)).vEmissiveColor;
emissiveColor = x_94;
float3 const x_96 = diffuseBase;
float3 const x_97 = diffuseColor;
float3 const x_99 = emissiveColor;
float3 const x_103 = (*(tint_symbol_8)).vAmbientColor;
float4 const x_108 = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f, 0.0f, 0.0f), float3(1.0f, 1.0f, 1.0f)) * float3(x_108[0], x_108[1], x_108[2]));
finalSpecular = float3(0.0f, 0.0f, 0.0f);
float3 const x_113 = finalDiffuse;
float3 const x_114 = baseAmbientColor;
float3 const x_116 = finalSpecular;
float4 const x_118 = reflectionColor;
float4 const x_121 = refractionColor;
float3 const x_123 = ((((x_113 * x_114) + x_116) + float3(x_118[0], x_118[1], x_118[2])) + float3(x_121[0], x_121[1], x_121[2]));
float const x_124 = alpha;
color = float4(x_123[0], x_123[1], x_123[2], x_124);
float4 const x_129 = color;
float3 const x_132 = fmax(float3(x_129[0], x_129[1], x_129[2]), float3(0.0f, 0.0f, 0.0f));
float4 const x_133 = color;
color = float4(x_132[0], x_132[1], x_132[2], x_133[3]);
float const x_140 = (*(tint_symbol_9)).visibility;
float const x_142 = color[3];
color[3] = (x_142 * x_140);
float4 const x_147 = color;
*(tint_symbol_10) = x_147;
return;
}
struct main_out {
float4 glFragColor_1;
};
struct tint_symbol_2 {
float fClipDistance3_param [[user(locn2)]];
float fClipDistance4_param [[user(locn3)]];
};
struct tint_symbol_3 {
float4 glFragColor_1 [[color(0)]];
};
main_out tint_symbol_inner(float fClipDistance3_param, float fClipDistance4_param, thread float* const tint_symbol_11, thread float* const tint_symbol_12, const constant Scene* const tint_symbol_13, const constant Material* const tint_symbol_14, const constant Mesh* const tint_symbol_15, thread float4* const tint_symbol_16) {
*(tint_symbol_11) = fClipDistance3_param;
*(tint_symbol_12) = fClipDistance4_param;
main_1(tint_symbol_11, tint_symbol_12, tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16);
main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_16)};
return tint_symbol_4;
}
fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_19 [[buffer(0)]], const constant Material* tint_symbol_20 [[buffer(1)]], const constant Mesh* tint_symbol_21 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float tint_symbol_17 = 0.0f;
thread float tint_symbol_18 = 0.0f;
thread float4 tint_symbol_22 = 0.0f;
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_17), &(tint_symbol_18), tint_symbol_19, tint_symbol_20, tint_symbol_21, &(tint_symbol_22));
tint_symbol_3 wrapper_result = {};
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
return wrapper_result;
}

View File

@ -0,0 +1,295 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 187
; Schema: 0
OpCapability Shader
%69 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1
OpExecutionMode %main OriginUpperLeft
OpName %fClipDistance3_param_1 "fClipDistance3_param_1"
OpName %fClipDistance4_param_1 "fClipDistance4_param_1"
OpName %glFragColor_1_1 "glFragColor_1_1"
OpName %fClipDistance3 "fClipDistance3"
OpName %fClipDistance4 "fClipDistance4"
OpName %Scene "Scene"
OpMemberName %Scene 0 "vEyePosition"
OpName %x_29 "x_29"
OpName %Material "Material"
OpMemberName %Material 0 "vDiffuseColor"
OpMemberName %Material 1 "vAmbientColor"
OpMemberName %Material 2 "dummy"
OpMemberName %Material 3 "vEmissiveColor"
OpMemberName %Material 4 "dummy2"
OpName %x_49 "x_49"
OpName %Mesh "Mesh"
OpMemberName %Mesh 0 "visibility"
OpName %x_137 "x_137"
OpName %glFragColor "glFragColor"
OpName %main_1 "main_1"
OpName %viewDirectionW "viewDirectionW"
OpName %baseColor "baseColor"
OpName %diffuseColor "diffuseColor"
OpName %alpha "alpha"
OpName %normalW "normalW"
OpName %uvOffset "uvOffset"
OpName %baseAmbientColor "baseAmbientColor"
OpName %glossiness "glossiness"
OpName %diffuseBase "diffuseBase"
OpName %shadow "shadow"
OpName %refractionColor "refractionColor"
OpName %reflectionColor "reflectionColor"
OpName %emissiveColor "emissiveColor"
OpName %finalDiffuse "finalDiffuse"
OpName %finalSpecular "finalSpecular"
OpName %color "color"
OpName %main_out "main_out"
OpMemberName %main_out 0 "glFragColor_1"
OpName %main_inner "main_inner"
OpName %fClipDistance3_param "fClipDistance3_param"
OpName %fClipDistance4_param "fClipDistance4_param"
OpName %main "main"
OpDecorate %fClipDistance3_param_1 Location 2
OpDecorate %fClipDistance4_param_1 Location 3
OpDecorate %glFragColor_1_1 Location 0
OpDecorate %Scene Block
OpMemberDecorate %Scene 0 Offset 0
OpDecorate %x_29 NonWritable
OpDecorate %x_29 DescriptorSet 0
OpDecorate %x_29 Binding 0
OpDecorate %Material Block
OpMemberDecorate %Material 0 Offset 0
OpMemberDecorate %Material 1 Offset 16
OpMemberDecorate %Material 2 Offset 28
OpMemberDecorate %Material 3 Offset 32
OpMemberDecorate %Material 4 Offset 44
OpDecorate %x_49 NonWritable
OpDecorate %x_49 DescriptorSet 0
OpDecorate %x_49 Binding 1
OpDecorate %Mesh Block
OpMemberDecorate %Mesh 0 Offset 0
OpDecorate %x_137 NonWritable
OpDecorate %x_137 DescriptorSet 0
OpDecorate %x_137 Binding 2
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%_ptr_Input_float = OpTypePointer Input %float
%fClipDistance3_param_1 = OpVariable %_ptr_Input_float Input
%fClipDistance4_param_1 = OpVariable %_ptr_Input_float Input
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%glFragColor_1_1 = OpVariable %_ptr_Output_v4float Output %8
%_ptr_Private_float = OpTypePointer Private %float
%11 = OpConstantNull %float
%fClipDistance3 = OpVariable %_ptr_Private_float Private %11
%fClipDistance4 = OpVariable %_ptr_Private_float Private %11
%Scene = OpTypeStruct %v4float
%_ptr_Uniform_Scene = OpTypePointer Uniform %Scene
%x_29 = OpVariable %_ptr_Uniform_Scene Uniform
%v3float = OpTypeVector %float 3
%Material = OpTypeStruct %v4float %v3float %float %v3float %float
%_ptr_Uniform_Material = OpTypePointer Uniform %Material
%x_49 = OpVariable %_ptr_Uniform_Material Uniform
%Mesh = OpTypeStruct %float
%_ptr_Uniform_Mesh = OpTypePointer Uniform %Mesh
%x_137 = OpVariable %_ptr_Uniform_Mesh Uniform
%_ptr_Private_v4float = OpTypePointer Private %v4float
%glFragColor = OpVariable %_ptr_Private_v4float Private %8
%void = OpTypeVoid
%25 = OpTypeFunction %void
%_ptr_Function_v3float = OpTypePointer Function %v3float
%31 = OpConstantNull %v3float
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%_ptr_Function_v2float = OpTypePointer Function %v2float
%41 = OpConstantNull %v2float
%float_0 = OpConstant %float 0
%bool = OpTypeBool
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%67 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%float_1 = OpConstant %float 1
%76 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%uint_3 = OpConstant %uint 3
%_ptr_Uniform_float = OpTypePointer Uniform %float
%92 = OpConstantComposite %v2float %float_0 %float_0
%93 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%110 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%111 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%uint_1 = OpConstant %uint 1
%main_out = OpTypeStruct %v4float
%172 = OpTypeFunction %main_out %float %float
%main_1 = OpFunction %void None %25
%28 = OpLabel
%viewDirectionW = OpVariable %_ptr_Function_v3float Function %31
%baseColor = OpVariable %_ptr_Function_v4float Function %8
%diffuseColor = OpVariable %_ptr_Function_v3float Function %31
%alpha = OpVariable %_ptr_Function_float Function %11
%normalW = OpVariable %_ptr_Function_v3float Function %31
%uvOffset = OpVariable %_ptr_Function_v2float Function %41
%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %31
%glossiness = OpVariable %_ptr_Function_float Function %11
%diffuseBase = OpVariable %_ptr_Function_v3float Function %31
%shadow = OpVariable %_ptr_Function_float Function %11
%refractionColor = OpVariable %_ptr_Function_v4float Function %8
%reflectionColor = OpVariable %_ptr_Function_v4float Function %8
%emissiveColor = OpVariable %_ptr_Function_v3float Function %31
%finalDiffuse = OpVariable %_ptr_Function_v3float Function %31
%finalSpecular = OpVariable %_ptr_Function_v3float Function %31
%color = OpVariable %_ptr_Function_v4float Function %8
%52 = OpLoad %float %fClipDistance3
%54 = OpFOrdGreaterThan %bool %52 %float_0
OpSelectionMerge %56 None
OpBranchConditional %54 %57 %56
%57 = OpLabel
OpKill
%56 = OpLabel
%58 = OpLoad %float %fClipDistance4
%59 = OpFOrdGreaterThan %bool %58 %float_0
OpSelectionMerge %60 None
OpBranchConditional %59 %61 %60
%61 = OpLabel
OpKill
%60 = OpLabel
%65 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0
%66 = OpLoad %v4float %65
%70 = OpCompositeExtract %float %66 0
%71 = OpCompositeExtract %float %66 1
%72 = OpCompositeExtract %float %66 2
%73 = OpCompositeConstruct %v3float %70 %71 %72
%74 = OpFSub %v3float %73 %67
%68 = OpExtInst %v3float %69 Normalize %74
OpStore %viewDirectionW %68
OpStore %baseColor %76
%77 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0
%78 = OpLoad %v4float %77
%79 = OpCompositeExtract %float %78 0
%80 = OpCompositeExtract %float %78 1
%81 = OpCompositeExtract %float %78 2
%82 = OpCompositeConstruct %v3float %79 %80 %81
OpStore %diffuseColor %82
%85 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3
%86 = OpLoad %float %85
OpStore %alpha %86
%90 = OpDPdx %v3float %67
%91 = OpDPdy %v3float %67
%89 = OpExtInst %v3float %69 Cross %90 %91
%88 = OpFNegate %v3float %89
%87 = OpExtInst %v3float %69 Normalize %88
OpStore %normalW %87
OpStore %uvOffset %92
%94 = OpLoad %v4float %baseColor
%95 = OpCompositeExtract %float %94 0
%96 = OpCompositeExtract %float %94 1
%97 = OpCompositeExtract %float %94 2
%98 = OpCompositeConstruct %v3float %95 %96 %97
%99 = OpCompositeExtract %float %93 0
%100 = OpCompositeExtract %float %93 1
%101 = OpCompositeExtract %float %93 2
%102 = OpCompositeConstruct %v3float %99 %100 %101
%103 = OpFMul %v3float %98 %102
%104 = OpLoad %v4float %baseColor
%105 = OpCompositeExtract %float %103 0
%106 = OpCompositeExtract %float %103 1
%107 = OpCompositeExtract %float %103 2
%108 = OpCompositeExtract %float %104 3
%109 = OpCompositeConstruct %v4float %105 %106 %107 %108
OpStore %baseColor %109
OpStore %baseAmbientColor %110
OpStore %glossiness %float_0
OpStore %diffuseBase %67
OpStore %shadow %float_1
OpStore %refractionColor %111
OpStore %reflectionColor %111
%113 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3
%114 = OpLoad %v3float %113
OpStore %emissiveColor %114
%115 = OpLoad %v3float %diffuseBase
%116 = OpLoad %v3float %diffuseColor
%117 = OpLoad %v3float %emissiveColor
%119 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1
%120 = OpLoad %v3float %119
%121 = OpLoad %v4float %baseColor
%123 = OpFMul %v3float %115 %116
%124 = OpFAdd %v3float %123 %117
%125 = OpFAdd %v3float %124 %120
%122 = OpExtInst %v3float %69 NClamp %125 %67 %110
%126 = OpCompositeExtract %float %121 0
%127 = OpCompositeExtract %float %121 1
%128 = OpCompositeExtract %float %121 2
%129 = OpCompositeConstruct %v3float %126 %127 %128
%130 = OpFMul %v3float %122 %129
OpStore %finalDiffuse %130
OpStore %finalSpecular %67
%131 = OpLoad %v3float %finalDiffuse
%132 = OpLoad %v3float %baseAmbientColor
%133 = OpLoad %v3float %finalSpecular
%134 = OpLoad %v4float %reflectionColor
%135 = OpLoad %v4float %refractionColor
%136 = OpFMul %v3float %131 %132
%137 = OpFAdd %v3float %136 %133
%138 = OpCompositeExtract %float %134 0
%139 = OpCompositeExtract %float %134 1
%140 = OpCompositeExtract %float %134 2
%141 = OpCompositeConstruct %v3float %138 %139 %140
%142 = OpFAdd %v3float %137 %141
%143 = OpCompositeExtract %float %135 0
%144 = OpCompositeExtract %float %135 1
%145 = OpCompositeExtract %float %135 2
%146 = OpCompositeConstruct %v3float %143 %144 %145
%147 = OpFAdd %v3float %142 %146
%148 = OpLoad %float %alpha
%149 = OpCompositeExtract %float %147 0
%150 = OpCompositeExtract %float %147 1
%151 = OpCompositeExtract %float %147 2
%152 = OpCompositeConstruct %v4float %149 %150 %151 %148
OpStore %color %152
%153 = OpLoad %v4float %color
%155 = OpCompositeExtract %float %153 0
%156 = OpCompositeExtract %float %153 1
%157 = OpCompositeExtract %float %153 2
%158 = OpCompositeConstruct %v3float %155 %156 %157
%154 = OpExtInst %v3float %69 NMax %158 %67
%159 = OpLoad %v4float %color
%160 = OpCompositeExtract %float %154 0
%161 = OpCompositeExtract %float %154 1
%162 = OpCompositeExtract %float %154 2
%163 = OpCompositeExtract %float %159 3
%164 = OpCompositeConstruct %v4float %160 %161 %162 %163
OpStore %color %164
%165 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0
%166 = OpLoad %float %165
%167 = OpAccessChain %_ptr_Function_float %color %uint_3
%168 = OpLoad %float %167
%169 = OpAccessChain %_ptr_Function_float %color %uint_3
%170 = OpFMul %float %168 %166
OpStore %169 %170
%171 = OpLoad %v4float %color
OpStore %glFragColor %171
OpReturn
OpFunctionEnd
%main_inner = OpFunction %main_out None %172
%fClipDistance3_param = OpFunctionParameter %float
%fClipDistance4_param = OpFunctionParameter %float
%177 = OpLabel
OpStore %fClipDistance3 %fClipDistance3_param
OpStore %fClipDistance4 %fClipDistance4_param
%178 = OpFunctionCall %void %main_1
%179 = OpLoad %v4float %glFragColor
%180 = OpCompositeConstruct %main_out %179
OpReturnValue %180
OpFunctionEnd
%main = OpFunction %void None %25
%182 = OpLabel
%184 = OpLoad %float %fClipDistance3_param_1
%185 = OpLoad %float %fClipDistance4_param_1
%183 = OpFunctionCall %main_out %main_inner %184 %185
%186 = OpCompositeExtract %v4float %183 0
OpStore %glFragColor_1_1 %186
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,117 @@
struct Scene {
vEyePosition : vec4<f32>;
}
struct Material {
vDiffuseColor : vec4<f32>;
vAmbientColor : vec3<f32>;
dummy : f32;
vEmissiveColor : vec3<f32>;
dummy2 : f32;
}
struct Mesh {
visibility : f32;
}
var<private> fClipDistance3 : f32;
var<private> fClipDistance4 : f32;
@group(0) @binding(0) var<uniform> x_29 : Scene;
@group(0) @binding(1) var<uniform> x_49 : Material;
@group(0) @binding(2) var<uniform> x_137 : Mesh;
var<private> glFragColor : vec4<f32>;
fn main_1() {
var viewDirectionW : vec3<f32>;
var baseColor : vec4<f32>;
var diffuseColor : vec3<f32>;
var alpha : f32;
var normalW : vec3<f32>;
var uvOffset : vec2<f32>;
var baseAmbientColor : vec3<f32>;
var glossiness : f32;
var diffuseBase : vec3<f32>;
var shadow : f32;
var refractionColor : vec4<f32>;
var reflectionColor : vec4<f32>;
var emissiveColor : vec3<f32>;
var finalDiffuse : vec3<f32>;
var finalSpecular : vec3<f32>;
var color : vec4<f32>;
let x_9 : f32 = fClipDistance3;
if ((x_9 > 0.0)) {
discard;
}
let x_17 : f32 = fClipDistance4;
if ((x_17 > 0.0)) {
discard;
}
let x_34 : vec4<f32> = x_29.vEyePosition;
let x_38 : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
viewDirectionW = normalize((vec3<f32>(x_34.x, x_34.y, x_34.z) - x_38));
baseColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
let x_52 : vec4<f32> = x_49.vDiffuseColor;
diffuseColor = vec3<f32>(x_52.x, x_52.y, x_52.z);
let x_60 : f32 = x_49.vDiffuseColor.w;
alpha = x_60;
let x_62 : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
let x_64 : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
uvOffset = vec2<f32>(0.0, 0.0);
let x_74 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);
let x_76 : vec4<f32> = baseColor;
let x_78 : vec3<f32> = (vec3<f32>(x_76.x, x_76.y, x_76.z) * vec3<f32>(x_74.x, x_74.y, x_74.z));
let x_79 : vec4<f32> = baseColor;
baseColor = vec4<f32>(x_78.x, x_78.y, x_78.z, x_79.w);
baseAmbientColor = vec3<f32>(1.0, 1.0, 1.0);
glossiness = 0.0;
diffuseBase = vec3<f32>(0.0, 0.0, 0.0);
shadow = 1.0;
refractionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0);
reflectionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0);
let x_94 : vec3<f32> = x_49.vEmissiveColor;
emissiveColor = x_94;
let x_96 : vec3<f32> = diffuseBase;
let x_97 : vec3<f32> = diffuseColor;
let x_99 : vec3<f32> = emissiveColor;
let x_103 : vec3<f32> = x_49.vAmbientColor;
let x_108 : vec4<f32> = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(1.0, 1.0, 1.0)) * vec3<f32>(x_108.x, x_108.y, x_108.z));
finalSpecular = vec3<f32>(0.0, 0.0, 0.0);
let x_113 : vec3<f32> = finalDiffuse;
let x_114 : vec3<f32> = baseAmbientColor;
let x_116 : vec3<f32> = finalSpecular;
let x_118 : vec4<f32> = reflectionColor;
let x_121 : vec4<f32> = refractionColor;
let x_123 : vec3<f32> = ((((x_113 * x_114) + x_116) + vec3<f32>(x_118.x, x_118.y, x_118.z)) + vec3<f32>(x_121.x, x_121.y, x_121.z));
let x_124 : f32 = alpha;
color = vec4<f32>(x_123.x, x_123.y, x_123.z, x_124);
let x_129 : vec4<f32> = color;
let x_132 : vec3<f32> = max(vec3<f32>(x_129.x, x_129.y, x_129.z), vec3<f32>(0.0, 0.0, 0.0));
let x_133 : vec4<f32> = color;
color = vec4<f32>(x_132.x, x_132.y, x_132.z, x_133.w);
let x_140 : f32 = x_137.visibility;
let x_142 : f32 = color.w;
color.w = (x_142 * x_140);
let x_147 : vec4<f32> = color;
glFragColor = x_147;
return;
}
struct main_out {
@location(0)
glFragColor_1 : vec4<f32>;
}
@stage(fragment)
fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out {
fClipDistance3 = fClipDistance3_param;
fClipDistance4 = fClipDistance4_param;
main_1();
return main_out(glFragColor);
}