mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- enabled hqNx MMX on all platforms with Intel intrinsics support
This commit is contained in:
parent
69813993b0
commit
1c5d0ccd65
3 changed files with 41 additions and 11 deletions
|
@ -449,6 +449,22 @@ else( SSE_MATTERS )
|
||||||
set( BACKPATCH 0 )
|
set( BACKPATCH 0 )
|
||||||
endif( SSE_MATTERS )
|
endif( SSE_MATTERS )
|
||||||
|
|
||||||
|
if( X64 )
|
||||||
|
set( HAVE_MMX 1 )
|
||||||
|
else( X64 )
|
||||||
|
set( SAFE_CMAKE_C_FLAGS ${CMAKE_C_FLAGS} )
|
||||||
|
|
||||||
|
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmmx")
|
||||||
|
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#include <mmintrin.h>
|
||||||
|
int main(void) { __m64 v = _m_from_int(0); }"
|
||||||
|
HAVE_MMX)
|
||||||
|
|
||||||
|
set( CMAKE_C_FLAGS ${SAFE_CMAKE_C_FLAGS} )
|
||||||
|
endif( X64 )
|
||||||
|
|
||||||
# Set up flags for GCC
|
# Set up flags for GCC
|
||||||
|
|
||||||
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
@ -581,10 +597,6 @@ endif( NOT DYN_FLUIDSYNTH )
|
||||||
|
|
||||||
# Start defining source files for ZDoom
|
# Start defining source files for ZDoom
|
||||||
set( PLAT_WIN32_SOURCES
|
set( PLAT_WIN32_SOURCES
|
||||||
gl/hqnx_asm/hq2x_asm.cpp
|
|
||||||
gl/hqnx_asm/hq3x_asm.cpp
|
|
||||||
gl/hqnx_asm/hq4x_asm.cpp
|
|
||||||
gl/hqnx_asm/hqnx_asm_Image.cpp
|
|
||||||
win32/eaxedit.cpp
|
win32/eaxedit.cpp
|
||||||
win32/fb_d3d9.cpp
|
win32/fb_d3d9.cpp
|
||||||
win32/fb_d3d9_wipe.cpp
|
win32/fb_d3d9_wipe.cpp
|
||||||
|
@ -668,6 +680,25 @@ else( WIN32 )
|
||||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
|
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||||
endif( WIN32 )
|
endif( WIN32 )
|
||||||
|
|
||||||
|
if( HAVE_MMX )
|
||||||
|
add_definitions( -DHAVE_MMX=1 )
|
||||||
|
|
||||||
|
set( SYSTEM_SOURCES ${SYSTEM_SOURCES}
|
||||||
|
gl/hqnx_asm/hq2x_asm.cpp
|
||||||
|
gl/hqnx_asm/hq3x_asm.cpp
|
||||||
|
gl/hqnx_asm/hq4x_asm.cpp
|
||||||
|
gl/hqnx_asm/hqnx_asm_Image.cpp)
|
||||||
|
|
||||||
|
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
set_source_files_properties(
|
||||||
|
gl/hqnx_asm/hq2x_asm.cpp
|
||||||
|
gl/hqnx_asm/hq3x_asm.cpp
|
||||||
|
gl/hqnx_asm/hq4x_asm.cpp
|
||||||
|
gl/textures/gl_hqresize.cpp
|
||||||
|
PROPERTIES COMPILE_FLAGS "-mmmx" )
|
||||||
|
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
endif( HAVE_MMX )
|
||||||
|
|
||||||
if( NOT ASM_SOURCES )
|
if( NOT ASM_SOURCES )
|
||||||
set( ASM_SOURCES "" )
|
set( ASM_SOURCES "" )
|
||||||
endif( NOT ASM_SOURCES )
|
endif( NOT ASM_SOURCES )
|
||||||
|
|
|
@ -57,7 +57,7 @@ CUSTOM_CVAR (Float, vid_contrast, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
// when they are actually valid.
|
// when they are actually valid.
|
||||||
void gl_SetupMenu()
|
void gl_SetupMenu()
|
||||||
{
|
{
|
||||||
#ifndef _MSC_VER
|
#ifndef HAVE_MMX
|
||||||
FOptionValues **opt = OptionValues.CheckKey("HqResizeModes");
|
FOptionValues **opt = OptionValues.CheckKey("HqResizeModes");
|
||||||
if (opt != NULL)
|
if (opt != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,13 +40,13 @@
|
||||||
#include "gl/textures/gl_texture.h"
|
#include "gl/textures/gl_texture.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "gl/hqnx/hqx.h"
|
#include "gl/hqnx/hqx.h"
|
||||||
#ifdef _MSC_VER
|
#ifdef HAVE_MMX
|
||||||
#include "gl/hqnx_asm/hqnx_asm.h"
|
#include "gl/hqnx_asm/hqnx_asm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef HAVE_MMX
|
||||||
if (self < 0 || self > 9)
|
if (self < 0 || self > 9)
|
||||||
#else
|
#else
|
||||||
if (self < 0 || self > 6)
|
if (self < 0 || self > 6)
|
||||||
|
@ -186,8 +186,7 @@ static unsigned char *scaleNxHelper( void (*scaleNxFunction) ( uint32* , uint32*
|
||||||
return newBuffer;
|
return newBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [BB] hqnx scaling is only supported with the MS compiler.
|
#ifdef HAVE_MMX
|
||||||
#ifdef _MSC_VER
|
|
||||||
static unsigned char *hqNxAsmHelper( void (*hqNxFunction) ( int*, unsigned char*, int, int, int ),
|
static unsigned char *hqNxAsmHelper( void (*hqNxFunction) ( int*, unsigned char*, int, int, int ),
|
||||||
const int N,
|
const int N,
|
||||||
unsigned char *inputBuffer,
|
unsigned char *inputBuffer,
|
||||||
|
@ -285,7 +284,7 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
|
||||||
outWidth = inWidth;
|
outWidth = inWidth;
|
||||||
outHeight = inHeight;
|
outHeight = inHeight;
|
||||||
int type = gl_texture_hqresize;
|
int type = gl_texture_hqresize;
|
||||||
#ifdef _MSC_VER
|
#ifdef HAVE_MMX
|
||||||
// ASM-hqNx does not preserve the alpha channel so fall back to C-version for such textures
|
// 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 > 3 && type <= 6)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +306,7 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
|
||||||
return hqNxHelper( &hq3x_32, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
return hqNxHelper( &hq3x_32, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
||||||
case 6:
|
case 6:
|
||||||
return hqNxHelper( &hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
return hqNxHelper( &hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
||||||
#ifdef _MSC_VER
|
#ifdef HAVE_MMX
|
||||||
case 7:
|
case 7:
|
||||||
return hqNxAsmHelper( &HQnX_asm::hq2x_32, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
return hqNxAsmHelper( &HQnX_asm::hq2x_32, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
||||||
case 8:
|
case 8:
|
||||||
|
|
Loading…
Reference in a new issue