mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-29 19: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.
296 lines
9.0 KiB
Plaintext
296 lines
9.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 492839ddc5f8f43e //3rd level dof
|
|
const float resXScale = float($width)/float($gameWidth);
|
|
const float resYScale = float($height)/float($gameHeight);
|
|
#ifdef VULKAN
|
|
layout(set = 0, binding = 0) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_uniformRegisterVS[256];
|
|
// uniform vec2 uf_windowSpaceToClipSpaceTransform; // Cemu optimized this uf_variable away in Cemu 1.15.7
|
|
};
|
|
#else
|
|
uniform ivec4 uf_uniformRegisterVS[256];
|
|
// uniform vec2 uf_windowSpaceToClipSpaceTransform; // Cemu optimized this uf_variable away in Cemu 1.15.7
|
|
#endif
|
|
// uf_windowSpaceToClipSpaceTransform was moved to the ufBlock
|
|
ATTR_LAYOUT(0, 0) in uvec4 attrDataSem0;
|
|
ATTR_LAYOUT(0, 1) in uvec4 attrDataSem1;
|
|
out gl_PerVertex
|
|
{
|
|
vec4 gl_Position;
|
|
float gl_PointSize;
|
|
};
|
|
layout(location = 0) out vec4 passParameterSem128;
|
|
layout(location = 1) out vec4 passParameterSem129;
|
|
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 Ri[128];
|
|
Ri[0] = ivec4(0);
|
|
Ri[1] = ivec4(0);
|
|
Ri[2] = ivec4(0);
|
|
Ri[3] = ivec4(0);
|
|
Ri[4] = ivec4(0);
|
|
Ri[5] = ivec4(0);
|
|
Ri[6] = ivec4(0);
|
|
Ri[7] = ivec4(0);
|
|
Ri[8] = ivec4(0);
|
|
Ri[9] = ivec4(0);
|
|
Ri[10] = ivec4(0);
|
|
Ri[11] = ivec4(0);
|
|
Ri[12] = ivec4(0);
|
|
Ri[13] = ivec4(0);
|
|
Ri[14] = ivec4(0);
|
|
Ri[15] = ivec4(0);
|
|
Ri[16] = ivec4(0);
|
|
Ri[17] = ivec4(0);
|
|
Ri[18] = ivec4(0);
|
|
Ri[19] = ivec4(0);
|
|
Ri[20] = ivec4(0);
|
|
Ri[21] = ivec4(0);
|
|
Ri[22] = ivec4(0);
|
|
Ri[23] = ivec4(0);
|
|
Ri[24] = ivec4(0);
|
|
Ri[25] = ivec4(0);
|
|
Ri[26] = ivec4(0);
|
|
Ri[27] = ivec4(0);
|
|
Ri[28] = ivec4(0);
|
|
Ri[29] = ivec4(0);
|
|
Ri[30] = ivec4(0);
|
|
Ri[31] = ivec4(0);
|
|
Ri[32] = ivec4(0);
|
|
Ri[33] = ivec4(0);
|
|
Ri[34] = ivec4(0);
|
|
Ri[35] = ivec4(0);
|
|
Ri[36] = ivec4(0);
|
|
Ri[37] = ivec4(0);
|
|
Ri[38] = ivec4(0);
|
|
Ri[39] = ivec4(0);
|
|
Ri[40] = ivec4(0);
|
|
Ri[41] = ivec4(0);
|
|
Ri[42] = ivec4(0);
|
|
Ri[43] = ivec4(0);
|
|
Ri[44] = ivec4(0);
|
|
Ri[45] = ivec4(0);
|
|
Ri[46] = ivec4(0);
|
|
Ri[47] = ivec4(0);
|
|
Ri[48] = ivec4(0);
|
|
Ri[49] = ivec4(0);
|
|
Ri[50] = ivec4(0);
|
|
Ri[51] = ivec4(0);
|
|
Ri[52] = ivec4(0);
|
|
Ri[53] = ivec4(0);
|
|
Ri[54] = ivec4(0);
|
|
Ri[55] = ivec4(0);
|
|
Ri[56] = ivec4(0);
|
|
Ri[57] = ivec4(0);
|
|
Ri[58] = ivec4(0);
|
|
Ri[59] = ivec4(0);
|
|
Ri[60] = ivec4(0);
|
|
Ri[61] = ivec4(0);
|
|
Ri[62] = ivec4(0);
|
|
Ri[63] = ivec4(0);
|
|
Ri[64] = ivec4(0);
|
|
Ri[65] = ivec4(0);
|
|
Ri[66] = ivec4(0);
|
|
Ri[67] = ivec4(0);
|
|
Ri[68] = ivec4(0);
|
|
Ri[69] = ivec4(0);
|
|
Ri[70] = ivec4(0);
|
|
Ri[71] = ivec4(0);
|
|
Ri[72] = ivec4(0);
|
|
Ri[73] = ivec4(0);
|
|
Ri[74] = ivec4(0);
|
|
Ri[75] = ivec4(0);
|
|
Ri[76] = ivec4(0);
|
|
Ri[77] = ivec4(0);
|
|
Ri[78] = ivec4(0);
|
|
Ri[79] = ivec4(0);
|
|
Ri[80] = ivec4(0);
|
|
Ri[81] = ivec4(0);
|
|
Ri[82] = ivec4(0);
|
|
Ri[83] = ivec4(0);
|
|
Ri[84] = ivec4(0);
|
|
Ri[85] = ivec4(0);
|
|
Ri[86] = ivec4(0);
|
|
Ri[87] = ivec4(0);
|
|
Ri[88] = ivec4(0);
|
|
Ri[89] = ivec4(0);
|
|
Ri[90] = ivec4(0);
|
|
Ri[91] = ivec4(0);
|
|
Ri[92] = ivec4(0);
|
|
Ri[93] = ivec4(0);
|
|
Ri[94] = ivec4(0);
|
|
Ri[95] = ivec4(0);
|
|
Ri[96] = ivec4(0);
|
|
Ri[97] = ivec4(0);
|
|
Ri[98] = ivec4(0);
|
|
Ri[99] = ivec4(0);
|
|
Ri[100] = ivec4(0);
|
|
Ri[101] = ivec4(0);
|
|
Ri[102] = ivec4(0);
|
|
Ri[103] = ivec4(0);
|
|
Ri[104] = ivec4(0);
|
|
Ri[105] = ivec4(0);
|
|
Ri[106] = ivec4(0);
|
|
Ri[107] = ivec4(0);
|
|
Ri[108] = ivec4(0);
|
|
Ri[109] = ivec4(0);
|
|
Ri[110] = ivec4(0);
|
|
Ri[111] = ivec4(0);
|
|
Ri[112] = ivec4(0);
|
|
Ri[113] = ivec4(0);
|
|
Ri[114] = ivec4(0);
|
|
Ri[115] = ivec4(0);
|
|
Ri[116] = ivec4(0);
|
|
Ri[117] = ivec4(0);
|
|
Ri[118] = ivec4(0);
|
|
Ri[119] = ivec4(0);
|
|
Ri[120] = ivec4(0);
|
|
Ri[121] = ivec4(0);
|
|
Ri[122] = ivec4(0);
|
|
Ri[123] = ivec4(0);
|
|
Ri[124] = ivec4(0);
|
|
Ri[125] = ivec4(0);
|
|
Ri[126] = ivec4(0);
|
|
Ri[127] = 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;
|
|
bool activeMaskStack[1];
|
|
bool activeMaskStackC[2];
|
|
activeMaskStackC[0] = false;
|
|
activeMaskStack[0] = true;
|
|
activeMaskStackC[0] = true;
|
|
activeMaskStackC[1] = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
Ri[0] = ivec4(gl_VertexID, 0, 0, gl_InstanceID);
|
|
attrDecoder = attrDataSem0;
|
|
attrDecoder = (attrDecoder>>24)|((attrDecoder>>8)&0xFF00)|((attrDecoder<<8)&0xFF0000)|((attrDecoder<<24));
|
|
Ri[1] = ivec4(int(attrDecoder.x), int(attrDecoder.y), int(attrDecoder.z), int(attrDecoder.w));
|
|
attrDecoder.xy = attrDataSem1.xy;
|
|
attrDecoder.xy = (attrDecoder.xy>>24)|((attrDecoder.xy>>8)&0xFF00)|((attrDecoder.xy<<8)&0xFF0000)|((attrDecoder.xy<<24));
|
|
attrDecoder.z = 0;
|
|
attrDecoder.w = 0;
|
|
Ri[2] = ivec4(int(attrDecoder.x), int(attrDecoder.y), floatBitsToInt(0.0), floatBitsToInt(1.0));
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
Ri[3].y = 0;
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(Ri[1].y) + intBitsToFloat(uf_uniformRegisterVS[0].y));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(PV0i.z) * 2.0);
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(Ri[1].x) + intBitsToFloat(uf_uniformRegisterVS[0].x));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(PV0i.w) * 2.0);
|
|
// 1
|
|
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.z) + -(1.0));
|
|
Ri[1].x = floatBitsToInt(intBitsToFloat(PV0i.w) + -(1.0));
|
|
PS1i = Ri[1].x;
|
|
// 2
|
|
Ri[1].y = floatBitsToInt(intBitsToFloat(PV1i.x) * -(1.0));
|
|
// 3
|
|
Ri[8].xyz = ivec3(Ri[1].x,Ri[1].y,Ri[1].z);
|
|
Ri[8].w = Ri[1].w;
|
|
}
|
|
while( activeMaskStackC[1] == true )
|
|
{
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
Ri[0].z = (0x00000002 > Ri[3].y)?int(0xFFFFFFFF):int(0x0);
|
|
// 1
|
|
predResult = (Ri[0].z != 0);
|
|
if( predResult == false ) break;
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
backupReg0i = Ri[3].y;
|
|
backupReg0i = Ri[3].y;
|
|
Ri[1].x = Ri[3].y + 0x00000003;
|
|
Ri[3].y = backupReg0i + int(1);
|
|
Ri[127].z = floatBitsToInt(float(backupReg0i));
|
|
PS0i = Ri[127].z;
|
|
// 1
|
|
tempResultf = intBitsToFloat(PS0i);
|
|
tempResultf = floor(tempResultf);
|
|
tempResultf = clamp(tempResultf, -256.0, 255.0);
|
|
ARi.x = int(tempResultf);
|
|
PV1i.x = floatBitsToInt(tempResultf);
|
|
// 2
|
|
PV0i.x = floatBitsToInt(intBitsToFloat(Ri[2].y) + intBitsToFloat(uf_uniformRegisterVS[ARi.x+2].y)/resXScale);
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(Ri[2].x) + intBitsToFloat(uf_uniformRegisterVS[ARi.x+2].x)/resXScale);
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(Ri[2].y) + intBitsToFloat(uf_uniformRegisterVS[ARi.x+2].w)/resXScale);
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(Ri[2].x) + intBitsToFloat(uf_uniformRegisterVS[ARi.x+2].z)/resXScale);
|
|
// 3
|
|
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_uniformRegisterVS[1].y)));
|
|
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.y), intBitsToFloat(uf_uniformRegisterVS[1].x)));
|
|
PV1i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_uniformRegisterVS[1].x)));
|
|
PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.x), intBitsToFloat(uf_uniformRegisterVS[1].y)));
|
|
// 4
|
|
Ri[0].xyz = floatBitsToInt(vec3(intBitsToFloat(PV1i.y),intBitsToFloat(PV1i.w),intBitsToFloat(PV1i.z)) + vec3(intBitsToFloat(uf_uniformRegisterVS[1].z)/resXScale,intBitsToFloat(uf_uniformRegisterVS[1].w)/resXScale,intBitsToFloat(uf_uniformRegisterVS[1].z)/resXScale));
|
|
Ri[0].w = floatBitsToInt(intBitsToFloat(PV1i.x) + intBitsToFloat(uf_uniformRegisterVS[1].w)/resXScale);
|
|
// 5
|
|
tempResulti = Ri[1].x;
|
|
tempResulti = clamp(tempResulti, -256, 255);
|
|
ARi.x = tempResulti;
|
|
PV1i.x = tempResulti;
|
|
// 6
|
|
Ri[6+ARi.x].x = Ri[0].x;
|
|
Ri[6+ARi.x].y = Ri[0].y;
|
|
Ri[6+ARi.x].z = Ri[0].z;
|
|
Ri[6+ARi.x].w = Ri[0].w;
|
|
}
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
Ri[0].xyz = ivec3(Ri[8].x,Ri[8].y,Ri[8].z);
|
|
Ri[0].w = Ri[8].w;
|
|
// 1
|
|
Ri[1].xyz = ivec3(Ri[9].x,Ri[9].y,Ri[9].z);
|
|
Ri[1].w = Ri[9].w;
|
|
// 2
|
|
Ri[2].xyz = ivec3(Ri[10].x,Ri[10].y,Ri[10].z);
|
|
Ri[2].w = Ri[10].w;
|
|
}
|
|
// export
|
|
SET_POSITION(vec4(intBitsToFloat(Ri[0].x), intBitsToFloat(Ri[0].y), intBitsToFloat(Ri[0].z), intBitsToFloat(Ri[0].w)));
|
|
// export
|
|
passParameterSem128 = vec4(intBitsToFloat(Ri[1].x), intBitsToFloat(Ri[1].y), intBitsToFloat(Ri[1].z), intBitsToFloat(Ri[1].w));
|
|
// export
|
|
passParameterSem129 = vec4(intBitsToFloat(Ri[2].x), intBitsToFloat(Ri[2].y), intBitsToFloat(Ri[2].z), intBitsToFloat(Ri[2].w));
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
}
|
|
}
|