mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Add shaders for new meta-resolve operation
This commit is contained in:
parent
db7a7fa4bc
commit
c5f45d9153
@ -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',
|
||||
|
15
src/dxvk/shaders/dxvk_resolve_frag_f.frag
Normal file
15
src/dxvk/shaders/dxvk_resolve_frag_f.frag
Normal 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);
|
||||
}
|
14
src/dxvk/shaders/dxvk_resolve_frag_i.frag
Normal file
14
src/dxvk/shaders/dxvk_resolve_frag_i.frag
Normal 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;
|
||||
}
|
14
src/dxvk/shaders/dxvk_resolve_frag_u.frag
Normal file
14
src/dxvk/shaders/dxvk_resolve_frag_u.frag
Normal 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);
|
||||
}
|
23
src/dxvk/shaders/dxvk_resolve_geom.geom
Normal file
23
src/dxvk/shaders/dxvk_resolve_geom.geom
Normal 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();
|
||||
}
|
8
src/dxvk/shaders/dxvk_resolve_vert.vert
Normal file
8
src/dxvk/shaders/dxvk_resolve_vert.vert
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user