mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
rust: Update signatures
This commit is contained in:
parent
4126241fff
commit
7575652545
@ -1,10 +1,10 @@
|
||||
extern crate wgpu;
|
||||
fn main() {
|
||||
let instance = wgpu::Instance::new();
|
||||
let adapter = instance.get_adapter(wgpu::AdapterDescriptor {
|
||||
let adapter = instance.get_adapter(&wgpu::AdapterDescriptor {
|
||||
power_preference: wgpu::PowerPreference::LowPower,
|
||||
});
|
||||
let device = adapter.create_device(wgpu::DeviceDescriptor {
|
||||
let device = adapter.create_device(&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
@ -15,20 +15,20 @@ fn main() {
|
||||
let fs_bytes = include_bytes!("./../data/hello_triangle.frag.spv");
|
||||
let fs_module = device.create_shader_module(fs_bytes);
|
||||
|
||||
let bind_group_layout = device.create_bind_group_layout(wgpu::BindGroupLayoutDescriptor {
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[],
|
||||
});
|
||||
let pipeline_layout = device.create_pipeline_layout(wgpu::PipelineLayoutDescriptor {
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
});
|
||||
|
||||
let blend_state0 = device.create_blend_state(wgpu::BlendStateDescriptor::REPLACE);
|
||||
let depth_stencil_state = device.create_depth_stencil_state(wgpu::DepthStencilStateDescriptor::IGNORE);
|
||||
let attachment_state = device.create_attachment_state(wgpu::AttachmentStateDescriptor {
|
||||
let blend_state0 = device.create_blend_state(&wgpu::BlendStateDescriptor::REPLACE);
|
||||
let depth_stencil_state = device.create_depth_stencil_state(&wgpu::DepthStencilStateDescriptor::IGNORE);
|
||||
let attachment_state = device.create_attachment_state(&wgpu::AttachmentStateDescriptor {
|
||||
formats: &[wgpu::TextureFormat::R8g8b8a8Unorm],
|
||||
});
|
||||
|
||||
let _render_pipeline = device.create_render_pipeline(wgpu::RenderPipelineDescriptor {
|
||||
let _render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
layout: &pipeline_layout,
|
||||
stages: &[
|
||||
wgpu::PipelineStageDescriptor {
|
||||
@ -50,11 +50,11 @@ fn main() {
|
||||
attachment_state: &attachment_state,
|
||||
});
|
||||
|
||||
let mut cmd_buf = device.create_command_buffer(wgpu::CommandBufferDescriptor {});
|
||||
let mut cmd_buf = device.create_command_buffer(&wgpu::CommandBufferDescriptor {});
|
||||
|
||||
{
|
||||
let color_view = unimplemented!(); //TODO!
|
||||
let rpass = cmd_buf.begin_render_pass(wgpu::RenderPassDescriptor {
|
||||
let rpass = cmd_buf.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
color_attachments: &[
|
||||
wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &color_view,
|
||||
|
@ -144,7 +144,7 @@ impl Device {
|
||||
},
|
||||
};
|
||||
ShaderModule {
|
||||
id: wgn::wgpu_device_create_shader_module(self.id, desc),
|
||||
id: wgn::wgpu_device_create_shader_module(self.id, &desc),
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ impl Device {
|
||||
|
||||
pub fn create_bind_group_layout(&self, desc: &BindGroupLayoutDescriptor) -> BindGroupLayout {
|
||||
BindGroupLayout {
|
||||
id: wgn::wgpu_device_create_bind_group_layout(self.id, wgn::BindGroupLayoutDescriptor {
|
||||
id: wgn::wgpu_device_create_bind_group_layout(self.id, &wgn::BindGroupLayoutDescriptor {
|
||||
bindings: desc.bindings.as_ptr(),
|
||||
bindings_length: desc.bindings.len(),
|
||||
}),
|
||||
@ -171,7 +171,7 @@ impl Device {
|
||||
|
||||
pub fn create_pipeline_layout(&self, desc: &PipelineLayoutDescriptor) -> PipelineLayout {
|
||||
PipelineLayout {
|
||||
id: wgn::wgpu_device_create_pipeline_layout(self.id, wgn::PipelineLayoutDescriptor {
|
||||
id: wgn::wgpu_device_create_pipeline_layout(self.id, &wgn::PipelineLayoutDescriptor {
|
||||
bind_group_layouts: desc.bind_group_layouts.as_ptr() as *const _,
|
||||
bind_group_layouts_length: desc.bind_group_layouts.len(),
|
||||
}),
|
||||
@ -192,7 +192,7 @@ impl Device {
|
||||
|
||||
pub fn create_attachment_state(&self, desc: &AttachmentStateDescriptor) -> AttachmentState {
|
||||
AttachmentState {
|
||||
id: wgn::wgpu_device_create_attachment_state(self.id, wgn::AttachmentStateDescriptor {
|
||||
id: wgn::wgpu_device_create_attachment_state(self.id, &wgn::AttachmentStateDescriptor {
|
||||
formats: desc.formats.as_ptr(),
|
||||
formats_length: desc.formats.len(),
|
||||
}),
|
||||
@ -215,7 +215,7 @@ impl Device {
|
||||
.collect::<ArrayVec<[_; 2]>>();
|
||||
|
||||
RenderPipeline {
|
||||
id: wgn::wgpu_device_create_render_pipeline(self.id, wgn::RenderPipelineDescriptor {
|
||||
id: wgn::wgpu_device_create_render_pipeline(self.id, &wgn::RenderPipelineDescriptor {
|
||||
layout: desc.layout.id,
|
||||
stages: stages.as_ptr(),
|
||||
stages_length: stages.len(),
|
||||
@ -242,6 +242,7 @@ impl CommandBuffer {
|
||||
.collect::<ArrayVec<[_; 4]>>();
|
||||
|
||||
let depth_stencil = desc.depth_stencil_attachment
|
||||
.as_ref()
|
||||
.map(|dsa| RenderPassDepthStencilAttachmentDescriptor {
|
||||
attachment: dsa.attachment.id,
|
||||
depth_load_op: dsa.depth_load_op,
|
||||
|
Loading…
Reference in New Issue
Block a user