-
In my custom GLSL shader I have a section like this for the uniforms: layout(set = 0, binding = 0) uniform Camera {
mat4 ViewProj;
};
layout(set = 1, binding = 0) uniform Transform {
mat4 Model;
};
layout(set = 2, binding = 0) uniform LdtkTilemapMaterial_scale {
float map_scale;
};
layout(set = 2, binding = 1) uniform LdtkTilemapMaterial_map_info {
uint map_width_tiles;
uint map_height_tiles;
uint layer_index;
};
layout(set = 2, binding = 2) uniform LdtkTilemapMaterial_tileset_info {
uint tileset_width_tiles;
uint tileset_height_tiles;
uint tileset_grid_size;
};
layout(set = 2, binding = 3) uniform texture2D LdtkTilemapMaterial_texture;
layout(set = 2, binding = 4) uniform sampler LdtkTilemapMaterial_texture_sampler;
struct TileInfo {
uint index;
uint flip_bits;
};
layout(set = 2, binding = 5) buffer LdtkTilemapMaterial_tiles {
TileInfo[] map_tiles;
}; I'm trying to understand how to tell, from my Rust code, what the corresponding For the most part, I got the above example working great, except for the fact that it seems like the Somehow the SpriteTransform is in layout(set = 0, binding = 0) uniform Camera {
mat4 ViewProj;
};
// TODO: merge dimensions into "sprites" buffer when that is supported in the Uniforms derive abstraction
layout(set = 1, binding = 0) uniform TextureAtlas_size {
vec2 AtlasSize;
};
struct Rect {
vec2 begin;
vec2 end;
};
layout(set = 1, binding = 1) buffer TextureAtlas_textures {
Rect[] Textures;
};
layout(set = 2, binding = 0) uniform Transform {
mat4 SpriteTransform;
};
layout(set = 2, binding = 1) uniform TextureAtlasSprite {
vec4 TextureAtlasSprite_color;
uint TextureAtlasSprite_index;
}; It all seems almost random to me. I don't really mind it being in different orders or anything, but is there any reliable way for me to tell where in the layout these resources are going to end up so that I know how to write my shader? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
OK, I'm going to go with the conclusion that Bevy just figures it out based on the names. I found out that something else was wong with my |
Beta Was this translation helpful? Give feedback.
OK, I'm going to go with the conclusion that Bevy just figures it out based on the names. I found out that something else was wong with my
Transform
s and that's why I wasn't getting any info in the shader there.