2017-12-04 21:54:57 +01:00
|
|
|
#version 420
|
|
|
|
#extension GL_ARB_texture_gather : enable
|
2019-07-07 11:26:09 +02:00
|
|
|
#extension GL_ARB_separate_shader_objects : enable
|
2019-11-29 04:36:05 +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 shaders was auto-converted from OpenGL to Cemu so expect weird code and possible errors.
|
|
|
|
|
2019-07-07 11:26:09 +02:00
|
|
|
|
2017-12-04 21:54:57 +01:00
|
|
|
// shader cb0e6e8cbec4502a
|
2019-07-07 11:26:09 +02:00
|
|
|
// Used for: 1 pass Battle, Camera and Scope Depth of Field Blur
|
2018-10-31 11:03:04 +01:00
|
|
|
|
2019-11-29 04:36:05 +01:00
|
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
2017-12-04 21:54:57 +01:00
|
|
|
layout(location = 0) in vec4 passParameterSem3;
|
|
|
|
layout(location = 0) out vec4 passPixelColor0;
|
2019-11-29 04:36:05 +01:00
|
|
|
#ifdef VULKAN
|
|
|
|
layout(set = 1, binding = 1) uniform ufBlock
|
|
|
|
{
|
|
|
|
uniform vec4 uf_fragCoordScale;
|
|
|
|
};
|
|
|
|
#else
|
2017-12-04 21:54:57 +01:00
|
|
|
uniform vec2 uf_fragCoordScale;
|
2019-11-29 04:36:05 +01:00
|
|
|
#endif
|
2017-12-04 21:54:57 +01:00
|
|
|
|
2019-07-07 11:26:09 +02:00
|
|
|
int radius = int( roundEven(2.0/uf_fragCoordScale.y) );
|
|
|
|
vec2 resolution = vec2( textureSize(textureUnitPS0,0) );
|
2017-12-04 21:54:57 +01:00
|
|
|
|
|
|
|
void main() {
|
2019-07-07 11:26:09 +02:00
|
|
|
vec2 center = ( passParameterSem3.xy + passParameterSem3.zw ) / 2.0 ;
|
|
|
|
vec3 result = vec3(0.0);
|
2017-12-04 21:54:57 +01:00
|
|
|
float count = 0.0;
|
2019-07-07 11:26:09 +02:00
|
|
|
for ( int x = 1-radius; x <= radius-1; x+=2 ) {
|
|
|
|
for ( int y = 1-radius; y <= radius-1; y+=2 ) {
|
|
|
|
if ( length(vec2(x, y)) <= radius ) {
|
|
|
|
result += texture( textureUnitPS0, center + vec2(x, y)/resolution ).xyz ;
|
2017-12-04 21:54:57 +01:00
|
|
|
count += 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-07 11:26:09 +02:00
|
|
|
passPixelColor0 = vec4( result / count, 0.0 );
|
2017-12-04 21:54:57 +01:00
|
|
|
}
|