mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-29 19:31:50 +01:00
84 lines
2.8 KiB
Plaintext
84 lines
2.8 KiB
Plaintext
|
#version 420
|
||
|
#extension GL_ARB_texture_gather : enable
|
||
|
// shader 10584c6fc5857351 // bloom pre-spread
|
||
|
uniform ivec4 uf_remappedPS[2];
|
||
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5c7b800 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
|
||
|
layout(location = 0) in vec4 passParameterSem0;
|
||
|
layout(location = 1) in vec4 passParameterSem1;
|
||
|
layout(location = 0) out vec4 passPixelColor0;
|
||
|
uniform vec2 uf_fragCoordScale;
|
||
|
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()
|
||
|
{
|
||
|
vec2 R0f = vec2(0.0);
|
||
|
vec4 R1f = vec4(0.0);
|
||
|
vec4 R2f = vec4(0.0);
|
||
|
vec4 R3f = vec4(0.0);
|
||
|
vec4 R123f = vec4(0.0);
|
||
|
vec4 R126f = vec4(0.0);
|
||
|
vec4 R127f = 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 = vec2((passParameterSem0.x + passParameterSem1.x)/2, (passParameterSem0.y + passParameterSem0.w)/2); //center point
|
||
|
vec2 res = vec2( passParameterSem1.x - passParameterSem0.x, passParameterSem0.w - passParameterSem0.y );
|
||
|
int r = int(floor(1.0 / uf_fragCoordScale.y + 0.5));
|
||
|
float count = 0.0;
|
||
|
for( int x=-r; x<=r; x++ ) {
|
||
|
for( int y=-r; y<=r; y++ ) {
|
||
|
if( pow(x,2) + pow(y,2) <= pow(r,2) ) {
|
||
|
R1f += texture( textureUnitPS0, R0f + vec2(x,y)*res );
|
||
|
count += 1.0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
PV0f = R1f/count;
|
||
|
R127f.xzw = PV0f.xzw;
|
||
|
R126f.y = PV0f.y;
|
||
|
// 3
|
||
|
tempf.x = dot(vec4(PV0f.x,PV0f.y,PV0f.z,-0.0),vec4(intBitsToFloat(uf_remappedPS[0].x),intBitsToFloat(uf_remappedPS[0].y),intBitsToFloat(uf_remappedPS[0].z),0.0));
|
||
|
PV1f.x = tempf.x;
|
||
|
PV1f.y = tempf.x;
|
||
|
PV1f.z = tempf.x;
|
||
|
PV1f.w = tempf.x;
|
||
|
PS1f = mul_nonIEEE(PV0f.w, intBitsToFloat(uf_remappedPS[0].w));
|
||
|
// 4
|
||
|
tempf.x = dot(vec4(R127f.x,R126f.y,R127f.z,PS1f),vec4(intBitsToFloat(uf_remappedPS[0].x),intBitsToFloat(uf_remappedPS[0].y),intBitsToFloat(uf_remappedPS[0].z),1.0));
|
||
|
tempf.x = clamp(tempf.x, 0.0, 1.0);
|
||
|
PV0f.x = tempf.x;
|
||
|
PV0f.y = tempf.x;
|
||
|
PV0f.z = tempf.x;
|
||
|
PV0f.w = tempf.x;
|
||
|
R127f.y = tempf.x;
|
||
|
PS0f = 1.0 / PV1f.x;
|
||
|
// 5
|
||
|
PV1f.z = PS0f * intBitsToFloat(uf_remappedPS[1].x);
|
||
|
PV1f.z = clamp(PV1f.z, 0.0, 1.0);
|
||
|
// 6
|
||
|
PV0f.y = mul_nonIEEE(R127f.y, PV1f.z);
|
||
|
// 7
|
||
|
PV1f.x = mul_nonIEEE(PV0f.y, intBitsToFloat(uf_remappedPS[1].z));
|
||
|
// 8
|
||
|
R1f.x = mul_nonIEEE(R127f.x, PV1f.x);
|
||
|
R1f.y = mul_nonIEEE(R126f.y, PV1f.x);
|
||
|
R1f.z = mul_nonIEEE(R127f.z, PV1f.x);
|
||
|
R1f.w = mul_nonIEEE(R127f.w, PV1f.x);
|
||
|
// export
|
||
|
passPixelColor0 = vec4(R1f.x, R1f.y, R1f.z, R1f.w);
|
||
|
}
|