mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Ensure bind groups are ordered with the most frequently changed ones in later slots
This commit is contained in:
parent
16633cc3ec
commit
58f237eaf5
@ -38,9 +38,9 @@ layout(location = 1) flat in vec3 f_norm;
|
||||
// const vec4 sun_pos = vec4(0.0);
|
||||
// #endif
|
||||
|
||||
layout(set = 3, binding = 0)
|
||||
layout(set = 2, binding = 0)
|
||||
uniform texture2D t_col_light;
|
||||
layout(set = 3, binding = 1)
|
||||
layout(set = 2, binding = 1)
|
||||
uniform sampler s_col_light;
|
||||
|
||||
//struct ShadowLocals {
|
||||
@ -53,7 +53,7 @@ uniform sampler s_col_light;
|
||||
// ShadowLocals shadowMats[/*MAX_LAYER_FACES*/192];
|
||||
//};
|
||||
|
||||
layout (std140, set = 2, binding = 0)
|
||||
layout (std140, set = 3, binding = 0)
|
||||
uniform u_locals {
|
||||
mat4 model_mat;
|
||||
vec4 highlight_col;
|
||||
@ -71,7 +71,7 @@ struct BoneData {
|
||||
mat4 normals_mat;
|
||||
};
|
||||
|
||||
layout (std140, set = 2, binding = 1)
|
||||
layout (std140, set = 3, binding = 1)
|
||||
uniform u_bones {
|
||||
BoneData bones[16];
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ layout(location = 1) in uint v_atlas_pos;
|
||||
// out vec3 light_pos[2];
|
||||
in uint v_ao_bone; */
|
||||
|
||||
layout (std140, set = 2, binding = 0)
|
||||
layout (std140, set = 3, binding = 0)
|
||||
uniform u_locals {
|
||||
mat4 model_mat;
|
||||
vec4 highlight_col;
|
||||
@ -49,7 +49,7 @@ struct BoneData {
|
||||
mat4 normals_mat;
|
||||
};
|
||||
|
||||
layout (std140, set = 2, binding = 1)
|
||||
layout (std140, set = 3, binding = 1)
|
||||
uniform u_bones {
|
||||
// Warning: might not actually be 16 elements long. Don't index out of bounds!
|
||||
BoneData bones[16];
|
||||
|
@ -22,9 +22,9 @@ layout(location = 2) flat in float f_select;
|
||||
layout(location = 3) in vec2 f_uv_pos;
|
||||
layout(location = 4) in vec2 f_inst_light;
|
||||
|
||||
layout(set = 3, binding = 0)
|
||||
layout(set = 2, binding = 0)
|
||||
uniform texture2D t_col_light;
|
||||
layout(set = 3, binding = 1)
|
||||
layout(set = 2, binding = 1)
|
||||
uniform sampler s_col_light;
|
||||
|
||||
layout(location = 0) out vec4 tgt_color;
|
||||
|
@ -34,7 +34,7 @@ layout(set = 0, binding = 12) restrict readonly buffer sprite_verts {
|
||||
uvec2 verts[];
|
||||
};
|
||||
|
||||
layout (std140, set = 2, binding = 0)
|
||||
layout (std140, set = 3, binding = 0)
|
||||
uniform u_terrain_locals {
|
||||
vec3 model_offs;
|
||||
float load_time;
|
||||
|
@ -45,12 +45,12 @@ in vec4 sun_pos;
|
||||
const vec4 sun_pos = vec4(0.0);
|
||||
#endif */
|
||||
|
||||
layout(set = 3, binding = 0)
|
||||
layout(set = 2, binding = 0)
|
||||
uniform texture2D t_col_light;
|
||||
layout(set = 3, binding = 1)
|
||||
layout(set = 2, binding = 1)
|
||||
uniform sampler s_col_light;
|
||||
|
||||
layout (std140, set = 2, binding = 0)
|
||||
layout (std140, set = 3, binding = 0)
|
||||
uniform u_locals {
|
||||
vec3 model_offs;
|
||||
float load_time;
|
||||
|
@ -28,7 +28,7 @@ layout(location = 0) in uint v_pos_norm;
|
||||
// in uint v_col_light;
|
||||
layout(location = 1) in uint v_atlas_pos;
|
||||
|
||||
layout (std140, set = 2, binding = 0)
|
||||
layout (std140, set = 3, binding = 0)
|
||||
uniform u_locals {
|
||||
vec3 model_offs;
|
||||
float load_time;
|
||||
|
@ -185,8 +185,8 @@ impl FigurePipeline {
|
||||
bind_group_layouts: &[
|
||||
&global_layout.globals,
|
||||
&global_layout.shadow_textures,
|
||||
&layout.locals,
|
||||
&global_layout.col_light,
|
||||
&layout.locals,
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -263,9 +263,9 @@ impl SpritePipeline {
|
||||
bind_group_layouts: &[
|
||||
&layout.globals,
|
||||
&global_layout.shadow_textures,
|
||||
&terrain_layout.locals,
|
||||
// Note: mergable with globals
|
||||
&global_layout.col_light,
|
||||
&terrain_layout.locals,
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -230,8 +230,8 @@ impl TerrainPipeline {
|
||||
bind_group_layouts: &[
|
||||
&global_layout.globals,
|
||||
&global_layout.shadow_textures,
|
||||
&layout.locals,
|
||||
&global_layout.col_light,
|
||||
&layout.locals,
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -598,7 +598,7 @@ impl<'pass> FirstPassDrawer<'pass> {
|
||||
render_pass.set_pipeline(&self.pipelines.sprite.pipeline);
|
||||
set_quad_index_buffer::<sprite::Vertex>(&mut render_pass, &self.borrow);
|
||||
render_pass.set_bind_group(0, &globals.bind_group, &[]);
|
||||
render_pass.set_bind_group(3, &col_lights.bind_group, &[]);
|
||||
render_pass.set_bind_group(2, &col_lights.bind_group, &[]);
|
||||
|
||||
SpriteDrawer {
|
||||
render_pass,
|
||||
@ -653,9 +653,9 @@ impl<'pass_ref, 'pass: 'pass_ref> FigureDrawer<'pass_ref, 'pass> {
|
||||
// TODO: don't rebind this every time once they are shared between figures
|
||||
col_lights: &'data ColLights<figure::Locals>,
|
||||
) {
|
||||
self.render_pass.set_bind_group(2, &locals.bind_group, &[]);
|
||||
self.render_pass
|
||||
.set_bind_group(3, &col_lights.bind_group, &[]);
|
||||
.set_bind_group(2, &col_lights.bind_group, &[]);
|
||||
self.render_pass.set_bind_group(3, &locals.bind_group, &[]);
|
||||
self.render_pass.set_vertex_buffer(0, model.buf());
|
||||
self.render_pass
|
||||
.draw_indexed(0..model.len() as u32 / 4 * 6, 0, 0..1);
|
||||
@ -681,11 +681,11 @@ impl<'pass_ref, 'pass: 'pass_ref> TerrainDrawer<'pass_ref, 'pass> {
|
||||
.is_none()
|
||||
{
|
||||
self.render_pass
|
||||
.set_bind_group(3, &col_lights.bind_group, &[]); // TODO: put this in slot 2
|
||||
.set_bind_group(2, &col_lights.bind_group, &[]);
|
||||
self.col_lights = Some(col_lights);
|
||||
};
|
||||
|
||||
self.render_pass.set_bind_group(2, &locals.bind_group, &[]); // TODO: put this in slot 3
|
||||
self.render_pass.set_bind_group(3, &locals.bind_group, &[]);
|
||||
self.render_pass.set_vertex_buffer(0, model.buf().slice(..));
|
||||
self.render_pass
|
||||
.draw_indexed(0..model.len() as u32 / 4 * 6, 0, 0..1);
|
||||
@ -725,7 +725,7 @@ impl<'pass_ref, 'pass: 'pass_ref> SpriteDrawer<'pass_ref, 'pass> {
|
||||
instances: &'data Instances<sprite::Instance>,
|
||||
) {
|
||||
self.render_pass
|
||||
.set_bind_group(2, &terrain_locals.bind_group, &[]);
|
||||
.set_bind_group(3, &terrain_locals.bind_group, &[]);
|
||||
|
||||
self.render_pass
|
||||
.set_vertex_buffer(0, instances.buf().slice(..));
|
||||
|
Loading…
Reference in New Issue
Block a user