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
commit bccfa205d3
Notes: sideshowbarker 2024-07-17 22:57:18 +09:00
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);
}
}