cemu_graphic_packs/Resolutions/XenobladeX_Resolution/1f915b133a255dab_0000000000000000_vs.txt
Crementif 077f4f8f27
Fix shader errors and shader cleanup
Since I wanted to make sure that I didn't broke the shaders after converting the shaders to Vulkan, we need to check if all the shaders weren't broken. Since we're talking about like 400 shaders checking all of them is pretty much impossible and even then, 

So, the obvious solution was to automate the checking. Not as simple as you'd think, because in 300 of our shaders we use preset variables which without replacing the value like Cemu does, will make the shader error regardless. So I also implemented some functionality that would read the preset values and types out of the rules.txt file and replace them in the shaders using that information. And then we use Khronos' glslang to compile the shaders, using both OpenGL and Vulkan.

The result was that glslang found quite a few errors in some of the shaders, which I fixed in this commit. I'm considering adding this rules.txt parsing and automated shader compilation testing to the build process.

Also, I fixed Clarity's name and description since Monochromia isn't available anymore and Xenoblade's resolution pack had a lot of weird blank lines before their #version declaration, which my converter didn't like.
2019-11-29 00:51:00 +01:00

208 lines
12 KiB
Plaintext

#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable
// shader 1f915b133a255dab
//battle graph, dumped
uniform ivec4 uf_uniformRegisterVS[256];
uniform vec2 uf_windowSpaceToClipSpaceTransform;
uniform float uf_alphaTestRef;
layout(location = 0) in uvec4 attrDataSem0;
out gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
};
layout(location = 0) out vec4 passParameterSem0;
layout(location = 1) out vec4 passParameterSem1;
int clampFI32(int v)
{
if( v == 0x7FFFFFFF )
return floatBitsToInt(1.0);
else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
}
float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
void main()
{
ivec4 R0i = ivec4(0);
ivec4 R1i = ivec4(0);
ivec4 R2i = ivec4(0);
ivec4 R123i = ivec4(0);
ivec4 R124i = ivec4(0);
ivec4 R125i = ivec4(0);
ivec4 R126i = ivec4(0);
ivec4 R127i = ivec4(0);
uvec4 attrDecoder;
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
ivec4 PV0i = ivec4(0), PV1i = ivec4(0);
int PS0i = 0, PS1i = 0;
ivec4 tempi = ivec4(0);
float tempResultf;
int tempResulti;
ivec4 ARi = ivec4(0);
bool predResult = true;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0i = ivec4(gl_VertexID, 0, 0, gl_InstanceID);
attrDecoder.xyz = attrDataSem0.xyz;
attrDecoder.xyz = (attrDecoder.xyz>>24)|((attrDecoder.xyz>>8)&0xFF00)|((attrDecoder.xyz<<8)&0xFF0000)|((attrDecoder.xyz<<24));
attrDecoder.w = 0;
R1i = ivec4(int(attrDecoder.x), int(attrDecoder.y), int(attrDecoder.z), floatBitsToInt(1.0));
// 0
R127i.x = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[27].w) * 1.0);
R127i.y = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[27].z) * 1.0);
R127i.z = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[27].y) * 1.0);
R127i.w = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[27].x) * 1.0);
PS0i = int(intBitsToFloat(R1i.z));
// 1
R126i.x = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[15].w) * 1.0);
R125i.y = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[15].z) * 1.0);
R125i.z = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[15].y) * 1.0);
R125i.w = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[15].x) * 1.0);
R124i.x = floatBitsToInt(float(PS0i));
PS1i = R124i.x;
// 2
tempResultf = intBitsToFloat(PS1i);
tempResultf = floor(tempResultf);
tempResultf = clamp(tempResultf, -256.0, 255.0);
ARi.x = int(tempResultf);
PV0i.x = floatBitsToInt(tempResultf);
R124i.y = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[19].z) * 1.0);
R124i.z = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[19].y) * 1.0);
R124i.w = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[19].x) * 1.0);
R125i.x = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[19].w) * 1.0);
PS0i = R125i.x;
// 3
R123i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].z) * intBitsToFloat(uf_uniformRegisterVS[26].w) + intBitsToFloat(R127i.x)));
PV1i.x = R123i.x;
R123i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].z) * intBitsToFloat(uf_uniformRegisterVS[26].z) + intBitsToFloat(R127i.y)));
PV1i.y = R123i.y;
// 4
R127i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].y) * intBitsToFloat(uf_uniformRegisterVS[25].w) + intBitsToFloat(PV1i.x)));
R127i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].y) * intBitsToFloat(uf_uniformRegisterVS[25].z) + intBitsToFloat(PV1i.y)));
// 5
backupReg0i = R127i.z;
backupReg1i = R127i.w;
R127i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].z) * intBitsToFloat(uf_uniformRegisterVS[26].y) + intBitsToFloat(backupReg0i)));
R127i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].z) * intBitsToFloat(uf_uniformRegisterVS[26].x) + intBitsToFloat(backupReg1i)));
// 6
backupReg0i = R127i.x;
R127i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].x) * intBitsToFloat(uf_uniformRegisterVS[24].w) + intBitsToFloat(backupReg0i)));
R126i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].x) * intBitsToFloat(uf_uniformRegisterVS[24].z) + intBitsToFloat(R127i.y)));
// 7
backupReg0i = R127i.z;
backupReg1i = R127i.w;
R127i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].y) * intBitsToFloat(uf_uniformRegisterVS[25].y) + intBitsToFloat(backupReg0i)));
R127i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].y) * intBitsToFloat(uf_uniformRegisterVS[25].x) + intBitsToFloat(backupReg1i)));
// 8
backupReg0i = R127i.x;
backupReg0i = R127i.x;
backupReg0i = R127i.x;
backupReg0i = R127i.x;
R127i.x = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(uf_uniformRegisterVS[23].w));
R127i.y = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(uf_uniformRegisterVS[23].z));
R126i.z = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(uf_uniformRegisterVS[23].y));
R126i.w = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(uf_uniformRegisterVS[23].x));
// 9
backupReg0i = R127i.z;
backupReg1i = R127i.w;
R127i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].x) * intBitsToFloat(uf_uniformRegisterVS[24].y) + intBitsToFloat(backupReg0i)));
R127i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+4].x) * intBitsToFloat(uf_uniformRegisterVS[24].x) + intBitsToFloat(backupReg1i)));
// 10
R123i.x = floatBitsToInt((intBitsToFloat(R126i.y) * intBitsToFloat(uf_uniformRegisterVS[22].w) + intBitsToFloat(R127i.x)));
PV0i.x = R123i.x;
R123i.y = floatBitsToInt((intBitsToFloat(R126i.y) * intBitsToFloat(uf_uniformRegisterVS[22].z) + intBitsToFloat(R127i.y)));
PV0i.y = R123i.y;
R123i.z = floatBitsToInt((intBitsToFloat(R126i.y) * intBitsToFloat(uf_uniformRegisterVS[22].y) + intBitsToFloat(R126i.z)));
PV0i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(R126i.y) * intBitsToFloat(uf_uniformRegisterVS[22].x) + intBitsToFloat(R126i.w)));
PV0i.w = R123i.w;
// 11
R123i.x = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[21].w) + intBitsToFloat(PV0i.x)));
PV1i.x = R123i.x;
R123i.y = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[21].z) + intBitsToFloat(PV0i.y)));
PV1i.y = R123i.y;
R123i.z = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[21].y) + intBitsToFloat(PV0i.z)));
PV1i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[21].x) + intBitsToFloat(PV0i.w)));
PV1i.w = R123i.w;
// 12
backupReg0i = R127i.w;
R123i.x = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[20].w) + intBitsToFloat(PV1i.x)));
PV0i.x = R123i.x;
R127i.y = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[20].z) + intBitsToFloat(PV1i.y)));
R127i.z = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[20].y) + intBitsToFloat(PV1i.z)));
R127i.w = floatBitsToInt((intBitsToFloat(backupReg0i) * intBitsToFloat(uf_uniformRegisterVS[20].x) + intBitsToFloat(PV1i.w)));
// 13
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_uniformRegisterVS[3].w));
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_uniformRegisterVS[3].z));
PV1i.z = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_uniformRegisterVS[3].y));
PV1i.w = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_uniformRegisterVS[3].x));
// 14
R123i.x = floatBitsToInt((intBitsToFloat(R127i.y) * intBitsToFloat(uf_uniformRegisterVS[2].w) + intBitsToFloat(PV1i.x)));
PV0i.x = R123i.x;
R123i.y = floatBitsToInt((intBitsToFloat(R127i.y) * intBitsToFloat(uf_uniformRegisterVS[2].z) + intBitsToFloat(PV1i.y)));
PV0i.y = R123i.y;
R123i.z = floatBitsToInt((intBitsToFloat(R127i.y) * intBitsToFloat(uf_uniformRegisterVS[2].y) + intBitsToFloat(PV1i.z)));
PV0i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(R127i.y) * intBitsToFloat(uf_uniformRegisterVS[2].x) + intBitsToFloat(PV1i.w)));
PV0i.w = R123i.w;
// 15
R123i.x = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[1].w) + intBitsToFloat(PV0i.x)));
PV1i.x = R123i.x;
R123i.y = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[1].z) + intBitsToFloat(PV0i.y)));
PV1i.y = R123i.y;
R123i.z = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[1].y) + intBitsToFloat(PV0i.z)));
PV1i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(R127i.z) * intBitsToFloat(uf_uniformRegisterVS[1].x) + intBitsToFloat(PV0i.w)));
PV1i.w = R123i.w;
// 16
R1i.x = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[0].x) + intBitsToFloat(PV1i.w)));
R1i.y = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[0].y) + intBitsToFloat(PV1i.z)));
R1i.z = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[0].z) + intBitsToFloat(PV1i.y)));
R1i.w = floatBitsToInt((intBitsToFloat(R127i.w) * intBitsToFloat(uf_uniformRegisterVS[0].w) + intBitsToFloat(PV1i.x)));
// 17
backupReg0i = R125i.z;
backupReg1i = R125i.w;
R125i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].y) * intBitsToFloat(uf_uniformRegisterVS[13].y) + intBitsToFloat(backupReg0i)));
R125i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].y) * intBitsToFloat(uf_uniformRegisterVS[13].x) + intBitsToFloat(backupReg1i)));
// 18
backupReg0i = R126i.x;
backupReg1i = R125i.y;
R126i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].y) * intBitsToFloat(uf_uniformRegisterVS[13].w) + intBitsToFloat(backupReg0i)));
R125i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].y) * intBitsToFloat(uf_uniformRegisterVS[13].z) + intBitsToFloat(backupReg1i)));
// 19
backupReg0i = R124i.z;
backupReg1i = R124i.w;
R124i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].w) * intBitsToFloat(uf_uniformRegisterVS[17].y) + intBitsToFloat(backupReg0i)));
R124i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].w) * intBitsToFloat(uf_uniformRegisterVS[17].x) + intBitsToFloat(backupReg1i)));
// 20
backupReg0i = R125i.x;
backupReg1i = R124i.y;
R125i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].w) * intBitsToFloat(uf_uniformRegisterVS[17].w) + intBitsToFloat(backupReg0i)));
R124i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].w) * intBitsToFloat(uf_uniformRegisterVS[17].z) + intBitsToFloat(backupReg1i)));
// 21
R0i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].x) * intBitsToFloat(uf_uniformRegisterVS[12].x) + intBitsToFloat(R125i.w)));
R0i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].x) * intBitsToFloat(uf_uniformRegisterVS[12].y) + intBitsToFloat(R125i.z)));
// 22
R0i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].x) * intBitsToFloat(uf_uniformRegisterVS[12].z) + intBitsToFloat(R125i.y)));
R0i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].x) * intBitsToFloat(uf_uniformRegisterVS[12].w) + intBitsToFloat(R126i.x)));
// 23
R2i.x = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].z) * intBitsToFloat(uf_uniformRegisterVS[16].x) + intBitsToFloat(R124i.w)));
R2i.y = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].z) * intBitsToFloat(uf_uniformRegisterVS[16].y) + intBitsToFloat(R124i.z)));
// 24
R2i.z = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].z) * intBitsToFloat(uf_uniformRegisterVS[16].z) + intBitsToFloat(R124i.y)));
R2i.w = floatBitsToInt((intBitsToFloat(uf_uniformRegisterVS[ARi.x+8].z) * intBitsToFloat(uf_uniformRegisterVS[16].w) + intBitsToFloat(R125i.x)));
// export
float origRatio = (float(1280)/float(720));
float newRatio = (float($width)/float($height)) ;
// *(origRatio / newRatio)
gl_Position = vec4(intBitsToFloat(R1i.x)*(origRatio / newRatio), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w));
// export
passParameterSem0 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w));
// export
passParameterSem1 = vec4(intBitsToFloat(R2i.x), intBitsToFloat(R2i.y), intBitsToFloat(R2i.z), intBitsToFloat(R2i.w));
// 0
}