bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt
2015-04-02 23:30:48 -07:00

164 lines
4.6 KiB
Plaintext

#include <metal_stdlib>
using namespace metal;
struct xlatMtlShaderInput {
float4 xlv_TEXCOORD0;
};
struct xlatMtlShaderOutput {
half4 _fragData [[color(0)]];
};
struct xlatMtlShaderUniform {
};
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{
xlatMtlShaderOutput _mtl_o;
half4 c_1;
c_1 = half4(float4(0.0, 0.0, 0.0, 0.0));
float tmpvar_2;
tmpvar_2 = (_mtl_i.xlv_TEXCOORD0.x / 2.0);
float tmpvar_3;
tmpvar_3 = (fract(abs(tmpvar_2)) * 2.0);
float tmpvar_4;
if ((tmpvar_2 >= 0.0)) {
tmpvar_4 = tmpvar_3;
} else {
tmpvar_4 = -(tmpvar_3);
};
c_1.x = half(tmpvar_4);
float2 tmpvar_5;
tmpvar_5 = (_mtl_i.xlv_TEXCOORD0.xy / float2(2.0, 2.0));
float2 tmpvar_6;
tmpvar_6 = (fract(abs(tmpvar_5)) * float2(2.0, 2.0));
float tmpvar_7;
if ((tmpvar_5.x >= 0.0)) {
tmpvar_7 = tmpvar_6.x;
} else {
tmpvar_7 = -(tmpvar_6.x);
};
float tmpvar_8;
if ((tmpvar_5.y >= 0.0)) {
tmpvar_8 = tmpvar_6.y;
} else {
tmpvar_8 = -(tmpvar_6.y);
};
float2 tmpvar_9;
tmpvar_9.x = tmpvar_7;
tmpvar_9.y = tmpvar_8;
c_1.xy = ((half2)((float2)c_1.xy + tmpvar_9));
float3 tmpvar_10;
tmpvar_10 = (_mtl_i.xlv_TEXCOORD0.xyz / float3(2.0, 2.0, 2.0));
float3 tmpvar_11;
tmpvar_11 = (fract(abs(tmpvar_10)) * float3(2.0, 2.0, 2.0));
float tmpvar_12;
if ((tmpvar_10.x >= 0.0)) {
tmpvar_12 = tmpvar_11.x;
} else {
tmpvar_12 = -(tmpvar_11.x);
};
float tmpvar_13;
if ((tmpvar_10.y >= 0.0)) {
tmpvar_13 = tmpvar_11.y;
} else {
tmpvar_13 = -(tmpvar_11.y);
};
float tmpvar_14;
if ((tmpvar_10.z >= 0.0)) {
tmpvar_14 = tmpvar_11.z;
} else {
tmpvar_14 = -(tmpvar_11.z);
};
float3 tmpvar_15;
tmpvar_15.x = tmpvar_12;
tmpvar_15.y = tmpvar_13;
tmpvar_15.z = tmpvar_14;
c_1.xyz = ((half3)((float3)c_1.xyz + tmpvar_15));
float4 tmpvar_16;
tmpvar_16 = (_mtl_i.xlv_TEXCOORD0 / float4(2.0, 2.0, 2.0, 2.0));
float4 tmpvar_17;
tmpvar_17 = (fract(abs(tmpvar_16)) * float4(2.0, 2.0, 2.0, 2.0));
float tmpvar_18;
if ((tmpvar_16.x >= 0.0)) {
tmpvar_18 = tmpvar_17.x;
} else {
tmpvar_18 = -(tmpvar_17.x);
};
float tmpvar_19;
if ((tmpvar_16.y >= 0.0)) {
tmpvar_19 = tmpvar_17.y;
} else {
tmpvar_19 = -(tmpvar_17.y);
};
float tmpvar_20;
if ((tmpvar_16.z >= 0.0)) {
tmpvar_20 = tmpvar_17.z;
} else {
tmpvar_20 = -(tmpvar_17.z);
};
float tmpvar_21;
if ((tmpvar_16.w >= 0.0)) {
tmpvar_21 = tmpvar_17.w;
} else {
tmpvar_21 = -(tmpvar_17.w);
};
float4 tmpvar_22;
tmpvar_22.x = tmpvar_18;
tmpvar_22.y = tmpvar_19;
tmpvar_22.z = tmpvar_20;
tmpvar_22.w = tmpvar_21;
c_1 = ((half4)((float4)c_1 + tmpvar_22));
float tmpvar_23;
half ip_24;
int tmpvar_25;
tmpvar_25 = int(_mtl_i.xlv_TEXCOORD0.x);
ip_24 = half(float(tmpvar_25));
tmpvar_23 = (_mtl_i.xlv_TEXCOORD0.x - (float)ip_24);
c_1.x = ((half)((float)c_1.x + tmpvar_23));
float2 tmpvar_26;
int2 tmpvar_27;
tmpvar_27 = int2(_mtl_i.xlv_TEXCOORD0.xy);
half2 tmpvar_28;
tmpvar_28 = half2(float2(tmpvar_27));
tmpvar_26 = (_mtl_i.xlv_TEXCOORD0.xy - (float2)tmpvar_28);
c_1.xy = ((half2)((float2)c_1.xy + tmpvar_26));
float3 tmpvar_29;
int3 tmpvar_30;
tmpvar_30 = int3(_mtl_i.xlv_TEXCOORD0.xyz);
half3 tmpvar_31;
tmpvar_31 = half3(float3(tmpvar_30));
tmpvar_29 = (_mtl_i.xlv_TEXCOORD0.xyz - (float3)tmpvar_31);
c_1.xyz = ((half3)((float3)c_1.xyz + tmpvar_29));
float4 tmpvar_32;
int4 tmpvar_33;
tmpvar_33 = int4(_mtl_i.xlv_TEXCOORD0);
half4 tmpvar_34;
tmpvar_34 = half4(float4(tmpvar_33));
tmpvar_32 = (_mtl_i.xlv_TEXCOORD0 - (float4)tmpvar_34);
c_1 = ((half4)((float4)c_1 + tmpvar_32));
float tmpvar_35;
tmpvar_35 = (float(fmod (_mtl_i.xlv_TEXCOORD0.x, (float)tmpvar_34.x)));
c_1.x = half(((float)c_1.x + tmpvar_35));
float2 tmpvar_36;
tmpvar_36 = (float2(fmod (_mtl_i.xlv_TEXCOORD0.xy, (float2)tmpvar_34.xy)));
c_1.xy = half2(((float2)c_1.xy + tmpvar_36));
float3 tmpvar_37;
tmpvar_37 = (float3(fmod (_mtl_i.xlv_TEXCOORD0.xyz, (float3)tmpvar_34.xyz)));
c_1.xyz = half3(((float3)c_1.xyz + tmpvar_37));
float tmpvar_38;
tmpvar_38 = (1.0/(_mtl_i.xlv_TEXCOORD0.x));
c_1.x = half(((float)c_1.x + tmpvar_38));
float tmpvar_39;
tmpvar_39 = max (0.0, tmpvar_38);
c_1.x = half(((float)c_1.x + tmpvar_39));
c_1.y = (c_1.y + ((half)1.0/(c_1.z)));
c_1.y = (c_1.y + max ((half)0.0, ((half)1.0/(c_1.w))));
float tmpvar_40;
tmpvar_40 = max (_mtl_i.xlv_TEXCOORD0.x, (float)c_1.z);
c_1.x = half(((float)c_1.x + tmpvar_40));
_mtl_o._fragData = c_1;
return _mtl_o;
}
// stats: 73 alu 0 tex 10 flow
// inputs: 1
// #0: xlv_TEXCOORD0 (high float) 4x1 [-1]