tasgon / bevy_iced

Iced integration for Bevy
Other
125 stars 14 forks source link

Wasm texture format issue #9

Closed nikolajevs86 closed 1 year ago

nikolajevs86 commented 1 year ago

Could not run application using bevy & iced. Received "Validation error" issue:

panicked at 'wgpu error: Validation Error

Caused by:
In a RenderPass
note: encoder = <CommandBuffer-(0, 173, Gl)>
In a set_pipeline command
note: render pipeline = <RenderPipeline-(1, 1, Gl)>
Render pipeline targets are incompatible with render pass
Incompatible color attachment: the renderpass expected [Some(Rgba8UnormSrgb)] but was given [Some(Bgra8UnormSrgb)]

', /Users/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.15.1/src/backend/direct.rs:3024:5

Resolved locally by adjusting plugin code at https://github.com/tasgon/bevy_iced/blob/master/src/lib.rs#L102 :

#[cfg(target_arch = "wasm32")]
let format = wgpu::TextureFormat::Rgba8UnormSrgb;
#[cfg(not(target_arch = "wasm32"))]
let format = wgpu::TextureFormat::Bgra8UnormSrgb;

I am sure that it could be done better but at least it works for me as a workaround