Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation error on wgpu triangle pipeline #81

Merged
merged 3 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.