#version 130 #extension GL_ARB_uniform_buffer_object : enable #extension GL_ARB_shading_language_420pack : enable #extension GL_ARB_texture_multisample : enable #define SAMPLER_BINDING(x) layout(binding = x) #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 //1 TEV stages, 2 texgens, 98 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)); } SAMPLER_BINDING(0) uniform sampler2D samp0; SAMPLER_BINDING(1) uniform sampler2D samp1; SAMPLER_BINDING(2) uniform sampler2D samp2; SAMPLER_BINDING(3) uniform sampler2D samp3; SAMPLER_BINDING(4) uniform sampler2D samp4; SAMPLER_BINDING(5) uniform sampler2D samp5; SAMPLER_BINDING(6) uniform sampler2D samp6; SAMPLER_BINDING(7) uniform sampler2D samp7; 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]; }; 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 cDepth; }; out vec4 ocol0; centroid in float4 colors_02; centroid in float4 colors_12; centroid in float4 clipPos; centroid in float4 Normal; void main() { 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 colors_0 = colors_02; float4 colors_1 = colors_12; float3 _norm0 = normalize(Normal.xyz); float3 pos = float3(clipPos.x,clipPos.y,Normal.w); int4 lacc; float3 ldir, h; float dist, dist2, attn; { int4 mat = cmtrl[2]; lacc = int4(255, 255, 255, 255); lacc.w = 255; lacc = clamp(lacc, 0, 255);colors_0 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0; } int2 fixpoint_uv0 = iround(uv0.xy * texdim[0].zw * 128.0); int2 fixpoint_uv1 = iround(uv1.xy * texdim[1].zw * 128.0); // TEV stage 0 rastemp = iround(colors_0 * 255.0).rgba; textemp = int4(255, 255, 255, 255); tevin_a = int4(int3(0,0,0), 0)&255; tevin_b = int4(int3(0,0,0), 0)&255; tevin_c = int4(int3(0,0,0), 0)&255; tevin_d = int4(rastemp.rgb, rastemp.a); // color combine prev.rgb = clamp((((tevin_d.rgb)) + ((((tevin_a.rgb*256 + (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*256 + (tevin_b.a-tevin_a.a)*(tevin_c.a+(tevin_c.a>>7)))) + 128)>>8)), 0, 255); prev = prev & 255; int zCoord = iround(rawpos.z * float(0xFFFFFF)); ocol0 = float4(prev) / 255.0; } 0:110(33): error: `uv0' undeclared 0:110(37): error: type mismatch 0:110(52): error: operands to arithmetic operators must be numeric 0:110(59): error: operands to arithmetic operators must be numeric 0:110(59): error: no matching function for call to `iround(error)'; candidates are: 0:110(59): error: int iround(float) 0:110(59): error: ivec2 iround(vec2) 0:110(59): error: ivec3 iround(vec3) 0:110(59): error: ivec4 iround(vec4) 0:111(33): error: `uv1' undeclared 0:111(37): error: type mismatch 0:111(52): error: operands to arithmetic operators must be numeric 0:111(59): error: operands to arithmetic operators must be numeric 0:111(59): error: no matching function for call to `iround(error)'; candidates are: 0:111(59): error: int iround(float) 0:111(59): error: ivec2 iround(vec2) 0:111(59): error: ivec3 iround(vec3) 0:111(59): error: ivec4 iround(vec4)