Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xfitgd committed Dec 14, 2024
1 parent e08dc72 commit ac1b8a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/__render_command.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub fn refresh_all() void {
for (render_cmd_list.?.items) |cmd| {
cmd.*.refresh();
}
render_command.mutex.unlock();
}

pub fn destroy() void {
Expand Down
4 changes: 2 additions & 2 deletions src/__vulkan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,9 @@ fn recordCommandBuffer(commandBuffer: **render_command, fr: u32) void {

shape_list.resize(0) catch unreachable;

commandBuffer.*.*.objs_mutex.lock();
commandBuffer.*.*.objs_lock.lockShared();
const objs = __system.allocator.dupe(graphics.iobject, commandBuffer.*.*.scene.?) catch unreachable;
commandBuffer.*.*.objs_mutex.unlock();
commandBuffer.*.*.objs_lock.unlockShared();
defer __system.allocator.free(objs);

if (__system.cmd_op_wait.cmpxchgStrong(true, false, .acq_rel, .monotonic) == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/render_command.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ __command_buffers: [MAX_FRAME][]vk.CommandBuffer = undefined,
scene: ?[]graphics.iobject = null,
offscreen_image: ?*graphics.image = null,
///!you have to lock this add or modify iobject 'scene'
objs_mutex: std.Thread.Mutex = .{},
objs_lock: std.Thread.RwLock = .{},
const Self = @This();

pub fn init() *Self {
Expand Down

0 comments on commit ac1b8a6

Please sign in to comment.