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

131 lines
5.1 KiB
Plaintext

#include <metal_stdlib>
using namespace metal;
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_5, thread bool* const tint_symbol_6, thread float* const tint_symbol_7, const constant Scene* const tint_symbol_8, const constant Material* const tint_symbol_9, const constant Mesh* const tint_symbol_10, thread float4* const tint_symbol_11) {
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)) {
*(tint_symbol_6) = true;
}
float const x_17 = *(tint_symbol_7);
if ((x_17 > 0.0f)) {
*(tint_symbol_6) = true;
}
float4 const x_34 = (*(tint_symbol_8)).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_9)).vDiffuseColor;
diffuseColor = float3(x_52[0], x_52[1], x_52[2]);
float const x_60 = (*(tint_symbol_9)).vDiffuseColor[3];
alpha = x_60;
float3 const x_62 = float3(0.0f);
float3 const x_64 = float3(0.0f);
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 = float3((*(tint_symbol_9)).vEmissiveColor);
emissiveColor = x_94;
float3 const x_96 = diffuseBase;
float3 const x_97 = diffuseColor;
float3 const x_99 = emissiveColor;
float3 const x_103 = float3((*(tint_symbol_9)).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_10)).visibility;
float const x_142 = color[3];
color[3] = (x_142 * x_140);
float4 const x_147 = color;
*(tint_symbol_11) = 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_12, thread float* const tint_symbol_13, thread bool* const tint_symbol_14, const constant Scene* const tint_symbol_15, const constant Material* const tint_symbol_16, const constant Mesh* const tint_symbol_17, thread float4* const tint_symbol_18) {
*(tint_symbol_12) = fClipDistance3_param;
*(tint_symbol_13) = fClipDistance4_param;
main_1(tint_symbol_12, tint_symbol_14, tint_symbol_13, tint_symbol_15, tint_symbol_16, tint_symbol_17, tint_symbol_18);
main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_18)};
return tint_symbol_4;
}
fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_22 [[buffer(0)]], const constant Material* tint_symbol_23 [[buffer(1)]], const constant Mesh* tint_symbol_24 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float tint_symbol_19 = 0.0f;
thread float tint_symbol_20 = 0.0f;
thread bool tint_symbol_21 = false;
thread float4 tint_symbol_25 = 0.0f;
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_19), &(tint_symbol_20), &(tint_symbol_21), tint_symbol_22, tint_symbol_23, tint_symbol_24, &(tint_symbol_25));
tint_symbol_3 wrapper_result = {};
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
if (tint_symbol_21) {
discard_fragment();
}
return wrapper_result;
}