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 panic in the GLES backend when creating a pipeline with opaque ty… #3361

Merged

Conversation

James2022-rgb
Copy link
Contributor

@James2022-rgb James2022-rgb commented Jan 7, 2023

…pes other than samplers.

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
    Done, with --feature gles.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Fixes issue #3337

Description
wgpu_hal::gles::device::Device::create_pipeline was taking into account sampler types when collecting UniformDescs, but not other opaque types such as images and atomic counters,
which led to the panic! here:

pub(super) fn uniform_byte_size(glsl_uniform_type: u32) -> u32 {
match glsl_uniform_type {
glow::FLOAT | glow::INT => 4,
glow::FLOAT_VEC2 | glow::INT_VEC2 => 8,
glow::FLOAT_VEC3 | glow::INT_VEC3 => 12,
glow::FLOAT_VEC4 | glow::INT_VEC4 => 16,
glow::FLOAT_MAT2 => 16,
glow::FLOAT_MAT3 => 36,
glow::FLOAT_MAT4 => 64,
_ => panic!("Unsupported uniform datatype!"),
}
}

This PR adds checks for these other opaque types in addition to samplers.

Testing
Tested locally on my Galaxy S20 Ultra 5G, confirming the result of the textureStore in the glDispatchCompute with RenderDoc.

@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2023

Codecov Report

Merging #3361 (eddb415) into master (a06ef71) will increase coverage by 0.00%.
The diff coverage is 86.66%.

@@           Coverage Diff           @@
##           master    #3361   +/-   ##
=======================================
  Coverage   64.49%   64.50%           
=======================================
  Files          86       86           
  Lines       42696    42709   +13     
=======================================
+ Hits        27537    27548   +11     
- Misses      15159    15161    +2     
Impacted Files Coverage Δ
wgpu-hal/src/gles/conv.rs 75.89% <85.71%> (+0.60%) ⬆️
wgpu-hal/src/gles/device.rs 80.18% <100.00%> (ø)
wgpu-core/src/hub.rs 60.67% <0.00%> (-0.16%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@nical
Copy link
Contributor

nical commented Jan 10, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants