Fix the triangle examples

This commit is contained in:
Dzmitry Malyshau 2019-03-30 10:14:35 -04:00
parent a8a6b45c9a
commit a3ffa7072a
2 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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);
}