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

Error creating render pipeline: Unsupported uniform datatype! 0x1405 #4126

Closed
melody-rs opened this issue Sep 7, 2023 · 3 comments
Closed
Labels
api: gles Issues with GLES or WebGL help required We need community help to make this happen. type: bug Something isn't working

Comments

@melody-rs
Copy link

Description
wgpu panics with Unsupported uniform datatype! 0x1405 when trying to create a render pipeline that takes a u32 as a push constant. This happens inside a struct or when using the u32 directly

Repro steps
Use a u32 as a shader push constant:

struct Constants {
    transform_index: u32
}
var<push_constant> constants: Constants;

This is what initially triggered the panic for me.

Expected vs observed behavior
There is no panic and the render pipeline is created properly

Extra materials
0x1405 corresponds with GL_UNSIGNED_INT, according to the documentation. The panic happens in a match statement to get the byte size of a uniform data type, perhaps GL_UNSIGNED_INT was forgotten about?

Backtrace:

The application panicked (crashed).
Message:  Unsupported uniform datatype! 0x1405
Location: /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.0/src/gles/conv.rs:499

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                              ⋮ 8 frames hidden ⋮                               
 9: wgpu_hal::gles::conv::uniform_byte_size::h761fbc418f796f7a
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.0/src/gles/conv.rs:499
     497glow::FLOAT_MAT3 => 36,
     498 │         glow::FLOAT_MAT4 => 64,
     499 >         _ => panic!("Unsupported uniform datatype! {glsl_uniform_type:#X}"),
     500}
     501}
10: wgpu_hal::gles::device::<impl wgpu_hal::gles::Device>::create_program::h6be34100f426d43f
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.0/src/gles/device.rs:431
     429430// `size` will always be 1 so we need to guess the real size from the type
     431 >                 let uniform_size = conv::uniform_byte_size(utype);
     432433 │                 uniforms[offset / 4] = super::UniformDesc {
11: wgpu_hal::gles::device::<impl wgpu_hal::gles::Device>::create_pipeline::{{closure}}::h2abdf397236d0454
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.0/src/gles/device.rs:296
     294})
     295.or_insert_with(|| unsafe {
     296 >                 Self::create_program(
     297 │                     gl,
     298 │                     shaders,
12: std::collections::hash::map::Entry<K,V>::or_insert_with::h6fce719d62791aaf
    at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/collections/hash/map.rs:2558
13: wgpu_hal::gles::device::<impl wgpu_hal::gles::Device>::create_pipeline::h0a5c942d426b59f4
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.0/src/gles/device.rs:290
     288// This guard ensures that we can't accidentally destroy a program whilst we're about to reuse it
     289// The only place that destroys a pipeline is also locking on `program_cache`
     290 >         let program = guard
     291.entry(super::ProgramCacheKey {
     292stages: program_stages,
14: wgpu_hal::gles::device::<impl wgpu_hal::Device<wgpu_hal::gles::Api> for wgpu_hal::gles::Device>::create_render_pipeline::hd9d358ccc871618b
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.0/src/gles/device.rs:1111
    1109}
    1110let inner =
    1111 >             unsafe { self.create_pipeline(gl, shaders, desc.layout, desc.label, desc.multiview) }?;
    11121113let (vertex_buffers, vertex_attributes) = {
15: wgpu_core::device::resource::Device<A>::create_render_pipeline::ha3a87ba53da08577
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-0.17.0/src/device/resource.rs:2948
    2946};
    2947let raw =
    2948 >             unsafe { self.raw.create_render_pipeline(&pipeline_desc) }.map_err(
    2949 │                 |err| match err {
    2950 │                     hal::PipelineError::Device(error) => {
16: wgpu_core::device::global::<impl wgpu_core::global::Global<G>>::device_create_render_pipeline::h3a6d98ca923a7b5c
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-0.17.0/src/device/global.rs:1739
    1737}
    17381739 >             let pipeline = match device.create_render_pipeline(
    1740 │                 device_id,
    1741 │                 adapter,
17: <wgpu::backend::direct::Context as wgpu::context::Context>::device_create_render_pipeline::h6dc1146e6aae2ce6
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.0/src/backend/direct.rs:1203
    12011202let global = &self.0;
    1203 >         let (id, error) = wgc::gfx_select!(device => global.device_create_render_pipeline(
    1204*device,
    1205&descriptor,
18: <T as wgpu::context::DynContext>::device_create_render_pipeline::h1df066dee063a2c1
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.0/src/context.rs:2292
    2290let device_data = downcast_ref(device_data);
    2291let (render_pipeline, data) =
    2292 >             Context::device_create_render_pipeline(self, &device, device_data, desc);
    2293(render_pipeline.into(), Box::new(data) as _)
    2294}
19: wgpu::Device::create_render_pipeline::h209ae0e6c7c7db83
    at /home/lily/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.0/src/lib.rs:2402
    2400/// Creates a [`RenderPipeline`].
    2401pub fn create_render_pipeline(&self, desc: &RenderPipelineDescriptor) -> RenderPipeline {
    2402 >         let (id, data) = DynContext::device_create_render_pipeline(
    2403&*self.context,
    2404&self.id,
20: wormhole::object::shader::<impl wormhole::render::traits::Shadeable for wormhole::object::Object>::create_render_pipeline::h6848c61e59ddd5cd
    at /home/lily/Git/wormhole/src/object/shader.rs:45
      43.create_shader_module(wgpu::include_wgsl!("object.wgsl"));
      4445 >         render_state
      46.wgpu
      47.device
21: wormhole::render::state::BindGroupsCreated::initialize_render_pipelines::h1411a83b158e25a7
    at /home/lily/Git/wormhole/src/render/state.rs:154
     152use render::traits::Shadeable;
     153154 >         let object = object::Object::create_render_pipeline(&self);
     155let light = light::Light::create_render_pipeline(&self);
     15622: wormhole::main::hf740da9961f7b4d9
    at /home/lily/Git/wormhole/src/main.rs:27
      25// Because the surface is created after the window, the drop order ensures that the surface is dropped after the window.
      26let mut render_state =
      27 >         unsafe { pollster::block_on(wormhole::render::state::GpuCreated::new(&window)) }
      28.initialize_bind_group_layouts()
      29.initialize_render_pipelines();
23: core::ops::function::FnOnce::call_once::h1d25de8edf9a2ada
    at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/ops/function.rs:25015 frames hidden ⋮

Platform
Host: Apple Inc. MacBookPro11,4
Processor: Intel® Core™ i7-4980HQ × 8
GPU: Intel® Iris® Pro Graphics P5200 (HSW GT3)
Linux Kernel: Linux 6.4.12-1-MANJARO

@melody-rs melody-rs changed the title Error compiling render pipeline: Unsupported uniform datatype! 0x1405 Error creating render pipeline: Unsupported uniform datatype! 0x1405 Sep 7, 2023
@Wumpf
Copy link
Member

Wumpf commented Sep 7, 2023

perhaps GL_UNSIGNED_INT was forgotten about?

huh, yeah totally looks like. I reckon you tried with i32 and it worked?

@Wumpf Wumpf added type: bug Something isn't working api: gles Issues with GLES or WebGL labels Sep 7, 2023
@melody-rs
Copy link
Author

Yup, it did!

@Wumpf Wumpf added the help required We need community help to make this happen. label Sep 8, 2023
@cwfitzgerald
Copy link
Member

This should be fixed with #4607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: gles Issues with GLES or WebGL help required We need community help to make this happen. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants