mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[vulkan] Update shaders and layouts for new scheme
Still need to work on the code, though.
This commit is contained in:
parent
8422732505
commit
2740f6093b
11 changed files with 35 additions and 111 deletions
|
@ -155,7 +155,7 @@
|
||||||
binding = 0;
|
binding = 0;
|
||||||
descriptorType = uniform_buffer;
|
descriptorType = uniform_buffer;
|
||||||
descriptorCount = 1;
|
descriptorCount = 1;
|
||||||
stageFlags = vertex;
|
stageFlags = vertex|geometry;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -173,38 +173,14 @@
|
||||||
bindings = (
|
bindings = (
|
||||||
{
|
{
|
||||||
binding = 0;
|
binding = 0;
|
||||||
descriptorType = uniform_buffer;
|
descriptorType = sampler;
|
||||||
descriptorCount = 1;
|
descriptorCount = 1;
|
||||||
stageFlags = vertex|geometry;
|
stageFlags = fragment;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
binding = 1;
|
binding = 1;
|
||||||
descriptorType = combined_image_sampler;
|
descriptorType = sampled_image;
|
||||||
descriptorCount = 1;
|
descriptorCount = $properties.limits.maxImages;
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 2;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 3;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 4;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 5;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
stageFlags = fragment;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -213,9 +189,9 @@
|
||||||
bindings = (
|
bindings = (
|
||||||
{
|
{
|
||||||
binding = 0;
|
binding = 0;
|
||||||
descriptorType = uniform_buffer;
|
descriptorType = sampler;
|
||||||
descriptorCount = 1;
|
descriptorCount = 1;
|
||||||
stageFlags = vertex;
|
stageFlags = fragment;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
binding = 1;
|
binding = 1;
|
||||||
|
@ -223,60 +199,6 @@
|
||||||
descriptorCount = $properties.limits.maxImages;
|
descriptorCount = $properties.limits.maxImages;
|
||||||
stageFlags = fragment;
|
stageFlags = fragment;
|
||||||
},
|
},
|
||||||
{
|
|
||||||
binding = 2;
|
|
||||||
descriptorType = sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
alias_matrices = {
|
|
||||||
bindings = (
|
|
||||||
{
|
|
||||||
binding = 0;
|
|
||||||
descriptorType = uniform_buffer;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = vertex;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
alias_textures = {
|
|
||||||
bindings = (
|
|
||||||
{
|
|
||||||
binding = 0;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 1;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 2;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
binding = 3;
|
|
||||||
descriptorType = combined_image_sampler;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
alias_lights = {
|
|
||||||
bindings = (
|
|
||||||
{
|
|
||||||
binding = 0;
|
|
||||||
descriptorType = uniform_buffer;
|
|
||||||
descriptorCount = 1;
|
|
||||||
stageFlags = fragment;
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
lighting_attach = {
|
lighting_attach = {
|
||||||
|
@ -355,7 +277,7 @@
|
||||||
setLayouts = (matrix_set, twod_set);
|
setLayouts = (matrix_set, twod_set);
|
||||||
};
|
};
|
||||||
quakebsp_layout = {
|
quakebsp_layout = {
|
||||||
setLayouts = (quakebsp_set);
|
setLayouts = (matrix_set, quakebsp_set);
|
||||||
pushConstantRanges = (
|
pushConstantRanges = (
|
||||||
{
|
{
|
||||||
stageFlags = vertex;
|
stageFlags = vertex;
|
||||||
|
@ -370,8 +292,7 @@
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
alias_layout = {
|
alias_layout = {
|
||||||
//setLayouts = (alias_matrices, alias_lights, alias_textures);
|
setLayouts = (matrix_set, alias_set);
|
||||||
setLayouts = (alias_set);
|
|
||||||
pushConstantRanges = (
|
pushConstantRanges = (
|
||||||
{
|
{
|
||||||
stageFlags = vertex;
|
stageFlags = vertex;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (set = 0, binding = 0) uniform Matrices {
|
layout (set = 0, binding = 0) uniform Matrices {
|
||||||
mat4 Projection;
|
mat4 Projection3d;
|
||||||
mat4 View;
|
mat4 View;
|
||||||
mat4 Sky;
|
mat4 Sky;
|
||||||
|
mat4 Projection2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
|
@ -31,7 +32,7 @@ main (void)
|
||||||
vertex = mix (vertexa, vertexb, blend);
|
vertex = mix (vertexa, vertexb, blend);
|
||||||
norm = mix (normala, normalb, blend);
|
norm = mix (normala, normalb, blend);
|
||||||
pos = (Model * vertex);
|
pos = (Model * vertex);
|
||||||
gl_Position = Projection * (View * pos);
|
gl_Position = Projection3d * (View * pos);
|
||||||
position = pos;
|
position = pos;
|
||||||
normal = mat3 (Model) * norm;
|
normal = mat3 (Model) * norm;
|
||||||
st = uv;
|
st = uv;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (set = 0, binding = 0) uniform Matrices {
|
layout (set = 0, binding = 0) uniform Matrices {
|
||||||
mat4 Projection;
|
mat4 Projection3d;
|
||||||
mat4 View;
|
mat4 View;
|
||||||
mat4 Sky;
|
mat4 Sky;
|
||||||
|
mat4 Projection2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
|
@ -24,5 +25,5 @@ main (void)
|
||||||
|
|
||||||
vertex = mix (vertexa, vertexb, blend);
|
vertex = mix (vertexa, vertexb, blend);
|
||||||
pos = (Model * vertex);
|
pos = (Model * vertex);
|
||||||
gl_Position = Projection * (View * pos);
|
gl_Position = Projection3d * (View * pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
layout (constant_id = 0) const int MaxTextures = 256;
|
layout (constant_id = 0) const int MaxTextures = 256;
|
||||||
|
|
||||||
layout (set = 0, binding = 1) uniform texture2DArray skins[MaxTextures];
|
layout (set = 1, binding = 0) uniform sampler samp;
|
||||||
layout (set = 0, binding = 2) uniform sampler samp;
|
layout (set = 1, binding = 1) uniform texture2DArray skins[MaxTextures];
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
layout (offset = 68)
|
layout (offset = 68)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (set = 0, binding = 0) uniform Matrices {
|
layout (set = 0, binding = 0) uniform Matrices {
|
||||||
mat4 Projection;
|
mat4 Projection3d;
|
||||||
mat4 View;
|
mat4 View;
|
||||||
mat4 Sky;
|
mat4 Sky;
|
||||||
|
mat4 Projection2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
|
@ -15,5 +16,5 @@ layout (location = 0) in vec4 vertex;
|
||||||
void
|
void
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
gl_Position = Projection * (View * (Model * vertex));
|
gl_Position = Projection3d * (View * (Model * vertex));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
layout (constant_id = 0) const int MaxTextures = 256;
|
layout (constant_id = 0) const int MaxTextures = 256;
|
||||||
|
|
||||||
layout (set = 0, binding = 1) uniform texture2DArray textures[MaxTextures];
|
layout (set = 1, binding = 0) uniform sampler samp;
|
||||||
layout (set = 0, binding = 2) uniform sampler samp;
|
layout (set = 1, binding = 1) uniform texture2DArray textures[MaxTextures];
|
||||||
|
|
||||||
layout (set = 0, binding = 1) uniform sampler2D Texture;
|
|
||||||
layout (set = 0, binding = 2) uniform sampler2D GlowMap;
|
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
layout (offset = 64)
|
layout (offset = 64)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (set = 0, binding = 0) uniform Matrices {
|
layout (set = 0, binding = 0) uniform Matrices {
|
||||||
mat4 Projection;
|
mat4 Projection3d;
|
||||||
mat4 View;
|
mat4 View;
|
||||||
mat4 Sky;
|
mat4 Sky;
|
||||||
|
mat4 Projection2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (triangles) in;
|
layout (triangles) in;
|
||||||
|
@ -27,7 +28,7 @@ main()
|
||||||
|
|
||||||
for (int vert = 0; vert < 3; vert++) {
|
for (int vert = 0; vert < 3; vert++) {
|
||||||
vec4 p = gl_in[vert].gl_Position;
|
vec4 p = gl_in[vert].gl_Position;
|
||||||
gl_Position = Projection * (View * (p));
|
gl_Position = Projection3d * (View * (p));
|
||||||
tl_st = v_tl_st[vert];
|
tl_st = v_tl_st[vert];
|
||||||
direction = v_direction[vert];
|
direction = v_direction[vert];
|
||||||
normal = n;
|
normal = n;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (set = 0, binding = 0) uniform Matrices {
|
layout (set = 0, binding = 0) uniform Matrices {
|
||||||
mat4 Projection;
|
mat4 Projection3d;
|
||||||
mat4 View;
|
mat4 View;
|
||||||
mat4 Sky;
|
mat4 Sky;
|
||||||
|
mat4 Projection2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
|
|
|
@ -4,9 +4,9 @@ layout (constant_id = 0) const int MaxTextures = 256;
|
||||||
layout (constant_id = 1) const bool doSkyBox = false;
|
layout (constant_id = 1) const bool doSkyBox = false;
|
||||||
layout (constant_id = 2) const bool doSkySheet = false;
|
layout (constant_id = 2) const bool doSkySheet = false;
|
||||||
|
|
||||||
layout (set = 0, binding = 1) uniform texture2DArray sheet_tex[MaxTextures];
|
layout (set = 1, binding = 0) uniform sampler samp;
|
||||||
layout (set = 0, binding = 1) uniform textureCube cube_tex[MaxTextures];
|
layout (set = 1, binding = 1) uniform texture2DArray sheet_tex[MaxTextures];
|
||||||
layout (set = 0, binding = 2) uniform sampler samp;
|
layout (set = 1, binding = 1) uniform textureCube cube_tex[MaxTextures];
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
layout (offset = 64)
|
layout (offset = 64)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
layout (constant_id = 0) const int MaxTextures = 256;
|
layout (constant_id = 0) const int MaxTextures = 256;
|
||||||
|
|
||||||
layout (set = 0, binding = 1) uniform texture2D textures[MaxTextures];
|
layout (set = 1, binding = 0) uniform sampler samp;
|
||||||
layout (set = 0, binding = 2) uniform sampler samp;
|
layout (set = 1, binding = 1) uniform texture2D textures[MaxTextures];
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
layout (offset = 64)
|
layout (offset = 64)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (set = 0, binding = 0) uniform Matrices {
|
layout (set = 0, binding = 0) uniform Matrices {
|
||||||
mat4 Projection;
|
mat4 Projection3d;
|
||||||
mat4 View;
|
mat4 View;
|
||||||
mat4 Sky;
|
mat4 Sky;
|
||||||
|
mat4 Projection2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (push_constant) uniform PushConstants {
|
layout (push_constant) uniform PushConstants {
|
||||||
|
@ -19,7 +20,7 @@ layout (location = 1) out vec3 direction;
|
||||||
void
|
void
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
gl_Position = Projection * (View * (Model * vertex));
|
gl_Position = Projection3d * (View * (Model * vertex));
|
||||||
direction = (Sky * vertex).xyz;
|
direction = (Sky * vertex).xyz;
|
||||||
tl_st = tl_uv;
|
tl_st = tl_uv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue