{gfx,examples}: fix refcounting bugs, improve sysgpu compatability
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
cbb728c37a
commit
ca08255ec2
11 changed files with 39 additions and 24 deletions
|
|
@ -222,8 +222,6 @@ fn tick(
|
|||
.load_op = .clear,
|
||||
.store_op = .store,
|
||||
}};
|
||||
// TODO: can we eliminate this assignment
|
||||
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
||||
game.state().frame_render_pass = game.state().frame_encoder.beginRenderPass(&gpu.RenderPassDescriptor.init(.{
|
||||
.label = label,
|
||||
.color_attachments = &color_attachments,
|
||||
|
|
@ -244,9 +242,10 @@ fn endFrame(game: *Mod, core: *mach.Core.Mod) !void {
|
|||
game.state().frame_render_pass.end();
|
||||
const label = @tagName(name) ++ ".endFrame";
|
||||
var command = game.state().frame_encoder.finish(&.{ .label = label });
|
||||
game.state().frame_encoder.release();
|
||||
defer command.release();
|
||||
core.state().queue.submit(&[_]*gpu.CommandBuffer{command});
|
||||
game.state().frame_encoder.release();
|
||||
game.state().frame_render_pass.release();
|
||||
|
||||
// Present the frame
|
||||
core.send(.present_frame, .{});
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ fn init(
|
|||
}
|
||||
|
||||
fn prepare(core: *mach.Core.Mod, glyphs: *Mod) !void {
|
||||
const device = core.state().device;
|
||||
const queue = device.getQueue();
|
||||
var s = glyphs.state();
|
||||
|
||||
// Prepare which glyphs we will render
|
||||
|
|
@ -126,5 +124,5 @@ fn prepare(core: *mach.Core.Mod, glyphs: *Mod) !void {
|
|||
.bytes_per_row = @as(u32, @intCast(img_size.width * 4)),
|
||||
.rows_per_image = @as(u32, @intCast(img_size.height)),
|
||||
};
|
||||
queue.writeTexture(&.{ .texture = s.texture }, &data_layout, &img_size, s.texture_atlas.data);
|
||||
core.state().queue.writeTexture(&.{ .texture = s.texture }, &data_layout, &img_size, s.texture_atlas.data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue