GL/Texture: Use texture storage where available

This commit is contained in:
Connor McLaughlin 2020-10-31 15:11:53 +10:00
parent 95dba59826
commit 4fe1c07b02
1 changed files with 8 additions and 2 deletions

View File

@ -36,10 +36,16 @@ bool Texture::Create(u32 width, u32 height, u32 samples, GLenum internal_format,
if (samples > 1)
{
if (GLAD_GL_ARB_texture_storage || GLAD_GL_ES_VERSION_3_1)
glTexStorage2DMultisample(target, samples, internal_format, width, height, GL_FALSE);
else
glTexImage2DMultisample(target, samples, internal_format, width, height, GL_FALSE);
}
else
{
if (GLAD_GL_ARB_texture_storage || GLAD_GL_ES_VERSION_3_0)
glTexStorage2D(target, 1, internal_format, width, height);
else
glTexImage2D(target, 0, internal_format, width, height, 0, format, type, data);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, linear_filter ? GL_LINEAR : GL_NEAREST);