-
- if(ARB_texture_storage)
- return sub_image(face, level, 0, 0, lsz, lsz, data);
-
- if(!allocated)
- {
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- apply_swizzle();
- }
-
- GLenum fmt = get_gl_pixelformat(storage_fmt);
- GLenum comp = get_gl_components(get_components(storage_fmt));
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- glTexImage2D(face, level, fmt, lsz, lsz, 0, comp, type, data);
-
- if(level==0)
- {
- allocated |= 1<<get_face_index(face);
- if((allocated&63)==63)
- {
- allocated |= 64;
- if(auto_gen_mipmap && level==0 && (allocated&63)==63)
- {
- generate_mipmap();
- allocated |= (64<<levels)-1;
- }
- }
- }
- else if(!(allocated&(64<<level)))
- {
- for(unsigned i=0; i<6; ++i)
- if(enumerate_faces(i)!=face)
- glTexImage2D(enumerate_faces(i), level, fmt, lsz, lsz, 0, comp, type, 0);
-
- allocated |= 64<<level;
- }
+ return sub_image(face, level, 0, 0, lsz, lsz, data);