Project

General

Profile

Emulator Issues #9312 ยป bad_ps_0000.txt

theincrediblemastere, 02/02/2016 07:01 PM

 
#version 400

#define FORCE_EARLY_Z layout(early_fragment_tests) in
#extension GL_ARB_shader_image_load_store : enable

#extension GL_ARB_shading_language_420pack : enable

#define SAMPLER_BINDING(x) layout(binding = x)
#extension GL_ARB_shader_storage_buffer_object : enable












#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define frac fract
#define lerp mix
//Pixel Shader for TEV stages
//12 TEV stages, 3 texgens, 1 IND stages
int idot(int3 x, int3 y)
{
int3 tmp = x * y;
return tmp.x + tmp.y + tmp.z;
}
int idot(int4 x, int4 y)
{
int4 tmp = x * y;
return tmp.x + tmp.y + tmp.z + tmp.w;
}

int iround(float x) { return int (round(x)); }
int2 iround(float2 x) { return int2(round(x)); }
int3 iround(float3 x) { return int3(round(x)); }
int4 iround(float4 x) { return int4(round(x)); }

int itrunc(float x) { return int (trunc(x)); }
int2 itrunc(float2 x) { return int2(trunc(x)); }
int3 itrunc(float3 x) { return int3(trunc(x)); }
int4 itrunc(float4 x) { return int4(trunc(x)); }

SAMPLER_BINDING(0) uniform sampler2DArray samp[8];

