Closed francesco-cattoglio closed 2 years ago
updating to 0.8 I get
for hello world:
[0.091036 ERROR]()(no module): Unexpected varying type: Array { base: [1], size: Constant([5]), stride: 4 }
thread 'main' panicked at 'Error in Buffer::get_mapped_range: buffer range size invalid: range_size 1266 must be multiple of 4', /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/backend/direct.rs:113:9
stack backtrace:
0: rust_begin_unwind
at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:493:5
1: std::panicking::begin_panic_fmt
at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:435:5
2: wgpu::backend::direct::Context::handle_error_fatal
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/backend/direct.rs:113:9
3: <wgpu::backend::direct::Context as wgpu::Context>::buffer_get_mapped_range
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/backend/direct.rs:1361:25
4: wgpu::BufferSlice::get_mapped_range_mut
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/lib.rs:1934:20
5: <wgpu::Device as wgpu::util::device::DeviceExt>::create_buffer_init
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/util/device.rs:56:9
6: imgui_wgpu::Renderer::upload_index_buffer
at ./src/lib.rs:602:9
7: imgui_wgpu::Renderer::render
at ./src/lib.rs:507:23
8: hello_world::main::{{closure}}
at ./examples/hello_world.rs:215:17
for the cube example:
[0.103963 ERROR]()(no module): Unexpected varying type: Array { base: [1], size: Constant([5]), stride: 4 }
[0.169492 ERROR]()(no module): Unexpected varying type: Array { base: [1], size: Constant([5]), stride: 4 }
thread 'main' panicked at 'Error in Buffer::get_mapped_range: buffer range size invalid: range_size 258 must be multiple of 4', /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/backend/direct.rs:113:9
stack backtrace:
0: rust_begin_unwind
at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:493:5
1: std::panicking::begin_panic_fmt
at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:435:5
2: wgpu::backend::direct::Context::handle_error_fatal
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/backend/direct.rs:113:9
3: <wgpu::backend::direct::Context as wgpu::Context>::buffer_get_mapped_range
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/backend/direct.rs:1361:25
4: wgpu::BufferSlice::get_mapped_range_mut
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/lib.rs:1934:20
5: <wgpu::Device as wgpu::util::device::DeviceExt>::create_buffer_init
at /Users/benediktmandelkow/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.0/src/util/device.rs:56:9
6: imgui_wgpu::Renderer::upload_index_buffer
at ./src/lib.rs:602:9
7: imgui_wgpu::Renderer::render
at ./src/lib.rs:507:23
8: cube::main::{{closure}}
at ./examples/cube.rs:612:17
seems like added validation on the wgpu side
further investigation:
diff --git a/src/lib.rs b/src/lib.rs
index 04a0d02..370487a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -397,8 +397,8 @@ impl Renderer {
primitive: PrimitiveState {
clamp_depth: false,
conservative: false,
- topology: PrimitiveTopology::TriangleList,
- strip_index_format: None,
+ topology: PrimitiveTopology::TriangleStrip,
+ strip_index_format: Some(IndexFormat::Uint16),
front_face: FrontFace::Cw,
cull_mode: None,
polygon_mode: PolygonMode::Fill,
seems to be necessary although not sufficient because IndexFormat defaults to u32 but but the indices are u16
Closing as we're on 0.12
This pull request includes all the small changes necessary to successfully compile and run using the current wgpu-rs master branch. I created this new pull request since I messed up a few things in the previous one.