Skip to content

Commit

Permalink
Create gles buffers with DYNAMIC_DRAW instead of STATIC_DRAW
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnerbone committed Jan 17, 2023
1 parent 48fbb92 commit 26f6309
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions wgpu-hal/src/gles/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,6 @@ impl crate::Device<super::Api> for super::Device {

let gl = &self.shared.context.lock();

let target = if desc.usage.contains(crate::BufferUses::INDEX) {
glow::ELEMENT_ARRAY_BUFFER
} else {
glow::ARRAY_BUFFER
};

let is_host_visible = desc
.usage
.intersects(crate::BufferUses::MAP_READ | crate::BufferUses::MAP_WRITE);
Expand Down Expand Up @@ -499,7 +493,10 @@ impl crate::Device<super::Api> for super::Device {
glow::DYNAMIC_DRAW
}
} else {
glow::STATIC_DRAW
// Even if the usage doesn't contain SRC_READ, we update it internally at least once
// Some vendors take usage very literally and STATIC_DRAW will freeze us with an empty buffer
// https://github.com/gfx-rs/wgpu/issues/3371
glow::DYNAMIC_DRAW
};
unsafe { gl.buffer_data_size(target, raw_size, usage) };
}
Expand Down

0 comments on commit 26f6309

Please sign in to comment.