From 89701a1a45c19f67d0b129c971f5b87d206fc5dd Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Fri, 21 Oct 2016 19:48:02 -0700 Subject: [PATCH] OpenGL2: Faster mipmap generation. --- code/renderergl2/tr_image.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/renderergl2/tr_image.c b/code/renderergl2/tr_image.c index aecafc72..4666670f 100644 --- a/code/renderergl2/tr_image.c +++ b/code/renderergl2/tr_image.c @@ -1980,8 +1980,16 @@ static void RawImage_UploadTexture(GLuint texture, byte *data, int x, int y, int RawImage_UploadToRgtc2Texture(texture, miplevel, x, y, width, height, data); else qglTextureSubImage2DEXT(texture, target, miplevel, x, y, width, height, dataFormat, dataType, data); + } - if (rgba8 && !lastMip && numMips < 2) + if (!lastMip && numMips < 2) + { + if (glRefConfig.framebufferObject) + { + qglGenerateTextureMipmapEXT(texture, target); + break; + } + else if (rgba8) { if (type == IMGTYPE_NORMAL || type == IMGTYPE_NORMALHEIGHT) R_MipMapNormalHeight(data, data, width, height, glRefConfig.swizzleNormalmap);