mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-25 19:16:52 +01:00
f3d35c75dc
Didn't update the docs (will do that tomorrow), but I manually checked (didn't verify things, but I basically checked if it contained "uf_windowSpaceToClipSpaceTransform" and if the shader was made after a certain Cemu change was made due to how they're left out) to see if any graphic pack in here was *probably* safe. I also didn't convert 5 graphic packs since they contained signs that needed to be manually checked or at least examined more: - \Enhancements\TwilightPrincessHD_Bicubic - \Resolutions\DevilsThird_Resolution - \Resolutions\TwilightPrincessHD_Resolution (this one just needs to be fully verified since it's popular enough and has like 27 shaders) - \Resolutions\LegoStarWars_Resolution - \Resolutions\TokyoMirage_Resolution (this one could also be manually verified) I hope I didn't make too many mistakes with this one.
153 lines
6.0 KiB
Plaintext
153 lines
6.0 KiB
Plaintext
#version 420
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : 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 284b1bf9010d4e57
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
|
layout(location = 0) in vec4 passParameterSem133;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 1) uniform ufBlock
|
|
{
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
float scaleFactor = uf_fragCoordScale.x;
|
|
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 mix(0.0, a*b, (a != 0.0) && (b != 0.0));}
|
|
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);
|
|
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(passParameterSem133);
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R1i.x = floatBitsToInt(intBitsToFloat(R0i.x) + intBitsToFloat(0xba4ccccd)*scaleFactor);
|
|
R1i.y = floatBitsToInt(intBitsToFloat(R0i.y) + 0.0);
|
|
R0i.z = floatBitsToInt(intBitsToFloat(R0i.x) + intBitsToFloat(0x3a4ccccd)*scaleFactor);
|
|
R0i.w = floatBitsToInt(intBitsToFloat(R0i.y) + 0.0);
|
|
R2i.x = floatBitsToInt(intBitsToFloat(R0i.x) + 0.0);
|
|
PS0i = R2i.x;
|
|
// 1
|
|
R3i.x = floatBitsToInt(intBitsToFloat(R0i.x) + 0.0);
|
|
R2i.y = floatBitsToInt(intBitsToFloat(R0i.y) + intBitsToFloat(0xbab60b61)*scaleFactor);
|
|
R3i.zwy = floatBitsToInt(vec3(intBitsToFloat(R0i.y),intBitsToFloat(R0i.x),intBitsToFloat(R0i.y)) + vec3(intBitsToFloat(0x3ab60b61)*scaleFactor,0.0,0.0));
|
|
PS1i = R3i.y;
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
R1i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).xyz);
|
|
R0i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R0i.zw)).xyz);
|
|
R2i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R2i.xy)).xyz);
|
|
R4i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R3i.xz)).xyz);
|
|
R3i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R3i.wy)).xyz);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
activeMaskStack[1] = activeMaskStack[0];
|
|
activeMaskStackC[2] = activeMaskStackC[1];
|
|
// 0
|
|
backupReg0i = R0i.x;
|
|
backupReg1i = R0i.z;
|
|
PV0i.x = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(R0i.y));
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(R1i.x) + intBitsToFloat(backupReg0i));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R1i.z) + intBitsToFloat(backupReg1i));
|
|
// 1
|
|
PV1i.x = floatBitsToInt(intBitsToFloat(R2i.z) + intBitsToFloat(PV0i.z));
|
|
PV1i.y = floatBitsToInt(intBitsToFloat(R2i.y) + intBitsToFloat(PV0i.x));
|
|
PV1i.w = floatBitsToInt(intBitsToFloat(R2i.x) + intBitsToFloat(PV0i.y));
|
|
// 2
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(R4i.z) + intBitsToFloat(PV1i.x));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R4i.x) + intBitsToFloat(PV1i.w));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(R4i.y) + intBitsToFloat(PV1i.y));
|
|
// 3
|
|
R123i.x = floatBitsToInt((-(intBitsToFloat(R3i.x)) * 4.0 + intBitsToFloat(PV0i.z)));
|
|
PV1i.x = R123i.x;
|
|
R123i.z = floatBitsToInt((-(intBitsToFloat(R3i.y)) * 4.0 + intBitsToFloat(PV0i.w)));
|
|
PV1i.z = R123i.z;
|
|
R123i.w = floatBitsToInt((-(intBitsToFloat(R3i.z)) * 4.0 + intBitsToFloat(PV0i.y)));
|
|
PV1i.w = R123i.w;
|
|
// 4
|
|
PV0i.x = floatBitsToInt(max(intBitsToFloat(PV1i.x), -(intBitsToFloat(PV1i.x))));
|
|
PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) * 4.0);
|
|
PV0i.y = floatBitsToInt(max(intBitsToFloat(PV1i.z), -(intBitsToFloat(PV1i.z))));
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(PV0i.y) * 4.0);
|
|
PV0i.z = floatBitsToInt(max(intBitsToFloat(PV1i.w), -(intBitsToFloat(PV1i.w))));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(PV0i.z) * 4.0);
|
|
// 5
|
|
R0i.x = floatBitsToInt(dot(vec4(intBitsToFloat(PV0i.x),intBitsToFloat(PV0i.y),intBitsToFloat(PV0i.z),-0.0),vec4(intBitsToFloat(0x3eaa7efa)*scaleFactor,intBitsToFloat(0x3eab020c)*scaleFactor,intBitsToFloat(0x3eaa7efa)*scaleFactor,0.0)));
|
|
PV1i.x = R0i.x;
|
|
PV1i.y = R0i.x;
|
|
PV1i.z = R0i.x;
|
|
PV1i.w = R0i.x;
|
|
// 6
|
|
R0i.y = floatBitsToInt(intBitsToFloat(PV1i.x) + -(0.5));
|
|
// 7
|
|
predResult = (0.0 > intBitsToFloat(R0i.y));
|
|
activeMaskStack[1] = predResult;
|
|
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
if( (0 == 0)) discard;
|
|
}
|
|
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R3i.w = R0i.x;
|
|
}
|
|
// export
|
|
passPixelColor0 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFloat(R3i.z), intBitsToFloat(R3i.w));
|
|
}
|