fixing dangling pointer
This commit is contained in:
@@ -92,7 +92,8 @@ fn taskRunner(self: *Self, info: Interface.SubmitInfo, p_fence: ?*base.Fence, ru
|
||||
command_buffers.deinit(soft_device.device_allocator.allocator());
|
||||
}
|
||||
|
||||
var execution_device: ExecutionDevice = .init(soft_device);
|
||||
var execution_device: ExecutionDevice = undefined;
|
||||
execution_device.init(soft_device);
|
||||
defer execution_device.deinit();
|
||||
|
||||
for (info.command_buffers.items) |command_buffer| {
|
||||
|
||||
@@ -63,9 +63,7 @@ pub fn dispatch(self: *Self, group_count_x: u32, group_count_y: u32, group_count
|
||||
|
||||
var wg: std.Io.Group = .init;
|
||||
for (0..@min(self.batch_size, group_count)) |batch_id| {
|
||||
if (base.config.single_threaded_compute) {
|
||||
@branchHint(.cold); // Should only be reached for debugging
|
||||
|
||||
if (comptime base.config.single_threaded_compute) {
|
||||
runWrapper(
|
||||
RunData{
|
||||
.self = self,
|
||||
|
||||
@@ -27,9 +27,9 @@ renderer: Renderer,
|
||||
/// .compute = 1
|
||||
pipeline_states: [2]PipelineState,
|
||||
|
||||
pub fn init(device: *SoftDevice) Self {
|
||||
var self: Self = undefined;
|
||||
|
||||
/// Initializating an execution device and
|
||||
/// not creating one to avoid dangling pointers
|
||||
pub fn init(self: *Self, device: *SoftDevice) void {
|
||||
for (self.pipeline_states[0..]) |*state| {
|
||||
state.* = .{
|
||||
.pipeline = null,
|
||||
@@ -38,8 +38,6 @@ pub fn init(device: *SoftDevice) Self {
|
||||
}
|
||||
self.compute = .init(device, &self.pipeline_states[@intFromEnum(vk.PipelineBindPoint.compute)]);
|
||||
self.renderer = .init();
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Self) void {
|
||||
|
||||
Reference in New Issue
Block a user