From 37ac6ef9a04078cd0491acab82970e3777fd481f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Jan 2016 02:13:47 +0100 Subject: [PATCH] - fixed: Translucency detection for GL textures was broken. - fixed: Textures which are already scaled should not be upsampled. - fixed: The transparency check in the upscaling code checked the wrong modes for exclusion when handling translucent textures. --- src/gl/textures/gl_hqresize.cpp | 10 +++++++--- src/gl/textures/gl_texture.cpp | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gl/textures/gl_hqresize.cpp b/src/gl/textures/gl_hqresize.cpp index 261f66e6a..1563895b5 100644 --- a/src/gl/textures/gl_hqresize.cpp +++ b/src/gl/textures/gl_hqresize.cpp @@ -263,6 +263,10 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u if ( inputTexture->bHasCanvas ) return inputBuffer; + // already scaled? + if (inputTexture->xScale >= FRACUNIT*2 && inputTexture->yScale >= FRACUNIT*2) + return inputBuffer; + switch (inputTexture->UseType) { case FTexture::TEX_Sprite: @@ -281,14 +285,14 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u if (inputBuffer) { + int type = gl_texture_hqresize; outWidth = inWidth; outHeight = inHeight; - int type = gl_texture_hqresize; #ifdef HAVE_MMX // ASM-hqNx does not preserve the alpha channel so fall back to C-version for such textures - if (!hasAlpha && type > 3 && type <= 6) + if (!hasAlpha && type > 6 && type <= 9) { - type += 3; + type -= 3; } #endif diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 414f631a4..b7347ae54 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -510,7 +510,7 @@ void FTexture::CheckTrans(unsigned char * buffer, int size, int trans) if (trans == -1) { DWORD * dwbuf = (DWORD*)buffer; - if (gl_info.mIsTransparent == -1) for(int i=0;i>24; @@ -521,7 +521,6 @@ void FTexture::CheckTrans(unsigned char * buffer, int size, int trans) } } } - gl_info.mIsTransparent = 0; } }