mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-18 14:11:48 +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.
141 lines
4.7 KiB
Plaintext
141 lines
4.7 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 fe05aca8e186a5fd
|
|
// Used for: DoF backgrounds
|
|
const float resXScale = float($width)/float($gameWidth);
|
|
const float resYScale = float($height)/float($gameHeight);
|
|
|
|
UNIFORM_BUFFER_LAYOUT(38, 1, 2) uniform uniformBlockPS6
|
|
{
|
|
vec4 uf_blockPS6[1024];
|
|
};
|
|
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
|
layout(location = 0) in vec4 passParameterSem136;
|
|
layout(location = 1) in vec4 passParameterSem130;
|
|
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
|
|
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);
|
|
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[1];
|
|
bool activeMaskStackC[2];
|
|
activeMaskStackC[0] = false;
|
|
activeMaskStack[0] = true;
|
|
activeMaskStackC[0] = true;
|
|
activeMaskStackC[1] = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0i = floatBitsToInt(passParameterSem136);
|
|
R1i = floatBitsToInt(passParameterSem130);
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R4i.xyz = ivec3(0,0,0);
|
|
R4i.w = floatBitsToInt(1.0);
|
|
R1i.z = 0;
|
|
PS0i = R1i.z;
|
|
// 1
|
|
R1i.w = int(uf_blockPS6[0].x);
|
|
PS1i = R1i.w;
|
|
}
|
|
while( activeMaskStackC[1] == true )
|
|
{
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R2i.x = (R1i.w > R1i.z)?int(0xFFFFFFFF):int(0x0);
|
|
// 1
|
|
predResult = (R2i.x != 0);
|
|
if( predResult == false ) break;
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
backupReg0i = R1i.z;
|
|
R1i.z = backupReg0i + int(1);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
R3i.xyz = floatBitsToInt(uf_blockPS6[R1i.z].xyz/resXScale); // Uses X, not sure if this shader is supposed to be widescreened.
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R2i.x = floatBitsToInt(intBitsToFloat(R1i.x) + intBitsToFloat(R3i.x));
|
|
R2i.y = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(R3i.y));
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
R2i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R2i.xy)).xyz);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
backupReg0i = R3i.z;
|
|
R3i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R3i.z),intBitsToFloat(R2i.x)) + intBitsToFloat(R4i.x)));
|
|
R3i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R3i.z),intBitsToFloat(R2i.y)) + intBitsToFloat(R4i.y)));
|
|
R3i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(backupReg0i),intBitsToFloat(R2i.z)) + intBitsToFloat(R4i.z)));
|
|
// 1
|
|
R2i.xyz = ivec3(R4i.x,R4i.y,R4i.z);
|
|
R2i.w = R4i.w;
|
|
// 2
|
|
backupReg0i = R4i.w;
|
|
R4i.xyz = ivec3(R3i.x,R3i.y,R3i.z);
|
|
R4i.w = backupReg0i;
|
|
}
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
backupReg0i = R0i.x;
|
|
backupReg1i = R0i.y;
|
|
backupReg2i = R0i.z;
|
|
backupReg3i = R0i.w;
|
|
R0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg0i), intBitsToFloat(R4i.x)));
|
|
R0i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg1i), intBitsToFloat(R4i.y)));
|
|
R0i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg2i), intBitsToFloat(R4i.z)));
|
|
R0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg3i), intBitsToFloat(R4i.w)));
|
|
}
|
|
// export
|
|
passPixelColor0 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w));
|
|
}
|