From: Mikko Rasa Date: Thu, 12 Aug 2021 13:03:25 +0000 (+0300) Subject: Use DSA for TextureCube if available X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=aff68a183a4b33653750acc57a021fd7ed6c555c;p=libs%2Fgl.git Use DSA for TextureCube if available --- diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index 01820fa8..93faa370 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -83,8 +84,11 @@ void TextureCube::allocate(unsigned level) if(ARB_texture_storage) { - BindRestore _bind(this); - glTexStorage2D(target, levels, storage_fmt, size, size); + Conditional _bind(!ARB_direct_state_access, this); + if(ARB_direct_state_access) + glTextureStorage2D(id, levels, storage_fmt, size, size); + else + glTexStorage2D(target, levels, storage_fmt, size, size); apply_swizzle(); allocated |= (64< _bind(!ARB_direct_state_acess, this); allocate(level); PixelComponents comp = get_components(storage_fmt); GLenum type = get_gl_type(get_component_type(storage_fmt)); - glTexSubImage2D(face, level, x, y, wd, ht, comp, type, data); + if(ARB_direct_state_access) + glTextureSubImage3D(id, level, x, y, get_face_index(face), wd, ht, 1, comp, type, data); + else + glTexSubImage2D(face, level, x, y, wd, ht, comp, type, data); if(auto_gen_mipmap && level==0) generate_mipmap();