gpu: use Device.getQueue in example
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
2b67ad5457
commit
ad6cfbb0c9
1 changed files with 3 additions and 3 deletions
|
|
@ -9,7 +9,6 @@ pub fn main() !void {
|
||||||
var allocator = gpa.allocator();
|
var allocator = gpa.allocator();
|
||||||
|
|
||||||
const setup = try sample_utils.setup(allocator);
|
const setup = try sample_utils.setup(allocator);
|
||||||
const queue = c.wgpuDeviceGetQueue(@ptrCast(c.WGPUDevice, setup.device.ptr));
|
|
||||||
const framebuffer_size = try setup.window.getFramebufferSize();
|
const framebuffer_size = try setup.window.getFramebufferSize();
|
||||||
|
|
||||||
const window_data = try allocator.create(WindowData);
|
const window_data = try allocator.create(WindowData);
|
||||||
|
|
@ -157,6 +156,7 @@ pub fn main() !void {
|
||||||
}
|
}
|
||||||
}).callback);
|
}).callback);
|
||||||
|
|
||||||
|
const queue = setup.device.getQueue();
|
||||||
while (!setup.window.shouldClose()) {
|
while (!setup.window.shouldClose()) {
|
||||||
try frame(.{
|
try frame(.{
|
||||||
.window = setup.window,
|
.window = setup.window,
|
||||||
|
|
@ -180,7 +180,7 @@ const FrameParams = struct {
|
||||||
window: glfw.Window,
|
window: glfw.Window,
|
||||||
device: gpu.Device,
|
device: gpu.Device,
|
||||||
pipeline: c.WGPURenderPipeline,
|
pipeline: c.WGPURenderPipeline,
|
||||||
queue: c.WGPUQueue,
|
queue: gpu.Queue,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn isDescriptorEqual(a: c.WGPUSwapChainDescriptor, b: c.WGPUSwapChainDescriptor) bool {
|
fn isDescriptorEqual(a: c.WGPUSwapChainDescriptor, b: c.WGPUSwapChainDescriptor) bool {
|
||||||
|
|
@ -228,7 +228,7 @@ fn frame(params: FrameParams) !void {
|
||||||
const commands = c.wgpuCommandEncoderFinish(encoder, null);
|
const commands = c.wgpuCommandEncoderFinish(encoder, null);
|
||||||
c.wgpuCommandEncoderRelease(encoder);
|
c.wgpuCommandEncoderRelease(encoder);
|
||||||
|
|
||||||
c.wgpuQueueSubmit(params.queue, 1, &commands);
|
c.wgpuQueueSubmit(@ptrCast(c.WGPUQueue, params.queue.ptr), 1, &commands);
|
||||||
c.wgpuCommandBufferRelease(commands);
|
c.wgpuCommandBufferRelease(commands);
|
||||||
c.wgpuSwapChainPresent(pl.swap_chain.?);
|
c.wgpuSwapChainPresent(pl.swap_chain.?);
|
||||||
c.wgpuTextureViewRelease(back_buffer_view);
|
c.wgpuTextureViewRelease(back_buffer_view);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue