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

LibGL: Improve mipmap lookup in Texture2D

We can get rid of a `VERIFY` since we already do this in `Array::at()`.
Also move `::mipmap()` to the header file so it is inlined in
`Sampler2D`.
This commit is contained in:
Jelle Raaijmakers 2021-11-29 12:56:55 +01:00 committed by Andreas Kling
parent 65cda8e4aa
commit bccfa205d3
2 changed files with 7 additions and 10 deletions

View file

@ -36,7 +36,6 @@ void Texture2D::replace_sub_texture_data(GLuint lod, GLint xoffset, GLint yoffse
// FIXME: We currently only support GL_UNSIGNED_BYTE pixel data
VERIFY(type == GL_UNSIGNED_BYTE);
VERIFY(lod < m_mipmaps.size());
VERIFY(xoffset >= 0 && yoffset >= 0 && xoffset + width <= mip.width() && yoffset + height <= mip.height());
VERIFY(pixels_per_row == 0 || pixels_per_row >= xoffset + width);
@ -111,12 +110,4 @@ void Texture2D::replace_sub_texture_data(GLuint lod, GLint xoffset, GLint yoffse
}
}
MipMap const& Texture2D::mipmap(unsigned lod) const
{
if (lod >= m_mipmaps.size())
return m_mipmaps.back();
return m_mipmaps.at(lod);
}
}