blob: 9c6169c44c08da4a98212dfb813f4f78cf920112 [file] [log] [blame] [edit]
SKIP: FAILED
#include <metal_stdlib>
using namespace metal;
struct lightingInfo {
float3 diffuse;
float3 specular;
};
struct LeftOver {
float4x4 u_World;
float4x4 u_ViewProjection;
float u_bumpStrength;
uint padding;
float3 u_cameraPosition;
float u_parallaxScale;
float textureInfoName;
uint padding_1;
float2 tangentSpaceParameter0;
};
struct Light0 {
float4 vLightData;
float4 vLightDiffuse;
float4 vLightSpecular;
float3 vLightGround;
uint padding_2;
float4 shadowsInfo;
float2 depthValues;
};
struct tint_module_vars_struct {
thread float* u_Float;
thread float3* u_Color;
texture2d<float, access::sample> TextureSamplerTexture;
sampler TextureSamplerSampler;
thread float2* vMainuv;
const constant LeftOver* x_269;
thread float4* v_output1;
thread bool* gl_FrontFacing;
thread float2* v_uv;
thread float4* v_output2;
texture2d<float, access::sample> TextureSampler1Texture;
sampler TextureSampler1Sampler;
const constant Light0* light0;
thread float4* glFragColor;
sampler bumpSamplerSampler;
texture2d<float, access::sample> bumpSamplerTexture;
};
struct main_out {
float4 glFragColor_1;
};
struct tint_symbol_outputs {
float4 main_out_glFragColor_1 [[color(0)]];
};
struct tint_symbol_inputs {
float2 vMainuv_param [[user(locn1)]];
float4 v_output1_param [[user(locn0)]];
float2 v_uv_param [[user(locn3)]];
float4 v_output2_param [[user(locn2)]];
};
float3x3 cotangent_frame_vf3_vf3_vf2_vf2_(thread float3* const normal_1, thread float3* const p, thread float2* const uv, thread float2* const tangentSpaceParams) {
float3 dp1 = 0.0f;
float3 dp2 = 0.0f;
float2 duv1 = 0.0f;
float2 duv2 = 0.0f;
float3 dp2perp = 0.0f;
float3 dp1perp = 0.0f;
float3 tangent = 0.0f;
float3 bitangent = 0.0f;
float invmax = 0.0f;
float3 const x_133 = (*p);
dp1 = dfdx(x_133);
float3 const x_136 = (*p);
dp2 = dfdy(x_136);
float2 const x_139 = (*uv);
duv1 = dfdx(x_139);
float2 const x_142 = (*uv);
duv2 = dfdy(x_142);
float3 const x_145 = dp2;
float3 const x_146 = (*normal_1);
dp2perp = cross(x_145, x_146);
float3 const x_149 = (*normal_1);
float3 const x_150 = dp1;
dp1perp = cross(x_149, x_150);
float3 const x_153 = dp2perp;
float const x_155 = duv1[0u];
float3 const x_157 = dp1perp;
float const x_159 = duv2[0u];
tangent = ((x_153 * x_155) + (x_157 * x_159));
float3 const x_163 = dp2perp;
float const x_165 = duv1[1u];
float3 const x_167 = dp1perp;
float const x_169 = duv2[1u];
bitangent = ((x_163 * x_165) + (x_167 * x_169));
float const x_173 = (*tangentSpaceParams)[0u];
float3 const x_174 = tangent;
tangent = (x_174 * x_173);
float const x_177 = (*tangentSpaceParams)[1u];
float3 const x_178 = bitangent;
bitangent = (x_178 * x_177);
float3 const x_181 = tangent;
float3 const x_182 = tangent;
float3 const x_184 = bitangent;
float3 const x_185 = bitangent;
float const v = dot(x_181, x_182);
invmax = rsqrt(max(v, dot(x_184, x_185)));
float3 const x_189 = tangent;
float const x_190 = invmax;
float3 const x_191 = (x_189 * x_190);
float3 const x_192 = bitangent;
float const x_193 = invmax;
float3 const x_194 = (x_192 * x_193);
float3 const x_195 = (*normal_1);
float3 const v_1 = float3(x_191[0u], x_191[1u], x_191[2u]);
float3 const v_2 = float3(x_194[0u], x_194[1u], x_194[2u]);
return float3x3(v_1, v_2, float3(x_195[0u], x_195[1u], x_195[2u]));
}
float3x3 transposeMat3_mf33_(thread float3x3* const inMatrix) {
float3 i0 = 0.0f;
float3 i1 = 0.0f;
float3 i2 = 0.0f;
float3x3 outMatrix = float3x3(0.0f);
float3 const x_60 = (*inMatrix)[0];
i0 = x_60;
float3 const x_64 = (*inMatrix)[1];
i1 = x_64;
float3 const x_68 = (*inMatrix)[2];
i2 = x_68;
float const x_73 = i0[0u];
float const x_75 = i1[0u];
float const x_77 = i2[0u];
float3 const x_78 = float3(x_73, x_75, x_77);
float const x_81 = i0[1u];
float const x_83 = i1[1u];
float const x_85 = i2[1u];
float3 const x_86 = float3(x_81, x_83, x_85);
float const x_89 = i0[2u];
float const x_91 = i1[2u];
float const x_93 = i2[2u];
float3 const x_94 = float3(x_89, x_91, x_93);
float3 const v_3 = float3(x_78[0u], x_78[1u], x_78[2u]);
float3 const v_4 = float3(x_86[0u], x_86[1u], x_86[2u]);
outMatrix = float3x3(v_3, v_4, float3(x_94[0u], x_94[1u], x_94[2u]));
float3x3 const x_110 = outMatrix;
return x_110;
}
float3 perturbNormalBase_mf33_vf3_f1_(thread float3x3* const cotangentFrame, thread float3* const normal, thread float* const scale) {
float3x3 const x_113 = (*cotangentFrame);
float3 const x_114 = (*normal);
return normalize((x_113 * x_114));
}
float3 perturbNormal_mf33_vf3_f1_(thread float3x3* const cotangentFrame_1, thread float3* const textureSample, thread float* const scale_1) {
float3x3 param = float3x3(0.0f);
float3 param_1 = 0.0f;
float param_2 = 0.0f;
float3 const x_119 = (*textureSample);
float3x3 const x_125 = (*cotangentFrame_1);
param = x_125;
param_1 = ((x_119 * 2.0f) - float3(1.0f));
float const x_128 = (*scale_1);
param_2 = x_128;
float3 const x_129 = perturbNormalBase_mf33_vf3_f1_((&param), (&param_1), (&param_2));
return x_129;
}
lightingInfo computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(thread float3* const viewDirectionW, thread float3* const vNormal, thread float4* const lightData, thread float3* const diffuseColor, thread float3* const specularColor, thread float3* const groundColor, thread float* const glossiness) {
float ndl = 0.0f;
lightingInfo result = {};
float3 angleW = 0.0f;
float specComp = 0.0f;
float3 const x_212 = (*vNormal);
float4 const x_213 = (*lightData);
ndl = ((dot(x_212, float3(x_213[0u], x_213[1u], x_213[2u])) * 0.5f) + 0.5f);
float3 const x_220 = (*groundColor);
float3 const x_221 = (*diffuseColor);
float const x_222 = ndl;
result.diffuse = mix(x_220, x_221, float3(x_222, x_222, x_222));
float3 const x_227 = (*viewDirectionW);
float4 const x_228 = (*lightData);
angleW = normalize((x_227 + float3(x_228[0u], x_228[1u], x_228[2u])));
float3 const x_233 = (*vNormal);
float3 const x_234 = angleW;
specComp = max(0.0f, dot(x_233, x_234));
float const x_237 = specComp;
float const x_238 = (*glossiness);
specComp = powr(x_237, max(1.0f, x_238));
float const x_241 = specComp;
float3 const x_242 = (*specularColor);
result.specular = (x_242 * x_241);
lightingInfo const x_245 = result;
return x_245;
}
void main_1(tint_module_vars_struct tint_module_vars) {
float4 tempTextureRead = 0.0f;
float3 rgb = 0.0f;
float3 output5 = 0.0f;
float4 output4 = 0.0f;
float2 uvOffset = 0.0f;
float normalScale = 0.0f;
float2 TBNUV = 0.0f;
float2 x_299 = 0.0f;
float3x3 TBN = float3x3(0.0f);
float3 param_3 = 0.0f;
float3 param_4 = 0.0f;
float2 param_5 = 0.0f;
float2 param_6 = 0.0f;
float3x3 invTBN = float3x3(0.0f);
float3x3 param_7 = float3x3(0.0f);
float parallaxLimit = 0.0f;
float2 vOffsetDir = 0.0f;
float2 vMaxOffset = 0.0f;
float numSamples = 0.0f;
float stepSize = 0.0f;
float currRayHeight = 0.0f;
float2 vCurrOffset = 0.0f;
float2 vLastOffset = 0.0f;
float lastSampledHeight = 0.0f;
float currSampledHeight = 0.0f;
int i = 0;
float delta1 = 0.0f;
float delta2 = 0.0f;
float ratio = 0.0f;
float2 parallaxOcclusion_0 = 0.0f;
float3x3 param_8 = float3x3(0.0f);
float3 param_9 = 0.0f;
float param_10 = 0.0f;
float2 output6 = 0.0f;
float4 tempTextureRead1 = 0.0f;
float3 rgb1 = 0.0f;
float3 viewDirectionW_1 = 0.0f;
float shadow = 0.0f;
float glossiness_1 = 0.0f;
float3 diffuseBase = 0.0f;
float3 specularBase = 0.0f;
float3 normalW = 0.0f;
lightingInfo info = {};
float3 param_11 = 0.0f;
float3 param_12 = 0.0f;
float4 param_13 = 0.0f;
float3 param_14 = 0.0f;
float3 param_15 = 0.0f;
float3 param_16 = 0.0f;
float param_17 = 0.0f;
float3 diffuseOutput = 0.0f;
float3 specularOutput = 0.0f;
float3 output3 = 0.0f;
(*tint_module_vars.u_Float) = 100.0f;
(*tint_module_vars.u_Color) = float3(0.5f);
float2 const x_261 = (*tint_module_vars.vMainuv);
float4 const x_262 = tint_module_vars.TextureSamplerTexture.sample(tint_module_vars.TextureSamplerSampler, x_261);
tempTextureRead = x_262;
float4 const x_264 = tempTextureRead;
float const x_273 = (*tint_module_vars.x_269).textureInfoName;
rgb = (float3(x_264[0u], x_264[1u], x_264[2u]) * x_273);
float3 const x_279 = (*tint_module_vars.x_269).u_cameraPosition;
float4 const x_282 = (*tint_module_vars.v_output1);
output5 = normalize((x_279 - float3(x_282[0u], x_282[1u], x_282[2u])));
output4 = float4(0.0f);
uvOffset = float2(0.0f);
float const x_292 = (*tint_module_vars.x_269).u_bumpStrength;
normalScale = (1.0f / x_292);
bool const x_298 = (*tint_module_vars.gl_FrontFacing);
if (x_298) {
float2 const x_303 = (*tint_module_vars.v_uv);
x_299 = x_303;
} else {
float2 const x_305 = (*tint_module_vars.v_uv);
x_299 = -(x_305);
}
float2 const x_307 = x_299;
TBNUV = x_307;
float4 const x_310 = (*tint_module_vars.v_output2);
float const x_312 = normalScale;
param_3 = (float3(x_310[0u], x_310[1u], x_310[2u]) * x_312);
float4 const x_317 = (*tint_module_vars.v_output1);
param_4 = float3(x_317[0u], x_317[1u], x_317[2u]);
float2 const x_320 = TBNUV;
param_5 = x_320;
float2 const x_324 = (*tint_module_vars.x_269).tangentSpaceParameter0;
param_6 = x_324;
float3x3 const x_325 = cotangent_frame_vf3_vf3_vf2_vf2_((&param_3), (&param_4), (&param_5), (&param_6));
TBN = x_325;
float3x3 const x_328 = TBN;
param_7 = x_328;
float3x3 const x_329 = transposeMat3_mf33_((&param_7));
invTBN = x_329;
float3x3 const x_331 = invTBN;
float3 const x_332 = output5;
float3 const x_334 = (x_331 * -(x_332));
float3x3 const x_337 = invTBN;
float3 const x_338 = output5;
parallaxLimit = (length(float2(x_334[0u], x_334[1u])) / (x_337 * -(x_338))[2u]);
float const x_345 = (*tint_module_vars.x_269).u_parallaxScale;
float const x_346 = parallaxLimit;
parallaxLimit = (x_346 * x_345);
float3x3 const x_349 = invTBN;
float3 const x_350 = output5;
float3 const x_352 = (x_349 * -(x_350));
vOffsetDir = normalize(float2(x_352[0u], x_352[1u]));
float2 const x_356 = vOffsetDir;
float const x_357 = parallaxLimit;
vMaxOffset = (x_356 * x_357);
float3x3 const x_361 = invTBN;
float3 const x_362 = output5;
float3x3 const x_365 = invTBN;
float4 const x_366 = (*tint_module_vars.v_output2);
numSamples = (15.0f + (dot((x_361 * -(x_362)), (x_365 * float3(x_366[0u], x_366[1u], x_366[2u]))) * -11.0f));
float const x_374 = numSamples;
stepSize = (1.0f / x_374);
currRayHeight = 1.0f;
vCurrOffset = float2(0.0f);
vLastOffset = float2(0.0f);
lastSampledHeight = 1.0f;
currSampledHeight = 1.0f;
i = 0;
{
while(true) {
int const x_388 = i;
if ((x_388 < 15)) {
} else {
break;
}
float2 const x_394 = (*tint_module_vars.v_uv);
float2 const x_395 = vCurrOffset;
float4 const x_397 = float4(0.0f);
currSampledHeight = x_397[3u];
float const x_400 = currSampledHeight;
float const x_401 = currRayHeight;
if ((x_400 > x_401)) {
float const x_406 = currSampledHeight;
float const x_407 = currRayHeight;
delta1 = (x_406 - x_407);
float const x_410 = currRayHeight;
float const x_411 = stepSize;
float const x_413 = lastSampledHeight;
delta2 = ((x_410 + x_411) - x_413);
float const x_416 = delta1;
float const x_417 = delta1;
float const x_418 = delta2;
ratio = (x_416 / (x_417 + x_418));
float const x_421 = ratio;
float2 const x_422 = vLastOffset;
float const x_424 = ratio;
float2 const x_426 = vCurrOffset;
vCurrOffset = ((x_422 * x_421) + (x_426 * (1.0f - x_424)));
break;
} else {
float const x_431 = stepSize;
float const x_432 = currRayHeight;
currRayHeight = (x_432 - x_431);
float2 const x_434 = vCurrOffset;
vLastOffset = x_434;
float const x_435 = stepSize;
float2 const x_436 = vMaxOffset;
float2 const x_438 = vCurrOffset;
vCurrOffset = (x_438 + (x_436 * x_435));
float const x_440 = currSampledHeight;
lastSampledHeight = x_440;
}
{
int const x_441 = i;
i = (x_441 + 1);
}
continue;
}
}
float2 const x_444 = vCurrOffset;
parallaxOcclusion_0 = x_444;
float2 const x_445 = parallaxOcclusion_0;
uvOffset = x_445;
float2 const x_449 = (*tint_module_vars.v_uv);
float2 const x_450 = uvOffset;
float4 const x_452 = tint_module_vars.TextureSamplerTexture.sample(tint_module_vars.TextureSamplerSampler, (x_449 + x_450));
float const x_454 = (*tint_module_vars.x_269).u_bumpStrength;
float3x3 const x_457 = TBN;
param_8 = x_457;
param_9 = float3(x_452[0u], x_452[1u], x_452[2u]);
param_10 = (1.0f / x_454);
float3 const x_461 = perturbNormal_mf33_vf3_f1_((&param_8), (&param_9), (&param_10));
float4 const x_462 = output4;
output4 = float4(x_461[0u], x_461[1u], x_461[2u], x_462[3u]);
float2 const x_465 = (*tint_module_vars.v_uv);
float2 const x_466 = uvOffset;
output6 = (x_465 + x_466);
float2 const x_474 = output6;
float4 const x_475 = tint_module_vars.TextureSampler1Texture.sample(tint_module_vars.TextureSampler1Sampler, x_474);
tempTextureRead1 = x_475;
float4 const x_477 = tempTextureRead1;
rgb1 = float3(x_477[0u], x_477[1u], x_477[2u]);
float3 const x_481 = (*tint_module_vars.x_269).u_cameraPosition;
float4 const x_482 = (*tint_module_vars.v_output1);
viewDirectionW_1 = normalize((x_481 - float3(x_482[0u], x_482[1u], x_482[2u])));
shadow = 1.0f;
float const x_488 = (*tint_module_vars.u_Float);
glossiness_1 = (1.0f * x_488);
diffuseBase = float3(0.0f);
specularBase = float3(0.0f);
float4 const x_494 = output4;
normalW = float3(x_494[0u], x_494[1u], x_494[2u]);
float3 const x_501 = viewDirectionW_1;
param_11 = x_501;
float3 const x_503 = normalW;
param_12 = x_503;
float4 const x_507 = (*tint_module_vars.light0).vLightData;
param_13 = x_507;
float4 const x_510 = (*tint_module_vars.light0).vLightDiffuse;
param_14 = float3(x_510[0u], x_510[1u], x_510[2u]);
float4 const x_514 = (*tint_module_vars.light0).vLightSpecular;
param_15 = float3(x_514[0u], x_514[1u], x_514[2u]);
float3 const x_518 = (*tint_module_vars.light0).vLightGround;
param_16 = x_518;
float const x_520 = glossiness_1;
param_17 = x_520;
lightingInfo const x_521 = computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_((&param_11), (&param_12), (&param_13), (&param_14), (&param_15), (&param_16), (&param_17));
info = x_521;
shadow = 1.0f;
float3 const x_523 = info.diffuse;
float const x_524 = shadow;
float3 const x_526 = diffuseBase;
diffuseBase = (x_526 + (x_523 * x_524));
float3 const x_529 = info.specular;
float const x_530 = shadow;
float3 const x_532 = specularBase;
specularBase = (x_532 + (x_529 * x_530));
float3 const x_535 = diffuseBase;
float3 const x_536 = rgb1;
diffuseOutput = (x_535 * x_536);
float3 const x_539 = specularBase;
float3 const x_540 = (*tint_module_vars.u_Color);
specularOutput = (x_539 * x_540);
float3 const x_543 = diffuseOutput;
float3 const x_544 = specularOutput;
output3 = (x_543 + x_544);
float3 const x_548 = output3;
(*tint_module_vars.glFragColor) = float4(x_548[0u], x_548[1u], x_548[2u], 1.0f);
}
main_out tint_symbol_inner(float2 vMainuv_param, float4 v_output1_param, bool gl_FrontFacing_param, float2 v_uv_param, float4 v_output2_param, tint_module_vars_struct tint_module_vars) {
(*tint_module_vars.vMainuv) = vMainuv_param;
(*tint_module_vars.v_output1) = v_output1_param;
(*tint_module_vars.gl_FrontFacing) = gl_FrontFacing_param;
(*tint_module_vars.v_uv) = v_uv_param;
(*tint_module_vars.v_output2) = v_output2_param;
main_1(tint_module_vars);
return main_out{.glFragColor_1=(*tint_module_vars.glFragColor)};
}
fragment tint_symbol_outputs tint_symbol(tint_symbol_inputs inputs [[stage_in]], bool gl_FrontFacing_param [[front_facing]], texture2d<float, access::sample> TextureSamplerTexture [[texture(0)]], sampler TextureSamplerSampler [[sampler(0)]], const constant LeftOver* x_269 [[buffer(0)]], texture2d<float, access::sample> TextureSampler1Texture [[texture(1)]], sampler TextureSampler1Sampler [[sampler(1)]], const constant Light0* light0 [[buffer(1)]]) {
thread float u_Float = 0.0f;
thread float3 u_Color = 0.0f;
thread float2 vMainuv = 0.0f;
thread float4 v_output1 = 0.0f;
thread bool gl_FrontFacing = false;
thread float2 v_uv = 0.0f;
thread float4 v_output2 = 0.0f;
thread float4 glFragColor = 0.0f;
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.u_Float=(&u_Float), .u_Color=(&u_Color), .TextureSamplerTexture=TextureSamplerTexture, .TextureSamplerSampler=TextureSamplerSampler, .vMainuv=(&vMainuv), .x_269=x_269, .v_output1=(&v_output1), .gl_FrontFacing=(&gl_FrontFacing), .v_uv=(&v_uv), .v_output2=(&v_output2), .TextureSampler1Texture=TextureSampler1Texture, .TextureSampler1Sampler=TextureSampler1Sampler, .light0=light0, .glFragColor=(&glFragColor)};
return tint_symbol_outputs{.main_out_glFragColor_1=tint_symbol_inner(inputs.vMainuv_param, inputs.v_output1_param, gl_FrontFacing_param, inputs.v_uv_param, inputs.v_output2_param, tint_module_vars).glFragColor_1};
}
program_source:331:20: warning: unused variable 'x_394' [-Wunused-variable]
float2 const x_394 = (*tint_module_vars.v_uv);
^
program_source:332:20: warning: unused variable 'x_395' [-Wunused-variable]
float2 const x_395 = vCurrOffset;
^
program_source:465:484: error: call to deleted constructor of 'texture2d<float, access::sample>'
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.u_Float=(&u_Float), .u_Color=(&u_Color), .TextureSamplerTexture=TextureSamplerTexture, .TextureSamplerSampler=TextureSamplerSampler, .vMainuv=(&vMainuv), .x_269=x_269, .v_output1=(&v_output1), .gl_FrontFacing=(&gl_FrontFacing), .v_uv=(&v_uv), .v_output2=(&v_output2), .TextureSampler1Texture=TextureSampler1Texture, .TextureSampler1Sampler=TextureSampler1Sampler, .light0=light0, .glFragColor=(&glFragColor)};
^
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.194/include/metal/metal_texture:6083:3: note: 'texture2d' has been explicitly marked deleted here
texture2d() thread = delete;
^
program_source:47:36: note: in implicit initialization of field 'bumpSamplerTexture' with omitted initializer
texture2d<float, access::sample> bumpSamplerTexture;
^