mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-23 08:21:51 +01:00
3d492aa656
Should fix the native anti-aliasing preset most importantly, but since I ported all of the packs now the script "watermark" is at least a proper sentence, heh. Also, I fixed the porting scripts. Basically, there were a bug in the verification script that wouldn't check if the uf_* variables matched and the conversion script also had a fun bug where it wasn't automatically fixing an incorrect order of the uf_* variables. So that basically made both of them slip through. Both are now fixed however. Don't know if it's needed to check the previously ported graphic packs to see if the error affected those, but it might not hurt.
183 lines
7.1 KiB
Plaintext
183 lines
7.1 KiB
Plaintext
#version 420
|
|
#extension GL_ARB_texture_gather : enable
|
|
#ifdef VULKAN
|
|
#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location)
|
|
#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140)
|
|
#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation)
|
|
#define SET_POSITION(_v) gl_Position = _v; gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw)
|
|
#define gl_VertexID gl_VertexIndex
|
|
#define gl_InstanceID gl_InstanceIndex
|
|
#else
|
|
#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location)
|
|
#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140)
|
|
#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation)
|
|
#define SET_POSITION(_v) gl_Position = _v
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw)
|
|
#endif
|
|
// This shader was automatically converted to be cross-compatible with Vulkan and OpenGL.
|
|
|
|
// shader c92c1c4c0a2fb839
|
|
// Used for: Camera Depth of Field Blur
|
|
const float resXScale = float($width)/float($gameWidth);
|
|
const float resYScale = float($height)/float($gameHeight);
|
|
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 3) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_remappedPS[5];
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform ivec4 uf_remappedPS[5];
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
|
TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1;
|
|
TEXTURE_LAYOUT(2, 1, 2) uniform sampler2D textureUnitPS2;
|
|
layout(location = 0) in vec4 passParameterSem2;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
// uf_fragCoordScale was moved to the ufBlock
|
|
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){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
|
|
void main()
|
|
{
|
|
ivec4 R0i = ivec4(0);
|
|
ivec4 R1i = ivec4(0);
|
|
ivec4 R2i = ivec4(0);
|
|
ivec4 R3i = ivec4(0);
|
|
ivec4 R4i = ivec4(0);
|
|
ivec4 R123i = ivec4(0);
|
|
ivec4 R127i = ivec4(0);
|
|
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;
|
|
bool activeMaskStack[2];
|
|
bool activeMaskStackC[3];
|
|
activeMaskStack[0] = false;
|
|
activeMaskStackC[0] = false;
|
|
activeMaskStackC[1] = false;
|
|
activeMaskStack[0] = true;
|
|
activeMaskStackC[0] = true;
|
|
activeMaskStackC[1] = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0i = floatBitsToInt(passParameterSem2);
|
|
if( activeMaskStackC[1] == true ) {
|
|
R1i.w = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R0i.xy)).x);
|
|
R1i.z = floatBitsToInt(texture(textureUnitPS2, intBitsToFloat(R0i.xy)).x);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R123i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.w),intBitsToFloat(uf_remappedPS[0].x)) + intBitsToFloat(uf_remappedPS[1].x)));
|
|
R123i.x = clampFI32(R123i.x);
|
|
PV0i.x = R123i.x;
|
|
// 1
|
|
R0i.z = floatBitsToInt(max(intBitsToFloat(R1i.z), intBitsToFloat(PV0i.x)));
|
|
PV1i.z = R0i.z;
|
|
// 2
|
|
R1i.y = ((intBitsToFloat(PV1i.z) != 0.0)?int(0xFFFFFFFF):int(0x0));
|
|
PV0i.y = R1i.y;
|
|
// 3
|
|
if( (PV0i.y == 0)) discard;
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
activeMaskStack[1] = activeMaskStack[0];
|
|
activeMaskStackC[2] = activeMaskStackC[1];
|
|
// 0
|
|
predResult = (R1i.y != 0);
|
|
activeMaskStack[1] = predResult;
|
|
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(uf_remappedPS[2].y) + -(1.0));
|
|
// 1
|
|
R123i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(PV0i.w),intBitsToFloat(R0i.z)) + 1.0));
|
|
PV1i.z = R123i.z;
|
|
// 2
|
|
tempResultf = log2(intBitsToFloat(PV1i.z));
|
|
PS0i = floatBitsToInt(tempResultf);
|
|
// 3
|
|
R127i.x = floatBitsToInt(intBitsToFloat(PS0i) + -(1.0));
|
|
PV1i.x = R127i.x;
|
|
// 4
|
|
R2i.z = PV1i.x;
|
|
R1i.w = PV1i.x;
|
|
PS0i = floatBitsToInt(exp2(intBitsToFloat(PV1i.x)));
|
|
// 5
|
|
PV1i.z = floatBitsToInt(intBitsToFloat(PS0i) + intBitsToFloat(uf_remappedPS[3].w));
|
|
R3i.w = R127i.x;
|
|
R4i.w = R127i.x;
|
|
PS1i = R4i.w;
|
|
// 6
|
|
backupReg0i = R127i.x;
|
|
R127i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.z), intBitsToFloat(uf_remappedPS[4].y)));
|
|
PV0i.x = R127i.x;
|
|
PV0i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.z), intBitsToFloat(uf_remappedPS[4].x) / resXScale));
|
|
R127i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.z), intBitsToFloat(uf_remappedPS[4].w) / resYScale));
|
|
R127i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.z), intBitsToFloat(uf_remappedPS[4].z)));
|
|
PV0i.w = R127i.w;
|
|
R2i.w = floatBitsToInt(intBitsToFloat(backupReg0i) + 1.0);
|
|
R2i.w = clampFI32(R2i.w);
|
|
PS0i = R2i.w;
|
|
// 7
|
|
R1i.x = floatBitsToInt(intBitsToFloat(R0i.x) + intBitsToFloat(PV0i.y));
|
|
R1i.y = floatBitsToInt(intBitsToFloat(R0i.y) + intBitsToFloat(PV0i.x));
|
|
R3i.z = floatBitsToInt(intBitsToFloat(R0i.x) + intBitsToFloat(PV0i.w));
|
|
R2i.x = floatBitsToInt(intBitsToFloat(R0i.x) + -(intBitsToFloat(PV0i.y)));
|
|
PS1i = R2i.x;
|
|
// 8
|
|
R3i.x = floatBitsToInt(intBitsToFloat(R0i.y) + intBitsToFloat(R127i.z));
|
|
R2i.y = floatBitsToInt(intBitsToFloat(R0i.y) + -(intBitsToFloat(R127i.x)));
|
|
R4i.z = floatBitsToInt(intBitsToFloat(R0i.x) + -(intBitsToFloat(R127i.w)));
|
|
R4i.y = floatBitsToInt(intBitsToFloat(R0i.y) + -(intBitsToFloat(R127i.z)));
|
|
PS0i = R4i.y;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
R1i.xyz = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R1i.xy),intBitsToFloat(R1i.w)).xyz);
|
|
R2i.xyz = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R2i.xy),intBitsToFloat(R2i.z)).xyz);
|
|
R3i.xyz = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R3i.zx),intBitsToFloat(R3i.w)).xyz);
|
|
R4i.xyz = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R4i.zy),intBitsToFloat(R4i.w)).xyz);
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(R1i.z) + intBitsToFloat(R2i.z));
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(PV0i.y) / 2.0);
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(R2i.y));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(PV0i.z) / 2.0);
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(R1i.x) + intBitsToFloat(R2i.x));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(PV0i.w) / 2.0);
|
|
// 1
|
|
R123i.x = floatBitsToInt((intBitsToFloat(R3i.x) * 0.5 + intBitsToFloat(PV0i.w)));
|
|
PV1i.x = R123i.x;
|
|
R123i.z = floatBitsToInt((intBitsToFloat(R3i.z) * 0.5 + intBitsToFloat(PV0i.y)));
|
|
PV1i.z = R123i.z;
|
|
R123i.w = floatBitsToInt((intBitsToFloat(R3i.y) * 0.5 + intBitsToFloat(PV0i.z)));
|
|
PV1i.w = R123i.w;
|
|
// 2
|
|
R2i.x = floatBitsToInt((intBitsToFloat(R4i.x) * 0.5 + intBitsToFloat(PV1i.x))/2.0);
|
|
R2i.y = floatBitsToInt((intBitsToFloat(R4i.y) * 0.5 + intBitsToFloat(PV1i.w))/2.0);
|
|
R2i.z = floatBitsToInt((intBitsToFloat(R4i.z) * 0.5 + intBitsToFloat(PV1i.z))/2.0);
|
|
}
|
|
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
|
|
// export
|
|
passPixelColor0 = vec4(intBitsToFloat(R2i.x), intBitsToFloat(R2i.y), intBitsToFloat(R2i.z), intBitsToFloat(R2i.w));
|
|
}
|