dawn-cmake/test/tint/bug/tint/1118.wgsl.expected.msl

167 lines
6.1 KiB
Plaintext

bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
^^^^
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
if ((x_9 > 0.0)) {
^^
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
let x_9 : f32 = fClipDistance3;
^^^^^^^^^^^^^^
#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 placeholder;
/* 0x0020 */ packed_float3 vEmissiveColor;
/* 0x002c */ float placeholder2;
};
struct Mesh {
/* 0x0000 */ float visibility;
};
void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8, thread float* const tint_symbol_9, const constant Scene* const tint_symbol_10, const constant Material* const tint_symbol_11, const constant Mesh* const tint_symbol_12, thread float4* const tint_symbol_13) {
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_7);
if ((x_9 > 0.0f)) {
*(tint_symbol_8) = true;
return;
}
float const x_17 = *(tint_symbol_9);
if ((x_17 > 0.0f)) {
*(tint_symbol_8) = true;
return;
}
float4 const x_34 = (*(tint_symbol_10)).vEyePosition;
float3 const x_38 = float3(0.0f);
viewDirectionW = normalize((float3(x_34[0], x_34[1], x_34[2]) - x_38));
baseColor = float4(1.0f);
float4 const x_52 = (*(tint_symbol_11)).vDiffuseColor;
diffuseColor = float3(x_52[0], x_52[1], x_52[2]);
float const x_60 = (*(tint_symbol_11)).vDiffuseColor[3];
alpha = x_60;
float3 const x_62 = float3(0.0f);
float3 const x_64 = float3(0.0f);
normalW = normalize(-(cross(dfdx(x_62), dfdy(x_64))));
uvOffset = float2(0.0f);
float4 const x_74 = float4(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);
glossiness = 0.0f;
diffuseBase = float3(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_11)).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_11)).vAmbientColor;
float4 const x_108 = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f), float3(1.0f)) * float3(x_108[0], x_108[1], x_108[2]));
finalSpecular = float3(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));
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_12)).visibility;
float const x_142 = color[3];
color[3] = (x_142 * x_140);
float4 const x_147 = color;
*(tint_symbol_13) = 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_14, thread float* const tint_symbol_15, thread bool* const tint_symbol_16, const constant Scene* const tint_symbol_17, const constant Material* const tint_symbol_18, const constant Mesh* const tint_symbol_19, thread float4* const tint_symbol_20) {
*(tint_symbol_14) = fClipDistance3_param;
*(tint_symbol_15) = fClipDistance4_param;
main_1(tint_symbol_14, tint_symbol_16, tint_symbol_15, tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20);
if (*(tint_symbol_16)) {
main_out const tint_symbol_4 = {};
return tint_symbol_4;
}
main_out const tint_symbol_5 = {.glFragColor_1=*(tint_symbol_20)};
return tint_symbol_5;
}
void tint_discard_func() {
discard_fragment();
}
fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_24 [[buffer(0)]], const constant Material* tint_symbol_25 [[buffer(1)]], const constant Mesh* tint_symbol_26 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float tint_symbol_21 = 0.0f;
thread float tint_symbol_22 = 0.0f;
thread bool tint_symbol_23 = false;
thread float4 tint_symbol_27 = 0.0f;
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_21), &(tint_symbol_22), &(tint_symbol_23), tint_symbol_24, tint_symbol_25, tint_symbol_26, &(tint_symbol_27));
if (tint_symbol_23) {
tint_discard_func();
tint_symbol_3 const tint_symbol_6 = {};
return tint_symbol_6;
}
tint_symbol_3 wrapper_result = {};
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
return wrapper_result;
}