{gfx,examples}: update all to new mach.Core module API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ac4fe65eb2
commit
d045b34f70
13 changed files with 910 additions and 689 deletions
|
|
@ -1,7 +1,6 @@
|
|||
const std = @import("std");
|
||||
const mach = @import("../main.zig");
|
||||
const core = mach.core;
|
||||
const gpu = mach.core.gpu;
|
||||
const gpu = mach.gpu;
|
||||
const gfx = mach.gfx;
|
||||
const Engine = mach.Engine;
|
||||
|
||||
|
|
@ -44,7 +43,7 @@ pub const local_events = .{
|
|||
.update = .{ .handler = update },
|
||||
};
|
||||
|
||||
fn update(engine: *Engine.Mod, sprite: *Mod, sprite_pipeline: *gfx.SpritePipeline.Mod) !void {
|
||||
fn update(core: *mach.Core.Mod, sprite: *Mod, sprite_pipeline: *gfx.SpritePipeline.Mod) !void {
|
||||
var archetypes_iter = sprite_pipeline.entities.query(.{ .all = &.{
|
||||
.{ .mach_gfx_sprite_pipeline = &.{
|
||||
.built,
|
||||
|
|
@ -54,19 +53,19 @@ fn update(engine: *Engine.Mod, sprite: *Mod, sprite_pipeline: *gfx.SpritePipelin
|
|||
const ids = archetype.slice(.entity, .id);
|
||||
const built_pipelines = archetype.slice(.mach_gfx_sprite_pipeline, .built);
|
||||
for (ids, built_pipelines) |pipeline_id, *built| {
|
||||
try updatePipeline(engine, sprite, sprite_pipeline, pipeline_id, built);
|
||||
try updatePipeline(core, sprite, sprite_pipeline, pipeline_id, built);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn updatePipeline(
|
||||
engine: *Engine.Mod,
|
||||
core: *mach.Core.Mod,
|
||||
sprite: *Mod,
|
||||
sprite_pipeline: *gfx.SpritePipeline.Mod,
|
||||
pipeline_id: mach.EntityID,
|
||||
built: *gfx.SpritePipeline.BuiltPipeline,
|
||||
) !void {
|
||||
const device = engine.state().device;
|
||||
const device = core.state().device;
|
||||
const encoder = device.createCommandEncoder(null);
|
||||
defer encoder.release();
|
||||
|
||||
|
|
@ -110,6 +109,6 @@ fn updatePipeline(
|
|||
encoder.writeBuffer(built.sizes, 0, gfx.SpritePipeline.cp_sizes[0..i]);
|
||||
var command = encoder.finish(null);
|
||||
defer command.release();
|
||||
engine.state().queue.submit(&[_]*gpu.CommandBuffer{command});
|
||||
core.state().queue.submit(&[_]*gpu.CommandBuffer{command});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue