mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-24 02:29:16 +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.
110 lines
4.6 KiB
Plaintext
110 lines
4.6 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 2258c1c082f929aa
|
|
// Used for: Stage Background Blur, Clay Texture Blur
|
|
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;
|
|
out gl_PerVertex
|
|
{
|
|
vec4 gl_Position;
|
|
float gl_PointSize;
|
|
};
|
|
layout(location = 2) out vec4 passParameterSem0;
|
|
layout(location = 1) out vec4 passParameterSem1;
|
|
layout(location = 0) out vec4 passParameterSem2;
|
|
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 R127i = 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;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0i = ivec4(gl_VertexID, 0, 0, gl_InstanceID);
|
|
attrDecoder.x = attrDataSem0.x;
|
|
attrDecoder.x = (attrDecoder.x>>24)|((attrDecoder.x>>8)&0xFF00)|((attrDecoder.x<<8)&0xFF0000)|((attrDecoder.x<<24));
|
|
attrDecoder.y = 0;
|
|
attrDecoder.z = 0;
|
|
attrDecoder.w = 0;
|
|
R1i = ivec4(int(attrDecoder.x), 0, 0, 1);
|
|
// 0
|
|
R1i.w = 0x3f800000;
|
|
R127i.z = floatBitsToInt(float(R1i.x));
|
|
PS0i = R127i.z;
|
|
// 1
|
|
tempResultf = intBitsToFloat(PS0i);
|
|
tempResultf = floor(tempResultf);
|
|
tempResultf = clamp(tempResultf, -256.0, 255.0);
|
|
ARi.x = int(tempResultf);
|
|
PV1i.x = floatBitsToInt(tempResultf);
|
|
// 2
|
|
R1i.xyz = ivec3(uf_uniformRegisterVS[ARi.x+0].x,uf_uniformRegisterVS[ARi.x+0].y,uf_uniformRegisterVS[ARi.x+0].z);
|
|
// 3
|
|
R0i.x = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[4].x)/resXScale + intBitsToFloat(uf_uniformRegisterVS[ARi.x+7].x));
|
|
R0i.y = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[4].y)/resYScale + intBitsToFloat(uf_uniformRegisterVS[ARi.x+7].y));
|
|
// 4
|
|
R2i.x = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[5].x)/resXScale + intBitsToFloat(uf_uniformRegisterVS[ARi.x+7].x));
|
|
R2i.y = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[5].y)/resYScale + intBitsToFloat(uf_uniformRegisterVS[ARi.x+7].y));
|
|
// 5
|
|
R3i.x = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[6].x)/resXScale + intBitsToFloat(uf_uniformRegisterVS[ARi.x+7].x));
|
|
R3i.y = floatBitsToInt(intBitsToFloat(uf_uniformRegisterVS[6].y)/resYScale + intBitsToFloat(uf_uniformRegisterVS[ARi.x+7].y));
|
|
// export
|
|
SET_POSITION(vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w)));
|
|
// export
|
|
passParameterSem0 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.z));
|
|
// export
|
|
passParameterSem1 = vec4(intBitsToFloat(R2i.x), intBitsToFloat(R2i.y), intBitsToFloat(R2i.z), intBitsToFloat(R2i.z));
|
|
// export
|
|
passParameterSem2 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFloat(R3i.z), intBitsToFloat(R3i.z));
|
|
}
|