mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 14:52:10 +01:00
[dxvk] Add shaders for mip map generation
This commit is contained in:
parent
254676049a
commit
7ec93debf1
11
src/dxvk/shaders/dxvk_mipgen_frag_1d.frag
Normal file
11
src/dxvk/shaders/dxvk_mipgen_frag_1d.frag
Normal file
@ -0,0 +1,11 @@
|
||||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform sampler1DArray s_texture;
|
||||
|
||||
layout(location = 0) in vec3 i_pos;
|
||||
layout(location = 0) out vec4 o_color;
|
||||
|
||||
void main() {
|
||||
o_color = texture(s_texture, i_pos.xz);
|
||||
}
|
11
src/dxvk/shaders/dxvk_mipgen_frag_2d.frag
Normal file
11
src/dxvk/shaders/dxvk_mipgen_frag_2d.frag
Normal file
@ -0,0 +1,11 @@
|
||||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform sampler2DArray s_texture;
|
||||
|
||||
layout(location = 0) in vec3 i_pos;
|
||||
layout(location = 0) out vec4 o_color;
|
||||
|
||||
void main() {
|
||||
o_color = texture(s_texture, i_pos);
|
||||
}
|
17
src/dxvk/shaders/dxvk_mipgen_frag_3d.frag
Normal file
17
src/dxvk/shaders/dxvk_mipgen_frag_3d.frag
Normal file
@ -0,0 +1,17 @@
|
||||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform sampler3D s_texture;
|
||||
|
||||
layout(location = 0) in vec3 i_pos;
|
||||
layout(location = 0) out vec4 o_color;
|
||||
|
||||
layout(push_constant)
|
||||
uniform push_block {
|
||||
uint p_layer_count;
|
||||
};
|
||||
|
||||
void main() {
|
||||
o_color = texture(s_texture, vec3(i_pos.xy,
|
||||
(i_pos.z + 0.5f) / float(p_layer_count)));
|
||||
}
|
25
src/dxvk/shaders/dxvk_mipgen_geom.geom
Normal file
25
src/dxvk/shaders/dxvk_mipgen_geom.geom
Normal file
@ -0,0 +1,25 @@
|
||||
#version 450
|
||||
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 4) out;
|
||||
|
||||
layout(location = 0) in int i_instance[1];
|
||||
layout(location = 0) out vec3 o_pos;
|
||||
|
||||
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++) {
|
||||
o_pos = vec3(0.5f + 0.5f * g_vpos[i].xy, float(i_instance[0]));
|
||||
gl_Position = g_vpos[i];
|
||||
gl_Layer = i_instance[0];
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
EndPrimitive();
|
||||
}
|
8
src/dxvk/shaders/dxvk_mipgen_vert.vert
Normal file
8
src/dxvk/shaders/dxvk_mipgen_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…
x
Reference in New Issue
Block a user