Actual deleak, debug object names
This commit is contained in:
@@ -18,12 +18,14 @@ const Vector3 = math.Vector3;
|
||||
pub const chunk_size = 16;
|
||||
|
||||
const initial_capacity = 256;
|
||||
var next_chunk_id: std.atomic.Value(u64) = .init(0);
|
||||
|
||||
blocks: [chunk_size][chunk_size][chunk_size]Blocks.Id,
|
||||
origin: Vector3,
|
||||
descriptor_set: vk.DescriptorSet,
|
||||
object_buffer: ObjectUniformsBuffer,
|
||||
object_count: u32,
|
||||
chunk_id: u64,
|
||||
|
||||
pub const InitInfo = struct {
|
||||
origin: Vector3,
|
||||
@@ -65,12 +67,18 @@ pub fn init(engine: *Engine, init_info: InitInfo) !Chunk {
|
||||
},
|
||||
});
|
||||
|
||||
const chunk_id = next_chunk_id.fetchAdd(1, .monotonic);
|
||||
engine.setObjectName(descriptor_set, "DS Chunk[{d}]", .{chunk_id});
|
||||
engine.setObjectName(object_buffer.buffer, "B Chunk[{d}]", .{chunk_id});
|
||||
engine.setObjectName(object_buffer.device_memory, "DM Chunk[{d}]", .{chunk_id});
|
||||
|
||||
return .{
|
||||
.blocks = .{.{[_]Blocks.Id{.air} ** chunk_size} ** chunk_size} ** chunk_size,
|
||||
.origin = init_info.origin,
|
||||
.descriptor_set = descriptor_set,
|
||||
.object_buffer = object_buffer,
|
||||
.object_count = 0,
|
||||
.chunk_id = chunk_id,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -128,6 +136,8 @@ pub fn refresh(self: *Chunk, engine: *Engine, blocks: *const Blocks, temp_alloca
|
||||
|
||||
self.object_buffer.deinit(engine);
|
||||
self.object_buffer = new_object_buffer;
|
||||
engine.setObjectName(new_object_buffer.buffer, "B Chunk[{d}]", .{self.chunk_id});
|
||||
engine.setObjectName(new_object_buffer.device_memory, "DM Chunk[{d}]", .{self.chunk_id});
|
||||
}
|
||||
|
||||
const uniforms = try temp_allocator.alloc(Game.ObjectUniforms, object_count);
|
||||
|
||||
@@ -53,6 +53,7 @@ pub fn init(engine: *Engine, allocator: std.mem.Allocator) !Materials {
|
||||
.usage = .storage,
|
||||
.target_queue = .graphics,
|
||||
.array_capacity = capacity,
|
||||
.name = "Materials",
|
||||
});
|
||||
errdefer material_buffer.deinit(engine);
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ pub fn init(engine: *Engine, allocator: std.mem.Allocator) !Textures {
|
||||
.height = 1,
|
||||
.usage = .base_color,
|
||||
.target_queue = .graphics,
|
||||
.name = "@Empty",
|
||||
});
|
||||
textures.appendAssumeCapacity(empty_base_color_texture);
|
||||
|
||||
@@ -58,6 +59,7 @@ pub fn init(engine: *Engine, allocator: std.mem.Allocator) !Textures {
|
||||
.height = 1,
|
||||
.usage = .emissive,
|
||||
.target_queue = .graphics,
|
||||
.name = "@Empty",
|
||||
});
|
||||
textures.appendAssumeCapacity(empty_emissive_texture);
|
||||
|
||||
@@ -66,6 +68,7 @@ pub fn init(engine: *Engine, allocator: std.mem.Allocator) !Textures {
|
||||
.height = 1,
|
||||
.usage = .normal,
|
||||
.target_queue = .graphics,
|
||||
.name = "@Empty",
|
||||
});
|
||||
textures.appendAssumeCapacity(empty_normal_texture);
|
||||
|
||||
@@ -74,6 +77,7 @@ pub fn init(engine: *Engine, allocator: std.mem.Allocator) !Textures {
|
||||
.height = 1,
|
||||
.usage = .occlusion_roughness_metallic,
|
||||
.target_queue = .graphics,
|
||||
.name = "@Empty",
|
||||
});
|
||||
textures.appendAssumeCapacity(empty_occlusuion_roughness_metallic_texture);
|
||||
|
||||
@@ -176,6 +180,7 @@ fn loadTexture(engine: *Engine, filename: []const u8, usage: Texture.Usage, temp
|
||||
.height = img.height,
|
||||
.usage = usage,
|
||||
.target_queue = .graphics,
|
||||
.name = filename,
|
||||
});
|
||||
errdefer texture.deinit(engine);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user