- added xBRZ texture scaler after clearing the licensing conditions. A screenshot of the confirmation that this is ok has been added to the 'licenses' folder.

This commit is contained in:
Christoph Oelckers 2016-09-03 14:01:51 +02:00
parent 8b7a87f256
commit aece9aaa58
7 changed files with 80 additions and 9 deletions

BIN
docs/licenses/xBRZ.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -849,6 +849,7 @@ file( GLOB HEADER_FILES
gl/dynlights/*.h
gl/hqnx/*.h
gl/hqnx_asm/*.h
gl/xbr/*.h
gl/models/*.h
gl/renderer/*.h
gl/scene/*.h
@ -1072,6 +1073,8 @@ set( FASTMATH_SOURCES
gl/hqnx/hq2x.cpp
gl/hqnx/hq3x.cpp
gl/hqnx/hq4x.cpp
gl/xbr/xbrz.cpp
gl/xbr/xbrz_old.cpp
gl/textures/gl_hwtexture.cpp
gl/textures/gl_texture.cpp
gl/textures/gl_material.cpp
@ -1542,7 +1545,8 @@ source_group("OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/
source_group("OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/data/.+")
source_group("OpenGL Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/dynlights/.+")
source_group("OpenGL Renderer\\HQ Resize" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx/.+")
source_group("OpenGL Renderer\\HQ Resize Assembly version" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx_asm/.+")
source_group("OpenGL Renderer\\HQ Resize MMX version" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx_asm/.+")
source_group("OpenGL Renderer\\XBRZ" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx_asm/.+")
source_group("OpenGL Renderer\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/models/.+")
source_group("OpenGL Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/renderer/.+")
source_group("OpenGL Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/scene/.+")

View file

@ -10,6 +10,15 @@ struct secplane_t;
struct subsector_t;
struct sector_t;
enum
{
VATTR_VERTEX_BIT,
VATTR_TEXCOORD_BIT,
VATTR_COLOR_BIT,
VATTR_VERTEX2_BIT,
VATTR_NORMAL_BIT
};
class FVertexBuffer
{
@ -20,6 +29,7 @@ public:
FVertexBuffer(bool wantbuffer = true);
virtual ~FVertexBuffer();
virtual void BindVBO() = 0;
void EnableBufferArrays(int enable, int disable);
};
struct FFlatVertex

View file

@ -680,8 +680,6 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector)
}
if (gl.legacyMode)
{
int cm = gl_RenderState.GetFixedColormap();
gl_RenderState.SetFixedColormap(cm);
gl_RenderState.DrawColormapOverlay();
}

View file

@ -12,7 +12,8 @@ enum
VATTR_VERTEX = 0,
VATTR_TEXCOORD = 1,
VATTR_COLOR = 2,
VATTR_VERTEX2 = 3
VATTR_VERTEX2 = 3,
VATTR_NORMAL = 4
};

View file

@ -43,15 +43,21 @@
#ifdef HAVE_MMX
#include "gl/hqnx_asm/hqnx_asm.h"
#endif
#include "gl/xbr/xbrz.h"
#include "gl/xbr/xbrz_old.h"
CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
#ifdef HAVE_MMX
if (self < 0 || self > 9)
#else
if (self < 0 || self > 6)
#endif
if (self < 0 || self > 16)
{
self = 0;
}
#ifndef HAVE_MMX
// This is to allow the menu option to work properly so that these filters can be skipped while cycling through them.
if (self == 7) self = 10;
if (self == 8) self = 10;
if (self == 9) self = 6;
#endif
GLRenderer->FlushTextures();
}
@ -242,6 +248,42 @@ static unsigned char *hqNxHelper( void (*hqNxFunction) ( unsigned*, unsigned*, i
}
static unsigned char *xbrzHelper( void (*xbrzFunction) ( size_t, const uint32_t*, uint32_t*, int, int, xbrz::ColorFormat, const xbrz::ScalerCfg&, int, int ),
const int N,
unsigned char *inputBuffer,
const int inWidth,
const int inHeight,
int &outWidth,
int &outHeight )
{
outWidth = N * inWidth;
outHeight = N *inHeight;
unsigned char * newBuffer = new unsigned char[outWidth*outHeight*4];
xbrzFunction(N, reinterpret_cast<uint32_t*>(inputBuffer), reinterpret_cast<uint32_t*>(newBuffer), inWidth, inHeight, xbrz::ARGB, xbrz::ScalerCfg(), 0, std::numeric_limits<int>::max());
delete[] inputBuffer;
return newBuffer;
}
static unsigned char *xbrzoldHelper( void (*xbrzFunction) ( size_t factor, const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, const xbrz_old::ScalerCfg& cfg, int yFirst, int yLast ),
const int N,
unsigned char *inputBuffer,
const int inWidth,
const int inHeight,
int &outWidth,
int &outHeight )
{
outWidth = N * inWidth;
outHeight = N *inHeight;
unsigned char * newBuffer = new unsigned char[outWidth*outHeight*4];
xbrzFunction(N, reinterpret_cast<uint32_t*>(inputBuffer), reinterpret_cast<uint32_t*>(newBuffer), inWidth, inHeight, xbrz_old::ScalerCfg(), 0, std::numeric_limits<int>::max());
delete[] inputBuffer;
return newBuffer;
}
//===========================================================================
//
// [BB] Upsamples the texture in inputBuffer, frees inputBuffer and returns
@ -322,6 +364,16 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
case 9:
return hqNxAsmHelper( &HQnX_asm::hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
#endif
case 10:
case 11:
case 12:
return xbrzHelper(xbrz::scale, type - 8, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 13:
case 14:
case 15:
return xbrzoldHelper(xbrz_old::scale, type - 11, inputBuffer, inWidth, inHeight, outWidth, outHeight );
}
}
return inputBuffer;

View file

@ -134,6 +134,12 @@ OptionValue "HqResizeModes"
7, "$OPTVAL_HQ2XMMX"
8, "$OPTVAL_HQ3XMMX"
9, "$OPTVAL_HQ4XMMX"
10, "xBRZ 2x"
11, "xBRZ 3x"
12, "xBRZ 4x"
13, "xBRZ_old 2x"
14, "xBRZ_old 3x"
15, "xBRZ_old 4x"
}
OptionValue "FogMode"