1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

LibGL: Verify Texture2D existence

The code currently guarantees that we always have a target texture.
This commit is contained in:
Jelle Raaijmakers 2022-09-04 16:50:07 +02:00 committed by Linus Groh
parent 72b4f95f71
commit 494024b70e
2 changed files with 6 additions and 15 deletions

View file

@ -13,9 +13,7 @@ namespace GL {
void Texture2D::download_texture_data(GLuint lod, GPU::ImageDataLayout output_layout, GLvoid* pixels)
{
if (device_image().is_null())
return;
VERIFY(!device_image().is_null());
device_image()->read_texels(0, lod, { 0, 0, 0 }, pixels, output_layout);
}
@ -42,8 +40,7 @@ void Texture2D::replace_sub_texture_data(GLuint lod, GPU::ImageDataLayout input_
// FIXME: We currently depend on the first glTexImage2D call to attach an image to mipmap level 0, which initializes the GPU image
// Ideally we would create separate GPU images for each level and merge them into a final image
// once used for rendering for the first time.
if (device_image().is_null())
return;
VERIFY(!device_image().is_null());
device_image()->write_texels(0, lod, output_offset, pixels, input_layout);
}