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

cube example with gl backend panics #259

Closed
m4b opened this issue Jul 24, 2019 · 4 comments
Closed

cube example with gl backend panics #259

m4b opened this issue Jul 24, 2019 · 4 comments

Comments

@m4b
Copy link
Contributor

m4b commented Jul 24, 2019

attempting to run cube example for gl backend panics:

cargo run --example cube --features gl
thread 'main' panicked at 'not yet implemented', /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/gfx-backend-gl-0.2.0/src/window/glutin.rs:184:18
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Which is:

    pub(crate) fn create_swapchain_impl(
        &self,
        surface: &mut Surface,
        config: hal::SwapchainConfig,
    ) -> (Swapchain, Vec<native::Image>) {
        let swapchain = Swapchain {
            extent: config.extent,
            window: surface.window.clone(),
        };

        let gl = &self.share.context;

        let (int_format, iformat, itype) = match config.format {
            f::Format::Rgba8Unorm => (gl::RGBA8, gl::RGBA, gl::UNSIGNED_BYTE),
            f::Format::Rgba8Srgb => (gl::SRGB8_ALPHA8, gl::RGBA, gl::UNSIGNED_BYTE),
            _ => unimplemented!(),
        };

This may be fixed in more up to date gfx gl backend, not sure. I think it can also be fixed by changing the swapchain format to Rgba8Unorm

@m4b
Copy link
Contributor Author

m4b commented Jul 24, 2019

Fixing the swapchain format as I suggest above lets us progress past that point, but still panics with:

m4b@efrit ::  [ ~/git/wgpu-rs ] RUST_BACKTRACE=1 cargo run --example cube --features gl
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `target/debug/examples/cube`
thread 'main' panicked at 'No buffer has been bound yet, can't map memory!', /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/gfx-backend-gl-0.2.0/src/device.rs:1148:18
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
   5: std::panicking::begin_panic
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/panicking.rs:408
   6: <gfx_backend_gl::device::Device as gfx_hal::device::Device<gfx_backend_gl::Backend>>::map_memory
             at /home/m4b/.cargo/git/checkouts/wgpu-53e70f8674b08dd4/32399cf/wgpu-native/<::std::macros::panic macros>:3
   7: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_chunk_from_device
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:260
   8: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_chunk
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:300
   9: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_from_entry
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:384
  10: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_block
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:426
  11: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_chunk
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:317
  12: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_from_entry
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:384
  13: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_block
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:426
  14: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_chunk
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:317
  15: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_from_entry
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:384
  16: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_block
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:426
  17: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_chunk
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:317
  18: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_from_entry
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:384
  19: rendy_memory::allocator::dynamic::DynamicAllocator<B>::alloc_block
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:426
  20: <rendy_memory::allocator::dynamic::DynamicAllocator<B> as rendy_memory::allocator::Allocator<B>>::alloc
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/allocator/dynamic.rs:519
  21: rendy_memory::heaps::memory_type::MemoryType<B>::alloc_impl
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/heaps/memory_type.rs:82
  22: rendy_memory::heaps::memory_type::MemoryType<B>::alloc
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/heaps/memory_type.rs:63
  23: rendy_memory::heaps::Heaps<B>::allocate_from
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/heaps/mod.rs:173
  24: rendy_memory::heaps::Heaps<B>::allocate
             at /home/m4b/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rendy-memory-0.3.0/src/heaps/mod.rs:141
  25: wgpu_native::device::device_create_buffer
             at /home/m4b/.cargo/git/checkouts/wgpu-53e70f8674b08dd4/32399cf/wgpu-native/src/device.rs:614
  26: wgpu_device_create_buffer_mapped
             at /home/m4b/.cargo/git/checkouts/wgpu-53e70f8674b08dd4/32399cf/wgpu-native/src/device.rs:684
  27: wgpu::Device::create_buffer_mapped
             at ./src/lib.rs:759
  28: <cube::Example as cube::framework::Example>::init
             at examples/cube/main.rs:118
  29: cube::framework::run
             at examples/cube/../framework.rs:121
  30: cube::main
             at examples/cube/main.rs:351
  31: std::rt::lang_start::{{closure}}
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/rt.rs:64
  32: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:293
  33: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  34: std::rt::lang_start_internal
             at src/libstd/panicking.rs:272
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  35: std::rt::lang_start
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/rt.rs:64
  36: main
  37: __libc_start_main
  38: _start

@m4b
Copy link
Contributor Author

m4b commented Jul 24, 2019

Oops, I filed this in wgpu-native, not wgpu-rs, not sure if this is the right place (though the error does look to be a wgpu-native issue w.r.t. rendy usage?) anyway i'm tired, feel free to refile over in wgpu-rs and close here if necessary :)

@kvark
Copy link
Member

kvark commented Jul 24, 2019

@m4b thanks for filing!

Oops, I filed this in wgpu-native, not wgpu-rs, not sure if this is the right place

It's the problem here in wgpu-native. You filed to the right repo. FWIW, github provides an ability to move issues around, so it's not a big problem to move when needed.

No buffer has been bound yet, can't map memory!

I think this was fixed in gfx-rs/gfx#2822

The patched GL backend hasn't been released (and the fixes weren't back-ported) yet.

@grovesNL
Copy link
Collaborator

grovesNL commented Nov 6, 2020

With #3466 this should be working again

@grovesNL grovesNL closed this as completed Nov 6, 2020
kvark pushed a commit to kvark/wgpu that referenced this issue Jun 3, 2021
259: Remove zerocopy and replace with bytemuck. r=kvark a=StarArawn

fixes gfx-rs#146 

I've removed `zerocopy` from the examples and replaced it with `bytemuck`. I ran all of the examples/tests and everything ran great in vulkan on my windows box.

Co-authored-by: StarToaster <startoaster23@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants