});
let render_options = RenderOptions::default();
let mut render_options_uniform_buffer = UniformBuffer::new(Vec::new());
render_options_uniform_buffer
.write(&render_options)
.unwrap();
let render_options_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("render options buffer"),
contents: &render_options_uniform_buffer.into_inner(),
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
});
let render_options_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
entries: &[wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,
min_binding_size: None,
},
count: None,
}],
label: Some("render options bind group layout"),
});
let render_options_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: Some("render options bind group"),
layout: &render_options_bind_group_layout,
entries: &[wgpu::BindGroupEntry {
binding: 0,
resource: render_options_buffer.as_entire_binding(),
}],