Skip to content

Commit

Permalink
gles backend: unbind PIXEL_UNPACK_BUFFER
Browse files Browse the repository at this point in the history
  • Loading branch information
mrk-its committed Nov 7, 2021
1 parent 7e00abf commit 685c7a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wgpu-hal/src/gles/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ impl super::Queue {
gl.bind_texture(dst_target, Some(dst));
gl.pixel_store_i32(glow::UNPACK_ROW_LENGTH, row_texels as i32);
gl.pixel_store_i32(glow::UNPACK_IMAGE_HEIGHT, column_texels as i32);
let mut unbind_unpack_buffer = false;
if format_info.block_dimensions == (1, 1) {
let buffer_data;
let unpack_data = match *src {
super::BufferInner::Buffer(buffer) => {
gl.bind_buffer(glow::PIXEL_UNPACK_BUFFER, Some(buffer));
unbind_unpack_buffer = true;
glow::PixelUnpackData::BufferOffset(copy.buffer_layout.offset as u32)
}
super::BufferInner::Data(ref data) => {
Expand Down Expand Up @@ -455,6 +457,7 @@ impl super::Queue {
let unpack_data = match *src {
super::BufferInner::Buffer(buffer) => {
gl.bind_buffer(glow::PIXEL_UNPACK_BUFFER, Some(buffer));
unbind_unpack_buffer = true;
glow::CompressedPixelUnpackData::BufferRange(
offset..offset + bytes_per_image,
)
Expand Down Expand Up @@ -523,6 +526,9 @@ impl super::Queue {
_ => unreachable!(),
}
}
if unbind_unpack_buffer {
gl.bind_buffer(glow::PIXEL_UNPACK_BUFFER, None);
}
}
C::CopyTextureToBuffer {
src,
Expand Down

0 comments on commit 685c7a6

Please sign in to comment.