From c9f8bdfcb0599d57346f1c79a35aee6edfdeec56 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 15 Mar 2025 19:20:36 +0300 Subject: [PATCH] ref: gl: allow updating texture with NULL data by calling TexImage instead of TexSubImage --- ref/gl/gl_image.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ref/gl/gl_image.c b/ref/gl/gl_image.c index 17a7f54c..0e3ddefa 100644 --- a/ref/gl/gl_image.c +++ b/ref/gl/gl_image.c @@ -1031,8 +1031,8 @@ static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth, static void GL_TextureImageRAW( gl_texture_t *tex, GLint side, GLint level, GLint width, GLint height, GLint depth, GLint type, const void *data ) { GLuint cubeTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; - qboolean subImage = FBitSet( tex->flags, TF_IMG_UPLOADED ); - GLenum inFormat = gEngfuncs.Image_GetPFDesc(type)->glFormat; + qboolean subImage = FBitSet( tex->flags, TF_IMG_UPLOADED ) && data != NULL; + GLenum inFormat = gEngfuncs.Image_GetPFDesc( type )->glFormat; GLint dataType = GL_UNSIGNED_BYTE; GLsizei samplesCount = 0; @@ -1064,7 +1064,7 @@ static void GL_TextureImageRAW( gl_texture_t *tex, GLint side, GLint level, GLin else if( tex->target == GL_TEXTURE_2D_MULTISAMPLE ) { #if !defined( XASH_GL_STATIC ) || (!defined( XASH_GLES ) && !defined( XASH_GL4ES )) - samplesCount = (GLsizei)gEngfuncs.pfnGetCvarFloat("gl_msaa_samples"); + samplesCount = (GLsizei)gEngfuncs.pfnGetCvarFloat( "gl_msaa_samples" ); switch (samplesCount) { case 2: