Skip to content

Commit

Permalink
Use only global descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
SaumonDesMers authored and afaure42 committed Nov 8, 2024
1 parent 7a3bda1 commit 7b145bc
Show file tree
Hide file tree
Showing 24 changed files with 121 additions and 668 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(ft_vox
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(TRACY_ENABLE "" OFF)
option(TRACY_ENABLE "" ON)
add_subdirectory(external/tracy)
add_subdirectory(external/freetype/freetype-2.13.3)
add_subdirectory(external/portaudio EXCLUDE_FROM_ALL)
Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/chunk_shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/entity_shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
2 changes: 2 additions & 0 deletions shaders/rasterization/hud/hud_shader.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#version 450

#include "common.glsl"

layout (set = 1, binding = 0) uniform sampler2D image;

layout (location = 0) in vec2 inUV;
Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/hud/item_icon_shader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout (set = 1, binding = 0) uniform sampler2DArray image;
layout (set = 0, binding = ITEM_ICON_TEXTURE_BINDING) uniform sampler2DArray image;

layout(push_constant) uniform PushConstants
{
Expand Down
2 changes: 2 additions & 0 deletions shaders/rasterization/hud/item_icon_shader.vert
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#version 450

#include "common.glsl"

vec2 positions[6] = vec2[](
vec2( 1.0, -1.0),
vec2(-1.0, -1.0),
Expand Down
4 changes: 3 additions & 1 deletion shaders/rasterization/hud/test_image_shader.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#version 450

layout (set = 1, binding = 0) uniform sampler2DArray image;
#include "common.glsl"

layout (set = 0, binding = TEST_IMAGE_BINDING) uniform sampler2DArray image;

layout (location = 0) in vec2 inUV;

Expand Down
4 changes: 3 additions & 1 deletion shaders/rasterization/hud/test_image_shader.vert
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#version 450

#include "common.glsl"

vec2 positions[6] = vec2[](
vec2( 1.0, -1.0),
vec2(-1.0, -1.0),
Expand All @@ -24,4 +26,4 @@ void main()
{
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
outUV = texCoords[gl_VertexIndex];
}
}
2 changes: 1 addition & 1 deletion shaders/rasterization/line_shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
6 changes: 4 additions & 2 deletions shaders/rasterization/misc/prerender_item_icon_shader.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#version 450

layout(set = 1, binding = 0) uniform sampler2DArray item_textures;
#include "common.glsl"

layout(set = 0, binding = BLOCK_TEXTURES_BINDING) uniform sampler2DArray block_textures;

layout(location = 0) in vec3 frag_normal;
layout(location = 1) in vec3 frag_tex_coord;
Expand All @@ -11,7 +13,7 @@ void main()
{
const vec3 normal = abs(frag_normal);
float light = 0.3 * normal.x + 0.9 * normal.y + 0.6 * normal.z;
vec4 texture_color = texture(item_textures, frag_tex_coord);
vec4 texture_color = texture(block_textures, frag_tex_coord);

if (texture_color.a < 0.01)
{
Expand Down
4 changes: 3 additions & 1 deletion shaders/rasterization/player_shader.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#version 450

layout (set = 1, binding = 0) uniform sampler2D image;
#include "common.glsl"

layout (set = 0, binding = PLAYER_SKIN_BINDING) uniform sampler2D image;

layout (location = 0) in vec2 inUV;

Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/player_shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
4 changes: 3 additions & 1 deletion shaders/rasterization/shadow/shadow_shader.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#version 450

layout(set = 2, binding = 0) uniform sampler2DArray block_textures;
#include "common.glsl"

layout(set = 0, binding = BLOCK_TEXTURES_BINDING) uniform sampler2DArray block_textures;

layout(location = 0) in vec3 frag_tex_coords;

Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/shadow/shadow_shader.geom
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
layout(triangles, invocations = 1) in;
layout(triangle_strip, max_vertices = 3) out;

layout (std140, set = 1, binding = 0) uniform LightSpaceMatrices
layout (std140, set = 0, binding = SUN_MATRICES_BINDING) uniform LightSpaceMatrices
{
ShadowMapLight shadow_map_light;
};
Expand Down
4 changes: 3 additions & 1 deletion shaders/rasterization/sky/box.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#version 450

layout(set = 1, binding = 0) uniform samplerCube cubeMapTexture;
#include "common.glsl"

layout(set = 0, binding = SKYBOX_CUBE_MAP_BINDING) uniform samplerCube cubeMapTexture;

layout(location = 0) in vec3 texDir;

Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/sky/box.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
4 changes: 3 additions & 1 deletion shaders/rasterization/sky/sun.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#version 450

layout(set = 1, binding = 0) uniform AtmospherParams
#include "common.glsl"

layout(set = 0, binding = ATMOSPHERE_PARAM_BINDING) uniform AtmospherParams
{
vec3 sun_dir;
float earth_radius;
Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/sky/sun.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
12 changes: 6 additions & 6 deletions shaders/rasterization/water/water_shader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
mat4 view;
mat4 projection;
}cm;
layout(set = 1, binding = 0, scalar) uniform LightSpaceMatrices
layout(set = 0, binding = SUN_MATRICES_BINDING, scalar) uniform LightSpaceMatrices
{
ShadowMapLight shadow_map_light;
};
layout(set = 2, binding = 0) uniform sampler2DArray tex;
layout(set = 3, binding = 0) uniform sampler2DArray shadow_map;
layout(set = 0, binding = BLOCK_TEXTURES_BINDING) uniform sampler2DArray tex;
layout(set = 0, binding = SHADOW_MAP_BINDING) uniform sampler2DArray shadow_map;

layout(input_attachment_index = 0, set = 4, binding = 0) uniform subpassInput color;
layout(input_attachment_index = 1, set = 4, binding = 1) uniform subpassInput depth;
layout(input_attachment_index = 0, set = 0, binding = WATER_RENDERPASS_INPUT_COLOR_ATTACH_BINDING) uniform subpassInput color;
layout(input_attachment_index = 1, set = 0, binding = WATER_RENDERPASS_INPUT_DEPTH_ATTACH_BINDING) uniform subpassInput depth;

layout(location = 0) in vec3 frag_normal;
layout(location = 1) in vec3 frag_tex_coord;
Expand Down
2 changes: 1 addition & 1 deletion shaders/rasterization/water/water_shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "common.glsl"

layout(set = 0, binding = 0) uniform CameraMatrices
layout(set = 0, binding = CAMERA_MATRICES_BINDING) uniform CameraMatrices
{
ViewProjMatrices cm;
};
Expand Down
Loading

0 comments on commit 7b145bc

Please sign in to comment.