1
0
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:
Philip Rebohle 2018-05-25 17:44:34 +02:00
parent 254676049a
commit 7ec93debf1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 72 additions and 0 deletions

View 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);
}

View 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);
}

View 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)));
}

View 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();
}

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);
}