Skip to content

Commit

Permalink
Use PixelUnpackData in tex_image_1d
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Nov 1, 2024
1 parent 6a360ef commit dd9150b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ pub trait HasContext: __private::Sealed {
border: i32,
format: u32,
ty: u32,
pixels: Option<&[u8]>,
pixels: PixelUnpackData,
);

unsafe fn compressed_tex_image_1d(
Expand Down
7 changes: 5 additions & 2 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,7 @@ impl HasContext for Context {
border: i32,
format: u32,
ty: u32,
pixels: Option<&[u8]>,
pixels: PixelUnpackData,
) {
let gl = &self.raw;
gl.TexImage1D(
Expand All @@ -2446,7 +2446,10 @@ impl HasContext for Context {
border,
format,
ty,
pixels.map(|p| p.as_ptr()).unwrap_or(std::ptr::null()) as *const std::ffi::c_void,
match pixels {
PixelUnpackData::BufferOffset(offset) => offset as *const std::ffi::c_void,
PixelUnpackData::Slice(data) => data.as_ptr() as *const std::ffi::c_void,
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3940,7 +3940,7 @@ impl HasContext for Context {
_border: i32,
_format: u32,
_ty: u32,
_pixels: Option<&[u8]>,
_pixels: PixelUnpackData,
) {
panic!("Tex image 1D is not supported");
}
Expand Down

0 comments on commit dd9150b

Please sign in to comment.