layout(std140, binding = 1) uniform PSBlock {
int4 color[4];
int4 k[4];
int4 alphaRef;
float4 texdim[8];
int4 czbias[2];
int4 cindscale[2];
int4 cindmtx[6];
int4 cfogcolor;
int4 cfogi;
float4 cfogf[2];
float4 czslope;
float4 cefbscale;
};
struct Light {
int4 color;
float4 cosatt;
float4 distatt;
float4 pos;
float4 dir;
};
layout(std140, binding = 2) uniform VSBlock {
float4 cpnmtx[6];
float4 cproj[4];
int4 cmtrl[4];
Light clights[8];
float4 ctexmtx[24];
float4 ctrmtx[64];
float4 cnmtx[32];
float4 cpostmtx[64];
float4 cpixelcenter;
};
struct VS_OUTPUT {
float4 pos;
float4 colors_0;
float4 colors_1;
float3 tex0;
float3 tex1;
float4 clipPos;
float3 Normal;
float3 WorldPos;
};
out vec4 ocol0;
#define depth gl_FragDepth
in VertexData {
centroid float4 pos;
centroid float4 colors_0;
centroid float4 colors_1;
centroid float3 tex0;
centroid float3 tex1;
centroid float4 clipPos;
centroid float3 Normal;
centroid float3 WorldPos;
};
void main()
{
float3 uv0 = tex0;
float3 uv1 = tex1;
float3 uv2 = tex2;
float4 rawpos = gl_FragCoord;
int4 c0 = color[1], c1 = color[2], c2 = color[3], prev = color[0];
int4 rastemp = int4(0, 0, 0, 0), textemp = int4(0, 0, 0, 0), konsttemp = int4(0, 0, 0, 0);
int3 comp16 = int3(1, 256, 0), comp24 = int3(1, 256, 256*256);
int alphabump=0;
int3 tevcoord=int3(0, 0, 0);
int2 wrappedcoord=int2(0,0), tempcoord=int2(0,0);
int4 tevin_a=int4(0,0,0,0),tevin_b=int4(0,0,0,0),tevin_c=int4(0,0,0,0),tevin_d=int4(0,0,0,0);

float4 col0 = colors_0;
float4 col1 = colors_1;
float3 _norm0 = normalize(Normal.xyz);

float3 pos = WorldPos;
int4 lacc;
float3 ldir, h, cosAttn, distAttn;
float dist, dist2, attn;
{
int4 mat = cmtrl[2];
lacc = cmtrl[0];
lacc.w = cmtrl[0].w;
ldir = clights[0].pos.xyz - pos.xyz;
dist2 = dot(ldir, ldir);
dist = sqrt(dist2);
ldir = ldir / dist;
attn = max(0.0, dot(ldir, clights[0].dir.xyz));
attn = max(0.0, clights[0].cosatt.x + clights[0].cosatt.y*attn + clights[0].cosatt.z*attn*attn) / dot(clights[0].distatt.xyz, float3(1.0,dist,dist2));
lacc.xyzw += int4(round(attn * max(0.0,dot(ldir, _norm0)) * float4(clights[0].color.xyzw)));

ldir = clights[1].pos.xyz - pos.xyz;
dist2 = dot(ldir, ldir);
dist = sqrt(dist2);
ldir = ldir / dist;
attn = max(0.0, dot(ldir, clights[1].dir.xyz));
attn = max(0.0, clights[1].cosatt.x + clights[1].cosatt.y*attn + clights[1].cosatt.z*attn*attn) / dot(clights[1].distatt.xyz, float3(1.0,dist,dist2));
lacc.xyzw += int4(round(attn * max(0.0,dot(ldir, _norm0)) * float4(clights[1].color.xyzw)));

ldir = clights[2].pos.xyz - pos.xyz;
dist2 = dot(ldir, ldir);
dist = sqrt(dist2);
ldir = ldir / dist;
attn = max(0.0, dot(ldir, clights[2].dir.xyz));
attn = max(0.0, clights[2].cosatt.x + clights[2].cosatt.y*attn + clights[2].cosatt.z*attn*attn) / dot(clights[2].distatt.xyz, float3(1.0,dist,dist2));
lacc.xyzw += int4(round(attn * max(0.0,dot(ldir, _norm0)) * float4(clights[2].color.xyzw)));

ldir = clights[3].pos.xyz - pos.xyz;
dist2 = dot(ldir, ldir);
dist = sqrt(dist2);
ldir = ldir / dist;
attn = max(0.0, dot(ldir, clights[3].dir.xyz));
attn = max(0.0, clights[3].cosatt.x + clights[3].cosatt.y*attn + clights[3].cosatt.z*attn*attn) / dot(clights[3].distatt.xyz, float3(1.0,dist,dist2));
lacc.xyzw += int4(round(attn * max(0.0,dot(ldir, _norm0)) * float4(clights[3].color.xyzw)));

lacc = clamp(lacc, 0, 255);
col0 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;
}
int2 fixpoint_uv0 = itrunc(uv0.xy * texdim[0].zw * 128.0);
int2 fixpoint_uv1 = itrunc((uv1.z == 0.0 ? uv1.xy : uv1.xy / uv1.z) * texdim[1].zw * 128.0);
int2 fixpoint_uv2 = itrunc((uv2.z == 0.0 ? uv2.xy : uv2.xy / uv2.z) * texdim[2].zw * 128.0);

// TEV stage 0
// indirect op
int2 indtevtrans0 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans0;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
rastemp = iround(col0 * 255.0).rgba;
textemp = iround(255.0 * texture(samp[0], float3((float2(tevcoord.xy)/128.0).xy * texdim[0].xy, 0.0))).rgba;
tevin_a = int4(int3(0,0,0), 0)&int4(255, 255, 255, 255);
tevin_b = int4(textemp.rgb, textemp.a)&int4(255, 255, 255, 255);
tevin_c = int4(rastemp.rgb, rastemp.a)&int4(255, 255, 255, 255);
tevin_d = int4(int3(0,0,0), 0);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 1
// indirect op
int2 indtevtrans1 = int2(0, 0);
wrappedcoord.x = fixpoint_uv1.x;
wrappedcoord.y = fixpoint_uv1.y;
tevcoord.xy = wrappedcoord + indtevtrans1;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = iround(255.0 * texture(samp[1], float3((float2(tevcoord.xy)/128.0).xy * texdim[1].xy, 0.0))).rgba;
konsttemp = int4(k[0].rgb, 255);
tevin_a = int4(int3(0,0,0), 0)&int4(255, 255, 255, 255);
tevin_b = int4(textemp.rgb, 0)&int4(255, 255, 255, 255);
tevin_c = int4(konsttemp.rgb, 0)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 2
// indirect op
int2 indtevtrans2 = int2(0, 0);
wrappedcoord.x = fixpoint_uv1.x;
wrappedcoord.y = fixpoint_uv1.y;
tevcoord.xy = wrappedcoord + indtevtrans2;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = iround(255.0 * texture(samp[1], float3((float2(tevcoord.xy)/128.0).xy * texdim[1].xy, 0.0))).rgba;
tevin_a = int4(prev.rgb, 0)&int4(255, 255, 255, 255);
tevin_b = int4(c0.rgb, 0)&int4(255, 255, 255, 255);
tevin_c = int4(textemp.aaa, 0)&int4(255, 255, 255, 255);
tevin_d = int4(int3(0,0,0), prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 3
// indirect op
int2 indtevtrans3 = int2(0, 0);
wrappedcoord.x = fixpoint_uv2.x;
wrappedcoord.y = fixpoint_uv2.y;
tevcoord.xy = wrappedcoord + indtevtrans3;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = iround(255.0 * texture(samp[2], float3((float2(tevcoord.xy)/128.0).xy * texdim[2].xy, 0.0))).rgba;
tevin_a = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_b = int4(int3(0,0,0), prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(textemp.rgb, 0)&int4(255, 255, 255, 255);
tevin_d = int4(int3(0,0,0), 0);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 4
// indirect op
int2 indtevtrans4 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans4;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
rastemp = iround(col0 * 255.0).rgba;
textemp = int4(255, 255, 255, 255);
tevin_a = int4(int3(0,0,0), 0)&int4(255, 255, 255, 255);
tevin_b = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(rastemp.rgb, rastemp.a)&int4(255, 255, 255, 255);
tevin_d = int4(int3(0,0,0), 0);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 5
// indirect op
int2 indtevtrans5 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans5;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = iround(255.0 * texture(samp[3], float3((float2(tevcoord.xy)/128.0).xy * texdim[3].xy, 0.0))).rgba;
konsttemp = int4(k[0].rgb, 255);
tevin_a = int4(int3(0,0,0), 0)&int4(255, 255, 255, 255);
tevin_b = int4(textemp.rgb, 0)&int4(255, 255, 255, 255);
tevin_c = int4(konsttemp.rgb, 0)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 6
// indirect op
int2 indtevtrans6 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans6;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = iround(255.0 * texture(samp[4], float3((float2(tevcoord.xy)/128.0).xy * texdim[4].xy, 0.0))).rgba;
tevin_a = int4(int3(0,0,0), 0)&int4(255, 255, 255, 255);
tevin_b = int4(textemp.rgb, 0)&int4(255, 255, 255, 255);
tevin_c = int4(textemp.aaa, 0)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(0,0,0), int3(255,255,255));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255);

// TEV stage 7
// indirect op
int2 indtevtrans7 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans7;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = iround(255.0 * texture(samp[7], float3((float2(tevcoord.xy)/128.0).xy * texdim[7].xy, 0.0))).rgba;
tevin_a = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_b = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(-1024,-1024,-1024), int3(1023,1023,1023));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), -1024, 1023);

