2019-05-24 01:25:33 +02:00
|
|
|
#version 420
|
|
|
|
#extension GL_ARB_texture_gather : enable
|
|
|
|
#extension GL_ARB_separate_shader_objects : enable
|
2020-01-18 05:31:42 +01:00
|
|
|
#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.
|
|
|
|
|
2019-05-24 01:25:33 +02:00
|
|
|
// shader 2258c1c082f929aa
|
|
|
|
// Used for: Stage Background Blur, Clay Texture Blur
|
2020-01-01 21:03:05 +01:00
|
|
|
const float resXScale = float($width)/float($gameWidth);
|
|
|
|
const float resYScale = float($height)/float($gameHeight);
|
2019-05-24 01:25:33 +02:00
|
|
|
|
2020-01-18 05:31:42 +01:00
|
|
|
#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
|
2019-05-24 01:25:33 +02:00
|
|
|
uniform ivec4 uf_uniformRegisterVS[256];
|
2020-01-18 05:31:42 +01:00
|
|
|
// 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;
|
2019-05-24 01:25:33 +02:00
|
|
|
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
|
2020-01-18 05:31:42 +01:00
|
|
|
SET_POSITION(vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w)));
|
2019-05-24 01:25:33 +02:00
|
|
|
// 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));
|
|
|
|
}
|