mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-25 11:06:54 +01:00
142ed07b27
Since filters don't work with Vulkan (even if you try to adapt it to Vulkan) it would be smart if we made the pack OpenGL only at least, since Vulkan will crash with it if you've got it enabled. We want to keep the game breaking to a minimum. I also changed the descriptions to be more explanatory, and changed the preset names to make more sense to users. Unsure what the presets exactly entail (more specifically the preset that was originally called Smooth half original).
150 lines
4.9 KiB
Plaintext
150 lines
4.9 KiB
Plaintext
#version 430
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
// shader fdf33c607cd1d737 //Radial blur replacement
|
|
// start of shader inputs/outputs, predetermined by Cemu. Do not touch
|
|
#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 GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw)
|
|
#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 GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw)
|
|
#endif
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 1) uniform ufBlock
|
|
{
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
|
layout(location = 0) in vec4 passParameterSem0;
|
|
layout(location = 1) in vec4 passParameterSem1;
|
|
layout(location = 2) in vec4 passParameterSem2;
|
|
layout(location = 3) in vec4 passParameterSem3;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
// end of shader inputs/outputs
|
|
const float blurStart = $blurStart;
|
|
const float blurWidth = $blurWidth;
|
|
|
|
const int nsamples = $nrOfPasses ; //original had aprox 8 at 640x240
|
|
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()
|
|
{
|
|
vec4 R0f = vec4(0.0);
|
|
vec4 R1f = vec4(0.0);
|
|
vec4 R2f = vec4(0.0);
|
|
vec4 R3f = vec4(0.0);
|
|
vec4 R4f = vec4(0.0);
|
|
vec4 R5f = vec4(0.0);
|
|
vec4 R6f = vec4(0.0);
|
|
vec4 R7f = vec4(0.0);
|
|
vec4 colour = vec4(0.0);
|
|
vec2 center = vec2(0.5, 0.5);
|
|
vec4 R123f = vec4(0.0);
|
|
float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
|
|
vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
|
|
float PS0f = 0.0, PS1f = 0.0;
|
|
vec4 tempf = vec4(0.0);
|
|
float tempResultf;
|
|
int tempResulti;
|
|
ivec4 ARi = ivec4(0);
|
|
bool predResult = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0f = passParameterSem0;
|
|
R1f = passParameterSem1;
|
|
R2f = passParameterSem2;
|
|
R3f = passParameterSem3;
|
|
vec2 coord = -1.0 + R0f.xy;
|
|
vec2 ps = vec2(1.0)*uf_fragCoordScale.xy / textureSize(textureUnitPS0, 0);
|
|
vec2 uv = gl_FragCoord.xy *2.0 / textureSize(textureUnitPS0, 0);
|
|
//Simle radial blur jcant0n, shadertoy.com
|
|
uv -= center;
|
|
float precompute = blurWidth * (1.0 / float(nsamples - 1));
|
|
for(int i = 0; i < nsamples; i++)
|
|
{
|
|
float scale = blurStart + (float(i)* precompute);
|
|
colour += texture(textureUnitPS0, uv* scale + center );
|
|
}
|
|
colour /= float(nsamples);
|
|
//passPixelColor0 = colour;
|
|
R4f.xyz = colour.xyz;
|
|
R0f.xyz = R4f.xyz;
|
|
R5f.xyz = R4f.xyz;
|
|
R1f.xyz = R4f.xyz;
|
|
R6f.xyz = R4f.xyz;
|
|
R2f.xyz = R4f.xyz;
|
|
R7f.xyz = R4f.xyz;
|
|
R3f.xyz = R4f.xyz;
|
|
// 0
|
|
PV0f.x = R4f.y * intBitsToFloat(0x3e000000);
|
|
PV0f.y = R4f.x * intBitsToFloat(0x3e000000);
|
|
PV0f.w = R4f.z * intBitsToFloat(0x3e000000);
|
|
R4f.w = 1.0;
|
|
PS0f = R4f.w;
|
|
// 1
|
|
R123f.x = (R0f.z * intBitsToFloat(0x3e000000) + PV0f.w);
|
|
PV1f.x = R123f.x;
|
|
R123f.y = (R0f.y * intBitsToFloat(0x3e000000) + PV0f.x);
|
|
PV1f.y = R123f.y;
|
|
R123f.z = (R0f.x * intBitsToFloat(0x3e000000) + PV0f.y);
|
|
PV1f.z = R123f.z;
|
|
// 2
|
|
R123f.x = (R5f.z * intBitsToFloat(0x3e000000) + PV1f.x);
|
|
PV0f.x = R123f.x;
|
|
R123f.z = (R5f.y * intBitsToFloat(0x3e000000) + PV1f.y);
|
|
PV0f.z = R123f.z;
|
|
R123f.w = (R5f.x * intBitsToFloat(0x3e000000) + PV1f.z);
|
|
PV0f.w = R123f.w;
|
|
// 3
|
|
R123f.x = (R1f.y * intBitsToFloat(0x3e000000) + PV0f.z);
|
|
PV1f.x = R123f.x;
|
|
R123f.y = (R1f.x * intBitsToFloat(0x3e000000) + PV0f.w);
|
|
PV1f.y = R123f.y;
|
|
R123f.w = (R1f.z * intBitsToFloat(0x3e000000) + PV0f.x);
|
|
PV1f.w = R123f.w;
|
|
// 4
|
|
R123f.y = (R6f.y * intBitsToFloat(0x3e000000) + PV1f.x);
|
|
PV0f.y = R123f.y;
|
|
R123f.z = (R6f.x * intBitsToFloat(0x3e000000) + PV1f.y);
|
|
PV0f.z = R123f.z;
|
|
R123f.w = (R6f.z * intBitsToFloat(0x3e000000) + PV1f.w);
|
|
PV0f.w = R123f.w;
|
|
// 5
|
|
R123f.x = (R2f.x * intBitsToFloat(0x3e000000) + PV0f.z);
|
|
PV1f.x = R123f.x;
|
|
R123f.z = (R2f.z * intBitsToFloat(0x3e000000) + PV0f.w);
|
|
PV1f.z = R123f.z;
|
|
R123f.w = (R2f.y * intBitsToFloat(0x3e000000) + PV0f.y);
|
|
PV1f.w = R123f.w;
|
|
// 6
|
|
R123f.x = (R7f.y * intBitsToFloat(0x3e000000) + PV1f.w);
|
|
PV0f.x = R123f.x;
|
|
R123f.y = (R7f.x * intBitsToFloat(0x3e000000) + PV1f.x);
|
|
PV0f.y = R123f.y;
|
|
R123f.w = (R7f.z * intBitsToFloat(0x3e000000) + PV1f.z);
|
|
PV0f.w = R123f.w;
|
|
// 7
|
|
R4f.x = (R3f.x * intBitsToFloat(0x3e000000) + PV0f.y);
|
|
R4f.y = (R3f.y * intBitsToFloat(0x3e000000) + PV0f.x);
|
|
R4f.z = (R3f.z * intBitsToFloat(0x3e000000) + PV0f.w);
|
|
// export
|
|
|
|
passPixelColor0 = vec4(R4f.x, R4f.y, R4f.z, R4f.w);
|
|
|
|
}
|