Skip to content

Commit

Permalink
Merge pull request #43 from cwfitzgerald/update-to-0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Feb 1, 2021
2 parents 56abc72 + 09bf333 commit a9da796
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 117 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/
and this project adheres to cargo's version of [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- [Unreleased](#unreleased)
- [v0.13.0](#v0130)
- [v0.12.0](#v0120)
- [Diffs](#diffs)

## Unreleased

## v0.13.0

Released 2021-02-01

#### Added
- Add experimental simple api behind feature `simple_api_unstable`
- Implemented `std::error::Error` for `RendererError`

#### Updated
- updated to `wgpu` 0.7
- support `winit` 0.24 as well as 0.23

## v0.12.0
Expand All @@ -31,5 +42,6 @@ Released 2020-11-21

## Diffs

- [Unreleased](https://github.com/Yatekii/imgui-wgpu-rs/compare/v0.12.0...HEAD)
- [Unreleased](https://github.com/Yatekii/imgui-wgpu-rs/compare/v0.13.0...HEAD)
- [v0.13.0](https://github.com/Yatekii/imgui-wgpu-rs/compare/v0.12.0...v0.13.0)
- [v0.12.0](https://github.com/Yatekii/imgui-wgpu-rs/compare/v0.11.0...v0.12.0)
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "imgui-wgpu"
version = "0.12.0"
authors = ["Noah Hüsser <[email protected]>", "Steven Wittens <[email protected]>"]
version = "0.13.0"
authors = ["Noah Hüsser <[email protected]>", "Connor Fitzgerald <[email protected]>", "Steven Wittens <[email protected]>"]
edition = "2018"
description = "A wgpu render backend for imgui-rs."
documentation = "https://docs.rs/imgui-wgpu/"
Expand All @@ -26,26 +26,26 @@ simple_api_unstable = [ "winit", "pollster", "imgui-winit-support" ]
default = []

[dependencies]
wgpu = "0.6"
log = "0.4"
imgui = "0.6"
bytemuck = "1"
imgui = "0.6"
log = "0.4"
smallvec = "1"
wgpu = "0.7"

# deps for simple_api_unstable
winit = { version = ">= 0.23, < 0.25", optional = true }
pollster = { version = "0.2.0", optional = true } # for block_on executor
imgui-winit-support = { version = "0.6", optional = true }
pollster = { version = "0.2.0", optional = true } # for block_on executor
winit = { version = ">= 0.23, < 0.25", optional = true }

[dev-dependencies]
wgpu-subscriber = "0.1"
winit = "0.24"
bytemuck = { version = "1.4", features = ["derive"] }
cgmath = "0.17"
futures = "0.3"
image = "0.23"
imgui-winit-support = "0.6"
raw-window-handle = "0.3"
image = "0.23"
futures = "0.3"
cgmath = "0.17"
bytemuck = { version = "1.4", features = ["derive"] }
wgpu-subscriber = "0.1"
winit = "0.24"

[package.metadata.docs.rs]
all-features = true
Expand Down
87 changes: 43 additions & 44 deletions examples/cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,30 @@ impl Example {
wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStage::VERTEX,
ty: wgpu::BindingType::UniformBuffer {
dynamic: false,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,
min_binding_size: wgpu::BufferSize::new(64),
},
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::SampledTexture {
ty: wgpu::BindingType::Texture {
multisampled: false,
component_type: wgpu::TextureComponentType::Float,
dimension: wgpu::TextureViewDimension::D2,
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
},
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 2,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler { comparison: false },
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
},
count: None,
},
],
Expand Down Expand Up @@ -241,8 +245,7 @@ impl Example {
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: //uniform_buf.as_entire_binding(),
wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
resource: uniform_buf.as_entire_binding(),
},
wgpu::BindGroupEntry {
binding: 1,
Expand All @@ -258,56 +261,50 @@ impl Example {

// Create the render pipeline
let vs_module =
device.create_shader_module(wgpu::include_spirv!("../resources/cube.vert.spv"));
device.create_shader_module(&wgpu::include_spirv!("../resources/cube.vert.spv"));
let fs_module =
device.create_shader_module(wgpu::include_spirv!("../resources/cube.frag.spv"));
device.create_shader_module(&wgpu::include_spirv!("../resources/cube.frag.spv"));

let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: None,
layout: Some(&pipeline_layout),
vertex_stage: wgpu::ProgrammableStageDescriptor {
vertex: wgpu::VertexState {
module: &vs_module,
entry_point: "main",
},
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
module: &fs_module,
entry_point: "main",
}),
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::Back,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: &[wgpu::ColorStateDescriptor {
format: sc_desc.format,
color_blend: wgpu::BlendDescriptor::REPLACE,
alpha_blend: wgpu::BlendDescriptor::REPLACE,
write_mask: wgpu::ColorWrite::ALL,
}],
depth_stencil_state: None,
vertex_state: wgpu::VertexStateDescriptor {
index_format: wgpu::IndexFormat::Uint16,
vertex_buffers: &[wgpu::VertexBufferDescriptor {
stride: vertex_size as wgpu::BufferAddress,
buffers: &[wgpu::VertexBufferLayout {
array_stride: vertex_size as wgpu::BufferAddress,
step_mode: wgpu::InputStepMode::Vertex,
attributes: &[
wgpu::VertexAttributeDescriptor {
wgpu::VertexAttribute {
format: wgpu::VertexFormat::Float4,
offset: 0,
shader_location: 0,
},
wgpu::VertexAttributeDescriptor {
wgpu::VertexAttribute {
format: wgpu::VertexFormat::Float2,
offset: 4 * 4,
shader_location: 1,
},
],
}],
},
sample_count: 1,
sample_mask: !0,
alpha_to_coverage_enabled: false,
primitive: wgpu::PrimitiveState {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::Back,
..Default::default()
},
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState {
module: &fs_module,
entry_point: "main",
targets: &[wgpu::ColorTargetState {
format: sc_desc.format,
color_blend: wgpu::BlendState::REPLACE,
alpha_blend: wgpu::BlendState::REPLACE,
write_mask: wgpu::ColorWrite::ALL,
}],
}),
});

// Done
Expand Down Expand Up @@ -337,6 +334,7 @@ impl Example {
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
{
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: None,
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
attachment: &view,
resolve_target: None,
Expand All @@ -355,7 +353,7 @@ impl Example {
rpass.push_debug_group("Prepare data for draw.");
rpass.set_pipeline(&self.pipeline);
rpass.set_bind_group(0, &self.bind_group, &[]);
rpass.set_index_buffer(self.index_buf.slice(..));
rpass.set_index_buffer(self.index_buf.slice(..), wgpu::IndexFormat::Uint16);
rpass.set_vertex_buffer(0, self.vertex_buf.slice(..));
rpass.pop_debug_group();
rpass.insert_debug_marker("Draw!");
Expand Down Expand Up @@ -400,17 +398,17 @@ fn main() {

let (device, queue) = block_on(adapter.request_device(
&wgpu::DeviceDescriptor {
label: None,
features: wgpu::Features::empty(),
limits: wgpu::Limits::default(),
shader_validation: false,
},
None,
))
.unwrap();

// Set up swap chain
let sc_desc = wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
width: size.width as u32,
height: size.height as u32,
Expand Down Expand Up @@ -474,7 +472,7 @@ fn main() {
height: example_size[1] as u32,
..Default::default()
},
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT | wgpu::TextureUsage::SAMPLED,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT | wgpu::TextureUsage::SAMPLED,
..Default::default()
};

Expand All @@ -496,7 +494,7 @@ fn main() {
let size = window.inner_size();

let sc_desc = wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
width: size.width as u32,
height: size.height as u32,
Expand Down Expand Up @@ -568,7 +566,7 @@ fn main() {
height: (example_size[1] * scale[1]) as u32,
..Default::default()
},
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT
usage: wgpu::TextureUsage::RENDER_ATTACHMENT
| wgpu::TextureUsage::SAMPLED,
..Default::default()
};
Expand Down Expand Up @@ -596,6 +594,7 @@ fn main() {
}

let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: None,
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.output.view,
resolve_target: None,
Expand Down
7 changes: 4 additions & 3 deletions examples/custom_textures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ fn main() {

let (device, queue) = block_on(adapter.request_device(
&wgpu::DeviceDescriptor {
label: None,
features: wgpu::Features::empty(),
limits: wgpu::Limits::default(),
shader_validation: false,
},
None,
))
.unwrap();

// Set up swap chain
let sc_desc = wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
width: size.width as u32,
height: size.height as u32,
Expand Down Expand Up @@ -144,7 +144,7 @@ fn main() {
let size = window.inner_size();

let sc_desc = wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
width: size.width as u32,
height: size.height as u32,
Expand Down Expand Up @@ -213,6 +213,7 @@ fn main() {
}

let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: None,
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.output.view,
resolve_target: None,
Expand Down
5 changes: 3 additions & 2 deletions examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn main() {

// Set up swap chain
let sc_desc = wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
width: size.width as u32,
height: size.height as u32,
Expand Down Expand Up @@ -117,7 +117,7 @@ fn main() {
let size = window.inner_size();

let sc_desc = wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
width: size.width as u32,
height: size.height as u32,
Expand Down Expand Up @@ -200,6 +200,7 @@ fn main() {
}

let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: None,
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.output.view,
resolve_target: None,
Expand Down
Loading

0 comments on commit a9da796

Please sign in to comment.