// TEV stage 8
// indirect op
int2 indtevtrans8 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans8;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = int4(255, 255, 255, 255);
tevin_a = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_b = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(-1024,-1024,-1024), int3(1023,1023,1023));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), -1024, 1023);

// TEV stage 9
// indirect op
int2 indtevtrans9 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans9;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = int4(255, 255, 255, 255);
tevin_a = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_b = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(-1024,-1024,-1024), int3(1023,1023,1023));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), -1024, 1023);

// TEV stage 10
// indirect op
int2 indtevtrans10 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans10;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = int4(255, 255, 255, 255);
tevin_a = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_b = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(-1024,-1024,-1024), int3(1023,1023,1023));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), -1024, 1023);

// TEV stage 11
// indirect op
int2 indtevtrans11 = int2(0, 0);
wrappedcoord.x = fixpoint_uv0.x;
wrappedcoord.y = fixpoint_uv0.y;
tevcoord.xy = wrappedcoord + indtevtrans11;
tevcoord.xy = (tevcoord.xy << 8) >> 8;
textemp = int4(255, 255, 255, 255);
tevin_a = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_b = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_c = int4(prev.rgb, prev.a)&int4(255, 255, 255, 255);
tevin_d = int4(prev.rgb, prev.a);
// color combine
prev.rgb = clamp((((tevin_d.rgb)) + (((((tevin_a.rgb<<8) + (tevin_b.rgb-tevin_a.rgb)*(tevin_c.rgb+(tevin_c.rgb>>7)))) + 128)>>8)), int3(-1024,-1024,-1024), int3(1023,1023,1023));
// alpha combine
prev.a = clamp((((tevin_d.a)) + (((((tevin_a.a<<8) + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), -1024, 1023);
prev = prev & 255;
if(!( (prev.a > alphaRef.r) && (true))) {
ocol0 = float4(0.0, 0.0, 0.0, 0.0);
depth = 1.0;
discard;
return;
}
float2 screenpos = rawpos.xy * cefbscale.xy;
screenpos.y = 528.0 - screenpos.y;
int zCoord = int(czslope.z + czslope.x * screenpos.x + czslope.y * screenpos.y);
zCoord = clamp(zCoord, 0, 0xFFFFFF);
depth = float(zCoord) / 16777216.0;
ocol0 = float4(prev) / 255.0;
}
0(116) : error C1008: undefined variable "tex2"
    (1-1/1)