get rid of tile_infos buffer for world shader and instead just use the vertex uvs
This commit is contained in:
+6
-22
@@ -249,8 +249,6 @@ static TileInfo tile_infos[] = {
|
||||
{ 0x0423, "tiles/grass_ground_two_corner.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GROUND ) },
|
||||
};
|
||||
|
||||
static V4 cpu_tile_infos_buffer[SDL_arraysize(tile_infos)];
|
||||
|
||||
static Sint32 selected_tile_kind = -1;
|
||||
|
||||
static Sint32 selected_tile = -1;
|
||||
@@ -851,16 +849,6 @@ static bool recreate_graphics_pipelines() {
|
||||
.minBindingSize = 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
.binding = 3,
|
||||
.visibility = WGPUShaderStage_Vertex,
|
||||
|
||||
.buffer = {
|
||||
.type = WGPUBufferBindingType_ReadOnlyStorage,
|
||||
.hasDynamicOffset = false,
|
||||
.minBindingSize = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
WGPUBindGroupLayoutDescriptor world_bind_group_layout_descriptor = {
|
||||
@@ -902,13 +890,18 @@ static bool recreate_graphics_pipelines() {
|
||||
.offset = offsetof(Vertex, pos),
|
||||
.shaderLocation = 0,
|
||||
},
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x2,
|
||||
.offset = offsetof(Vertex, uv),
|
||||
.shaderLocation = 1,
|
||||
},
|
||||
};
|
||||
|
||||
WGPUVertexAttribute instance_buffer_attributes[] = {
|
||||
{
|
||||
.format = WGPUVertexFormat_Uint32,
|
||||
.offset = 0,
|
||||
.shaderLocation = 1,
|
||||
.shaderLocation = 2,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1121,8 +1114,6 @@ static bool recreate_tile_textures() {
|
||||
SDL_assert_always(width == TILE_SIZE);
|
||||
SDL_assert_always(height == TILE_SIZE);
|
||||
|
||||
cpu_tile_infos_buffer[i] = V4_(0, 0, 1, 1);
|
||||
|
||||
WGPUTexelCopyTextureInfo texel_copy_texture_info = {
|
||||
.texture = tile_textures_array,
|
||||
.mipLevel = 0,
|
||||
@@ -1516,12 +1507,6 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
tile_infos_buffer = create_buffer(WGPUBufferUsage_Storage, SDL_arraysize(cpu_tile_infos_buffer) * sizeof(*cpu_tile_infos_buffer), cpu_tile_infos_buffer, "tile_infos_buffer");
|
||||
if (!tile_infos_buffer) {
|
||||
log_error("Failed to create buffer. Exiting.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
WGPUBindGroupEntry per_frame_bind_group_entries[] = {
|
||||
{ .binding = 0, .buffer = view_projection_matrix_buffer, .offset = 0, .size = WGPU_WHOLE_SIZE },
|
||||
{ .binding = 1, .buffer = per_frame_buffer, .offset = 0, .size = WGPU_WHOLE_SIZE },
|
||||
@@ -1539,7 +1524,6 @@ int main(int argc, char **argv) {
|
||||
{ .binding = 0, .textureView = tile_textures_array_view },
|
||||
{ .binding = 1, .sampler = pixel_sampler },
|
||||
{ .binding = 2, .buffer = tint_color_buffer, .offset = 0, .size = WGPU_WHOLE_SIZE },
|
||||
{ .binding = 3, .buffer = tile_infos_buffer, .offset = 0, .size = WGPU_WHOLE_SIZE },
|
||||
};
|
||||
|
||||
WGPUBindGroupDescriptor world_bind_group_descriptor = {
|
||||
|
||||
Reference in New Issue
Block a user