ref: gl: fix loading texture arrays

This commit is contained in:
ncuxonaT
2025-11-30 16:21:28 +03:00
committed by a1batross
parent bf5821e4ea
commit bbe659ebfa

View File

@@ -1109,6 +1109,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
uint i, j, numSides;
uint offset = 0;
qboolean normalMap;
qboolean texture3d;
const byte *bufend;
// dedicated server
@@ -1156,6 +1157,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
texsize = GL_CalcTextureSize( tex->format, tex->width, tex->height, tex->depth );
normalMap = FBitSet( tex->flags, TF_NORMALMAP ) ? true : false;
numSides = FBitSet( pic->flags, IMAGE_CUBEMAP ) ? 6 : 1;
texture3d = ( tex->target == GL_TEXTURE_3D );
// uploading texture into video memory, change the binding
glState.currentTextures[glState.activeTMU] = tex->texnum;
@@ -1174,7 +1176,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
{
width = Q_max( 1, ( tex->width >> j ));
height = Q_max( 1, ( tex->height >> j ));
depth = Q_max( 1, ( tex->depth >> j ));
depth = texture3d ? Q_max( 1, ( tex->depth >> j )) : tex->depth;
texsize = GL_CalcTextureSize( tex->format, width, height, depth );
size = GL_CalcImageSize( pic->type, width, height, depth );
GL_TextureImageCompressed( tex, i, j, width, height, depth, size, buf );
@@ -1191,7 +1193,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
{
width = Q_max( 1, ( tex->width >> j ));
height = Q_max( 1, ( tex->height >> j ));
depth = Q_max( 1, ( tex->depth >> j ));
depth = texture3d ? Q_max( 1, ( tex->depth >> j )) : tex->depth;
texsize = GL_CalcTextureSize( tex->format, width, height, depth );
size = GL_CalcImageSize( pic->type, width, height, depth );
GL_TextureImageRAW( tex, i, j, width, height, depth, pic->type, buf );