From a3ffa7072ad312b82dd90605e3fa28d1e131d059 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Sat, 30 Mar 2019 10:14:35 -0400 Subject: [PATCH] Fix the triangle examples --- examples/hello_triangle_c/main.c | 9 +++++++++ examples/hello_triangle_rust/main.rs | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/examples/hello_triangle_c/main.c b/examples/hello_triangle_c/main.c index 6fe9b9092..cc7e84883 100644 --- a/examples/hello_triangle_c/main.c +++ b/examples/hello_triangle_c/main.c @@ -73,6 +73,14 @@ int main() { .bindings = NULL, .bindings_length = 0, }); + WGPUBindGroupId bind_group = + wgpu_device_create_bind_group(device, + &(WGPUBindGroupDescriptor){ + .layout = bind_group_layout, + .bindings = NULL, + .bindings_length = 0, + }); + WGPUBindGroupLayoutId bind_group_layouts[BIND_GROUP_LAYOUTS_LENGTH] = { bind_group_layout}; @@ -211,6 +219,7 @@ int main() { }); wgpu_render_pass_set_pipeline(rpass, render_pipeline); + wgpu_render_pass_set_bind_group(rpass, 0, bind_group); wgpu_render_pass_draw(rpass, 3, 1, 0, 0); WGPUQueueId queue = wgpu_device_get_queue(device); WGPUCommandBufferId cmd_buf = wgpu_render_pass_end_pass(rpass); diff --git a/examples/hello_triangle_rust/main.rs b/examples/hello_triangle_rust/main.rs index e06656e03..5e5dd070f 100644 --- a/examples/hello_triangle_rust/main.rs +++ b/examples/hello_triangle_rust/main.rs @@ -21,6 +21,10 @@ fn main() { let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { bindings: &[] }); + let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { + layout: &bind_group_layout, + bindings: &[], + }); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { bind_group_layouts: &[&bind_group_layout], }); @@ -113,6 +117,7 @@ fn main() { depth_stencil_attachment: None, }); rpass.set_pipeline(&render_pipeline); + rpass.set_bind_group(0, &bind_group); rpass.draw(0..3, 0..1); }