1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

[dxvk] Add shaders for new meta-resolve operation

This commit is contained in:
Philip Rebohle 2018-06-23 09:48:03 +02:00
parent db7a7fa4bc
commit c5f45d9153
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
6 changed files with 80 additions and 0 deletions

View File

@ -18,6 +18,12 @@ dxvk_shaders = files([
'shaders/dxvk_mipgen_frag_2d.frag',
'shaders/dxvk_mipgen_frag_3d.frag',
'shaders/dxvk_resolve_vert.vert',
'shaders/dxvk_resolve_geom.geom',
'shaders/dxvk_resolve_frag_f.frag',
'shaders/dxvk_resolve_frag_i.frag',
'shaders/dxvk_resolve_frag_u.frag',
'hud/shaders/hud_line.frag',
'hud/shaders/hud_text.frag',
'hud/shaders/hud_vert.vert',

View File

@ -0,0 +1,15 @@
#version 450
layout(set = 0, binding = 0)
uniform sampler2DMSArray s_image;
layout(location = 0) out vec4 o_color;
void main() {
int sampleCount = textureSamples(s_image);
o_color = vec4(0.0f);
for (int i = 0; i < sampleCount; i++)
o_color += texelFetch(s_image, ivec3(gl_FragCoord.xy, gl_Layer), i);
o_color /= float(sampleCount);
}

View File

@ -0,0 +1,14 @@
#version 450
layout(set = 0, binding = 0)
uniform isampler2DMSArray s_image;
layout(location = 0) out ivec4 o_color;
void main() {
int sampleCount = textureSamples(s_image);
o_color = ivec4(0);
for (int i = 0; i < sampleCount; i++)
o_color += texelFetch(s_image, ivec3(gl_FragCoord.xy, gl_Layer), i) / sampleCount;
}

View File

@ -0,0 +1,14 @@
#version 450
layout(set = 0, binding = 0)
uniform usampler2DMSArray s_image;
layout(location = 0) out uvec4 o_color;
void main() {
int sampleCount = textureSamples(s_image);
o_color = uvec4(0u);
for (int i = 0; i < sampleCount; i++)
o_color += texelFetch(s_image, ivec3(gl_FragCoord.xy, gl_Layer), i) / uint(sampleCount);
}

View File

@ -0,0 +1,23 @@
#version 450
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
layout(location = 0) in int i_instance[1];
const vec4 g_vpos[4] = {
vec4(-1.0f, -1.0f, 0.0f, 1.0f),
vec4(-1.0f, 1.0f, 0.0f, 1.0f),
vec4( 1.0f, -1.0f, 0.0f, 1.0f),
vec4( 1.0f, 1.0f, 0.0f, 1.0f),
};
void main() {
for (int i = 0; i < 4; i++) {
gl_Position = g_vpos[i];
gl_Layer = i_instance[0];
EmitVertex();
}
EndPrimitive();
}

View File

@ -0,0 +1,8 @@
#version 450
layout(location = 0) out int o_instance;
void main() {
o_instance = gl_InstanceIndex;
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
}