Add some padding to the egui-wgpu uniform buffer for WebGL (#1671)
Required on Chromium
This commit is contained in:
parent
2771c8c3e5
commit
abff2dcae2
1 changed files with 5 additions and 0 deletions
|
@ -104,6 +104,9 @@ impl ScreenDescriptor {
|
|||
#[repr(C)]
|
||||
struct UniformBuffer {
|
||||
screen_size_in_points: [f32; 2],
|
||||
// Uniform buffers need to be at least 16 bytes in WebGL.
|
||||
// See https://github.com/gfx-rs/wgpu/issues/2072
|
||||
_padding: [u32; 2],
|
||||
}
|
||||
|
||||
/// Wraps the buffers and includes additional information.
|
||||
|
@ -151,6 +154,7 @@ impl RenderPass {
|
|||
label: Some("egui_uniform_buffer"),
|
||||
contents: bytemuck::cast_slice(&[UniformBuffer {
|
||||
screen_size_in_points: [0.0, 0.0],
|
||||
_padding: Default::default(),
|
||||
}]),
|
||||
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
|
||||
});
|
||||
|
@ -661,6 +665,7 @@ impl RenderPass {
|
|||
0,
|
||||
bytemuck::cast_slice(&[UniformBuffer {
|
||||
screen_size_in_points,
|
||||
_padding: Default::default(),
|
||||
}]),
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue