gfx2d: update to latest mach-core API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
fe1984c867
commit
31838fe4ed
1 changed files with 5 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const core_mod = @import("core");
|
const core = @import("core");
|
||||||
const gpu = core_mod.gpu;
|
const gpu = core.gpu;
|
||||||
const ecs = @import("ecs");
|
const ecs = @import("ecs");
|
||||||
|
|
||||||
const math = @import("../math.zig");
|
const math = @import("../math.zig");
|
||||||
|
|
@ -58,7 +58,6 @@ const Uniforms = extern struct {
|
||||||
pub fn machSprite2DInit(adapter: anytype) !void {
|
pub fn machSprite2DInit(adapter: anytype) !void {
|
||||||
var mach = adapter.mod(.mach);
|
var mach = adapter.mod(.mach);
|
||||||
var sprite2d = adapter.mod(.mach_sprite2d);
|
var sprite2d = adapter.mod(.mach_sprite2d);
|
||||||
const core = mach.state().core;
|
|
||||||
const device = mach.state().device;
|
const device = mach.state().device;
|
||||||
|
|
||||||
const uniform_buffer = device.createBuffer(&.{
|
const uniform_buffer = device.createBuffer(&.{
|
||||||
|
|
@ -120,7 +119,7 @@ pub fn machSprite2DInit(adapter: anytype) !void {
|
||||||
const shader_module = device.createShaderModuleWGSL("shader.wgsl", @embedFile("shader.wgsl"));
|
const shader_module = device.createShaderModuleWGSL("shader.wgsl", @embedFile("shader.wgsl"));
|
||||||
const blend = gpu.BlendState{};
|
const blend = gpu.BlendState{};
|
||||||
const color_target = gpu.ColorTargetState{
|
const color_target = gpu.ColorTargetState{
|
||||||
.format = core.descriptor().format,
|
.format = core.descriptor.format,
|
||||||
.blend = &blend,
|
.blend = &blend,
|
||||||
.write_mask = gpu.ColorWriteMaskFlags.all,
|
.write_mask = gpu.ColorWriteMaskFlags.all,
|
||||||
};
|
};
|
||||||
|
|
@ -176,11 +175,10 @@ pub fn deinit(adapter: anytype) !void {
|
||||||
pub fn tick(adapter: anytype) !void {
|
pub fn tick(adapter: anytype) !void {
|
||||||
var mach = adapter.mod(.mach);
|
var mach = adapter.mod(.mach);
|
||||||
var sprite2d = adapter.mod(.mach_sprite2d);
|
var sprite2d = adapter.mod(.mach_sprite2d);
|
||||||
const core = mach.state().core;
|
|
||||||
const device = mach.state().device;
|
const device = mach.state().device;
|
||||||
|
|
||||||
// Begin our render pass
|
// Begin our render pass
|
||||||
const back_buffer_view = core.swapChain().getCurrentTextureView().?;
|
const back_buffer_view = core.swap_chain.getCurrentTextureView().?;
|
||||||
const color_attachment = gpu.RenderPassColorAttachment{
|
const color_attachment = gpu.RenderPassColorAttachment{
|
||||||
.view = back_buffer_view,
|
.view = back_buffer_view,
|
||||||
.clear_value = gpu.Color{ .r = 1.0, .g = 1.0, .b = 1.0, .a = 1.0 },
|
.clear_value = gpu.Color{ .r = 1.0, .g = 1.0, .b = 1.0, .a = 1.0 },
|
||||||
|
|
@ -255,6 +253,6 @@ pub fn tick(adapter: anytype) !void {
|
||||||
|
|
||||||
sprite2d.state().queue.submit(&[_]*gpu.CommandBuffer{command});
|
sprite2d.state().queue.submit(&[_]*gpu.CommandBuffer{command});
|
||||||
command.release();
|
command.release();
|
||||||
core.swapChain().present();
|
core.swap_chain.present();
|
||||||
back_buffer_view.release();
|
back_buffer_view.release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue