Skip to content

Commit

Permalink
Merge pull request #81 from hecrj/fix/triangles-validation-error
Browse files Browse the repository at this point in the history
Fix validation error on `wgpu` triangle pipeline
  • Loading branch information
hecrj authored Aug 14, 2019
2 parents 5acffc2 + de63693 commit 4af42ca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Incorrect buffer sizes in the `Mesh` pipeline. This caused vertices to entirely
disappear when rendering big meshes, leading to a potential crash.
- Validation error when rendering meshes using Vulkan, Metal, D3D11, or D3D12. [#81]

[#66]: https://github.com/hecrj/coffee/pull/66
[#77]: https://github.com/hecrj/coffee/pull/77
[#78]: https://github.com/hecrj/coffee/pull/78
[#81]: https://github.com/hecrj/coffee/pull/81


## [0.3.1] - 2019-06-20
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@ wgpu = { version = "0.2", optional = true, git = "https://github.com/gfx-rs/wgpu
wgpu_glyph = { version = "0.3", optional = true, git = "https://github.com/hecrj/wgpu_glyph", rev = "0577e4d2be6b035a14aa0c5d82b143aaf26c1bd3" }

[dev-dependencies]
# Example dependencies
rand = "0.6"
10 changes: 6 additions & 4 deletions src/graphics/backend_wgpu/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ impl Pipeline {
let vertices = device.create_buffer(&wgpu::BufferDescriptor {
size: mem::size_of::<Vertex>() as u64
* Self::INITIAL_BUFFER_SIZE as u64,
usage: wgpu::BufferUsage::VERTEX,
usage: wgpu::BufferUsage::VERTEX | wgpu::BufferUsage::TRANSFER_DST,
});

let indices = device.create_buffer(&wgpu::BufferDescriptor {
size: Self::INITIAL_BUFFER_SIZE as u64 * 2,
usage: wgpu::BufferUsage::INDEX,
usage: wgpu::BufferUsage::INDEX | wgpu::BufferUsage::TRANSFER_DST,
});

Pipeline {
Expand Down Expand Up @@ -164,12 +164,14 @@ impl Pipeline {

self.vertices = device.create_buffer(&wgpu::BufferDescriptor {
size: mem::size_of::<Vertex>() as u64 * new_size as u64,
usage: wgpu::BufferUsage::VERTEX,
usage: wgpu::BufferUsage::VERTEX
| wgpu::BufferUsage::TRANSFER_DST,
});

self.indices = device.create_buffer(&wgpu::BufferDescriptor {
size: new_size as u64 * 2,
usage: wgpu::BufferUsage::INDEX,
usage: wgpu::BufferUsage::INDEX
| wgpu::BufferUsage::TRANSFER_DST,
});

self.buffer_size = new_size;
Expand Down
Binary file removed tests/_graphics/models/mesh.png
Binary file not shown.

0 comments on commit 4af42ca

Please sign in to comment.