Browse Source

opengl: fix compressed 2d texture uploads.

Sasha Szpakowski 1 month ago
parent
commit
0020317dc4
2 changed files with 1 additions and 8 deletions
  1. 0 1
      src/modules/graphics/opengl/OpenGL.h
  2. 1 7
      src/modules/graphics/opengl/Texture.cpp

+ 0 - 1
src/modules/graphics/opengl/OpenGL.h

@@ -358,7 +358,6 @@ public:
 	/**
 	 * Equivalent to glTexStorage2D/3D on platforms that support it. Equivalent
 	 * to glTexImage2D/3D for all levels and slices of a texture otherwise.
-	 * NOTE: this does not handle compressed texture formats.
 	 **/
 	bool rawTexStorage(TextureType target, int levels, PixelFormat pixelformat, int width, int height, int depth = 1);
 

+ 1 - 7
src/modules/graphics/opengl/Texture.cpp

@@ -460,13 +460,7 @@ void Texture::uploadByteData(const void *data, size_t size, int level, int slice
 	if (isPixelFormatCompressed(format))
 	{
 		if (texType == TEXTURE_2D || texType == TEXTURE_CUBE)
-		{
-			// Possible issues on some very old drivers if TexSubImage is used.
-			if (r.x != 0 || r.y != 0 || r.w != getPixelWidth(level) || r.h != getPixelHeight(level))
-				glCompressedTexSubImage2D(gltarget, level, r.x, r.y, r.w, r.h, fmt.internalformat, size, data);
-			else
-				glCompressedTexImage2D(gltarget, level, fmt.internalformat, r.w, r.h, 0, size, data);
-		}
+			glCompressedTexSubImage2D(gltarget, level, r.x, r.y, r.w, r.h, fmt.internalformat, size, data);
 		else if (texType == TEXTURE_2D_ARRAY || texType == TEXTURE_VOLUME)
 			glCompressedTexSubImage3D(gltarget, level, r.x, r.y, slice, r.w, r.h, 1, fmt.internalformat, size, data);
 	}