mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-23 16:31:50 +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.
126 lines
4.5 KiB
Plaintext
126 lines
4.5 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 4d96f8f88575bcab -- Used to blur out the main frame in various cutscenes
|
|
|
|
float blur = $Blur;
|
|
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 2) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_remappedPS[1];
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform ivec4 uf_remappedPS[1];
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
TEXTURE_LAYOUT(1, 1, 0) uniform sampler2D textureUnitPS1;
|
|
TEXTURE_LAYOUT(2, 1, 1) uniform sampler2D textureUnitPS2;
|
|
layout(location = 0) in vec4 passParameterSem136;
|
|
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 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(passParameterSem136);
|
|
if( activeMaskStackC[1] == true ) {
|
|
R0i.w = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R0i.xy),0.0).x);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
activeMaskStack[1] = activeMaskStack[0];
|
|
activeMaskStackC[2] = activeMaskStackC[1];
|
|
// 0
|
|
R1i.w = int(-1);
|
|
// 1
|
|
predResult = (intBitsToFloat(0x3f7ff972) >= intBitsToFloat(R0i.w));
|
|
activeMaskStack[1] = predResult;
|
|
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
PV0i.y = ((intBitsToFloat(uf_remappedPS[0].y) >= intBitsToFloat(R0i.w))?int(0xFFFFFFFF):int(0x0));
|
|
PV0i.z = ((intBitsToFloat(R0i.w) >= intBitsToFloat(uf_remappedPS[0].x))?int(0xFFFFFFFF):int(0x0));
|
|
// 1
|
|
R123i.x = ((PV0i.z == 0)?(0):(PV0i.y));
|
|
PV1i.x = R123i.x;
|
|
// 2
|
|
R1i.w = ((PV1i.x == 0)?(0):(int(-1)));
|
|
}
|
|
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
if( (R1i.w != 0)) discard;
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
R0i.xyz = floatBitsToInt(textureLod(textureUnitPS2, intBitsToFloat(R0i.xy),0.0).xyz);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R127i.x = ((intBitsToFloat(uf_remappedPS[0].x) > intBitsToFloat(R0i.w))?int(0xFFFFFFFF):int(0x0));
|
|
PV0i.y = floatBitsToInt(-(intBitsToFloat(R0i.w)) + intBitsToFloat(uf_remappedPS[0].x));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R0i.w) + -(intBitsToFloat(uf_remappedPS[0].y)));
|
|
// 1
|
|
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[0].z), intBitsToFloat(PV0i.y)));
|
|
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[0].w), intBitsToFloat(PV0i.z)));
|
|
// 2
|
|
PV0i.x = floatBitsToInt(min(intBitsToFloat(PV1i.y), 1.0));
|
|
PV0i.w = floatBitsToInt(min(intBitsToFloat(PV1i.x), 1.0));
|
|
// 3
|
|
R0i.w = ((R127i.x == 0)?(PV0i.x):(PV0i.w));
|
|
}
|
|
// export
|
|
passPixelColor0 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w) * blur );
|
|
}
|