add a define to disable additional scalers
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2914
This commit is contained in:
parent
7daaf72e2d
commit
8f76382e7d
5 changed files with 70 additions and 6 deletions
|
@ -19,6 +19,12 @@
|
|||
#ifndef DOSBOX_RENDER_H
|
||||
#define DOSBOX_RENDER_H
|
||||
|
||||
// 0: complex scalers off, scaler cache off, some simple scalers off, memory requirements reduced
|
||||
// 1: complex scalers off, scaler cache off, all simple scalers on
|
||||
// 2: complex scalers off, scaler cache on
|
||||
// 3: complex scalers on
|
||||
#define RENDER_USE_ADVANCED_SCALERS 3
|
||||
|
||||
#include "../src/gui/render_scalers.h"
|
||||
|
||||
#define RENDER_SKIP_CACHE 16
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: render.cpp,v 1.53 2007-07-02 20:06:59 c2woody Exp $ */
|
||||
/* $Id: render.cpp,v 1.54 2007-07-05 16:03:49 c2woody Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
@ -291,7 +291,9 @@ static void RENDER_Reset( void ) {
|
|||
else
|
||||
simpleBlock = &ScaleNormal1x;
|
||||
/* Maybe override them */
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
switch (render.scale.op) {
|
||||
#if RENDER_USE_ADVANCED_SCALERS>2
|
||||
case scalerOpAdvInterp:
|
||||
if (render.scale.size == 2)
|
||||
complexBlock = &ScaleAdvInterp2x;
|
||||
|
@ -322,6 +324,7 @@ static void RENDER_Reset( void ) {
|
|||
if (render.scale.size == 2)
|
||||
complexBlock = &Scale2xSaI;
|
||||
break;
|
||||
#endif
|
||||
case scalerOpTV:
|
||||
if (render.scale.size == 2)
|
||||
simpleBlock = &ScaleTV2x;
|
||||
|
@ -341,6 +344,7 @@ static void RENDER_Reset( void ) {
|
|||
simpleBlock = &ScaleScan3x;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
} else if (dblw) {
|
||||
simpleBlock = &ScaleNormalDw;
|
||||
} else if (dblh) {
|
||||
|
@ -351,10 +355,14 @@ forcenormal:
|
|||
simpleBlock = &ScaleNormal1x;
|
||||
}
|
||||
if (complexBlock) {
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
if ((width >= SCALER_COMPLEXWIDTH - 16) || height >= SCALER_COMPLEXHEIGHT - 16) {
|
||||
LOG_MSG("Scaler can't handle this resolution, going back to normal");
|
||||
goto forcenormal;
|
||||
}
|
||||
#else
|
||||
goto forcenormal;
|
||||
#endif
|
||||
gfx_flags = complexBlock->gfxFlags;
|
||||
xscale = complexBlock->xscale;
|
||||
yscale = complexBlock->yscale;
|
||||
|
@ -423,18 +431,24 @@ forcenormal:
|
|||
E_Exit("Failed to create a rendering output");
|
||||
ScalerLineBlock_t *lineBlock;
|
||||
if (gfx_flags & GFX_HARDWARE) {
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
if (complexBlock) {
|
||||
lineBlock = &ScalerCache;
|
||||
render.scale.complexHandler = complexBlock->Linear[ render.scale.outMode ];
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
render.scale.complexHandler = 0;
|
||||
lineBlock = &simpleBlock->Linear;
|
||||
}
|
||||
} else {
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
if (complexBlock) {
|
||||
lineBlock = &ScalerCache;
|
||||
render.scale.complexHandler = complexBlock->Random[ render.scale.outMode ];
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
render.scale.complexHandler = 0;
|
||||
lineBlock = &simpleBlock->Random;
|
||||
}
|
||||
|
@ -581,6 +595,7 @@ void RENDER_Init(Section * sec) {
|
|||
if (!strcasecmp(scaler,"none")) { render.scale.op = scalerOpNormal;render.scale.size = 1; }
|
||||
else if (!strcasecmp(scaler,"normal2x")) { render.scale.op = scalerOpNormal;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"normal3x")) { render.scale.op = scalerOpNormal;render.scale.size = 3; }
|
||||
#if RENDER_USE_ADVANCED_SCALERS>2
|
||||
else if (!strcasecmp(scaler,"advmame2x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"advmame3x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"advinterp2x")) { render.scale.op = scalerOpAdvInterp;render.scale.size = 2; }
|
||||
|
@ -590,12 +605,15 @@ void RENDER_Init(Section * sec) {
|
|||
else if (!strcasecmp(scaler,"2xsai")) { render.scale.op = scalerOpSaI;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"super2xsai")) { render.scale.op = scalerOpSuperSaI;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"supereagle")) { render.scale.op = scalerOpSuperEagle;render.scale.size = 2; }
|
||||
#endif
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
else if (!strcasecmp(scaler,"tv2x")) { render.scale.op = scalerOpTV;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"tv3x")) { render.scale.op = scalerOpTV;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"rgb2x")){ render.scale.op = scalerOpRGB;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"rgb3x")){ render.scale.op = scalerOpRGB;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"scan2x")){ render.scale.op = scalerOpScan;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"scan3x")){ render.scale.op = scalerOpScan;render.scale.size = 3; }
|
||||
#endif
|
||||
else {
|
||||
render.scale.op = scalerOpNormal;render.scale.size = 1;
|
||||
LOG_MSG("Illegal scaler type %s,falling back to normal.",scaler);
|
||||
|
|
|
@ -36,7 +36,9 @@ static union {
|
|||
} scalerWriteCache;
|
||||
//scalerFrameCache_t scalerFrameCache;
|
||||
scalerSourceCache_t scalerSourceCache;
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
scalerChangeCache_t scalerChangeCache;
|
||||
#endif
|
||||
|
||||
#define _conc2(A,B) A ## B
|
||||
#define _conc3(A,B,C) A ## B ## C
|
||||
|
@ -159,6 +161,7 @@ static INLINE void ScalerAddLines( Bitu changed, Bitu count ) {
|
|||
#undef DBPP
|
||||
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
ScalerLineBlock_t ScalerCache = {
|
||||
{ Cache_8_8, Cache_8_15 , Cache_8_16 , Cache_8_32 },
|
||||
{ 0, Cache_15_15, Cache_15_16, Cache_15_32},
|
||||
|
@ -166,6 +169,7 @@ ScalerLineBlock_t ScalerCache = {
|
|||
{ 0, Cache_32_15, Cache_32_16, Cache_32_32},
|
||||
{ Cache_8_8, Cache_9_15 , Cache_9_16 , Cache_9_32 }
|
||||
};
|
||||
#endif
|
||||
|
||||
ScalerSimpleBlock_t ScaleNormal1x = {
|
||||
"Normal",
|
||||
|
@ -252,6 +256,7 @@ ScalerSimpleBlock_t ScaleNormal3x = {
|
|||
{ Normal3x_8_8_R, Normal3x_9_15_R , Normal3x_9_16_R , Normal3x_9_32_R }
|
||||
}};
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
ScalerSimpleBlock_t ScaleTV2x = {
|
||||
"TV2x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
|
@ -353,10 +358,12 @@ ScalerSimpleBlock_t ScaleRGB3x = {
|
|||
{ 0, RGB3x_32_15_R, RGB3x_32_16_R, RGB3x_32_32_R},
|
||||
{ 0, RGB3x_9_15_R , RGB3x_9_16_R , RGB3x_9_32_R }
|
||||
}};
|
||||
#endif
|
||||
|
||||
|
||||
/* Complex scalers */
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>2
|
||||
ScalerComplexBlock_t ScaleAdvMame2x ={
|
||||
"AdvMame2x",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
|
@ -430,4 +437,4 @@ ScalerComplexBlock_t ScaleAdvInterp3x = {
|
|||
{ 0,AdvInterp3x_15_R,AdvInterp3x_16_R,AdvInterp3x_32_R}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,12 +21,20 @@
|
|||
|
||||
//#include "render.h"
|
||||
#include "video.h"
|
||||
//MAXWIDTH: increased it for the large text modi
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
#define SCALER_MAXWIDTH 1280
|
||||
#define SCALER_MAXHEIGHT 1024
|
||||
#else
|
||||
// reduced to save some memory
|
||||
#define SCALER_MAXWIDTH 800
|
||||
#define SCALER_MAXHEIGHT 600
|
||||
#endif
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
#define SCALER_COMPLEXWIDTH 800
|
||||
#define SCALER_COMPLEXHEIGHT 600
|
||||
#endif
|
||||
|
||||
#define SCALER_BLOCKSIZE 16
|
||||
|
||||
typedef enum {
|
||||
|
@ -35,16 +43,20 @@ typedef enum {
|
|||
|
||||
typedef enum scalerOperation {
|
||||
scalerOpNormal,
|
||||
#if RENDER_USE_ADVANCED_SCALERS>2
|
||||
scalerOpAdvMame,
|
||||
scalerOpAdvInterp,
|
||||
scalerOpHQ,
|
||||
scalerOpSaI,
|
||||
scalerOpSuperSaI,
|
||||
scalerOpSuperEagle,
|
||||
#endif
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
scalerOpTV,
|
||||
scalerOpRGB,
|
||||
scalerOpScan,
|
||||
scalerLast,
|
||||
#endif
|
||||
scalerLast
|
||||
} scalerOperation_t;
|
||||
|
||||
typedef void (*ScalerLineHandler_t)(const void *src);
|
||||
|
@ -54,6 +66,7 @@ extern Bit8u Scaler_Aspect[];
|
|||
extern Bit8u diff_table[];
|
||||
extern Bitu Scaler_ChangedLineIndex;
|
||||
extern Bit16u Scaler_ChangedLines[];
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
/* Not entirely happy about those +2's since they make a non power of 2, with muls instead of shift */
|
||||
typedef Bit8u scalerChangeCache_t [SCALER_COMPLEXHEIGHT][SCALER_COMPLEXWIDTH / SCALER_BLOCKSIZE] ;
|
||||
typedef union {
|
||||
|
@ -61,13 +74,16 @@ typedef union {
|
|||
Bit16u b16 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
|
||||
Bit8u b8 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
|
||||
} scalerFrameCache_t;
|
||||
#endif
|
||||
typedef union {
|
||||
Bit32u b32 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
|
||||
Bit16u b16 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
|
||||
Bit8u b8 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
|
||||
} scalerSourceCache_t;
|
||||
extern scalerSourceCache_t scalerSourceCache;
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
extern scalerChangeCache_t scalerChangeCache;
|
||||
#endif
|
||||
typedef ScalerLineHandler_t ScalerLineBlock_t[5][4];
|
||||
|
||||
typedef struct {
|
||||
|
@ -97,13 +113,16 @@ extern ScalerSimpleBlock_t ScaleNormalDw;
|
|||
extern ScalerSimpleBlock_t ScaleNormalDh;
|
||||
extern ScalerSimpleBlock_t ScaleNormal2x;
|
||||
extern ScalerSimpleBlock_t ScaleNormal3x;
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
extern ScalerSimpleBlock_t ScaleTV2x;
|
||||
extern ScalerSimpleBlock_t ScaleTV3x;
|
||||
extern ScalerSimpleBlock_t ScaleRGB2x;
|
||||
extern ScalerSimpleBlock_t ScaleRGB3x;
|
||||
extern ScalerSimpleBlock_t ScaleScan2x;
|
||||
extern ScalerSimpleBlock_t ScaleScan3x;
|
||||
#endif
|
||||
/* Complex scalers */
|
||||
#if RENDER_USE_ADVANCED_SCALERS>2
|
||||
extern ScalerComplexBlock_t ScaleHQ2x;
|
||||
extern ScalerComplexBlock_t ScaleHQ3x;
|
||||
extern ScalerComplexBlock_t Scale2xSaI;
|
||||
|
@ -113,5 +132,8 @@ extern ScalerComplexBlock_t ScaleAdvMame2x;
|
|||
extern ScalerComplexBlock_t ScaleAdvMame3x;
|
||||
extern ScalerComplexBlock_t ScaleAdvInterp2x;
|
||||
extern ScalerComplexBlock_t ScaleAdvInterp3x;
|
||||
#endif
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
extern ScalerLineBlock_t ScalerCache;
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
#define D6 fc[+2 + 2*SCALER_COMPLEXWIDTH]
|
||||
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>1
|
||||
static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
||||
#ifdef RENDER_NULL_INPUT
|
||||
if (!s) {
|
||||
|
@ -208,6 +209,7 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
|||
render.scale.inLine++;
|
||||
render.scale.complexHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Simple scalers */
|
||||
|
@ -281,6 +283,8 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
|||
|
||||
#if (DBPP > 8)
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
|
||||
#define SCALERNAME TV2x
|
||||
#define SCALERWIDTH 2
|
||||
#define SCALERHEIGHT 2
|
||||
|
@ -390,9 +394,14 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
|||
#undef SCALERHEIGHT
|
||||
#undef SCALERFUNC
|
||||
|
||||
#endif //#if RENDER_USE_ADVANCED_SCALERS>0
|
||||
|
||||
#endif //#if (DBPP > 8)
|
||||
|
||||
/* Complex scalers */
|
||||
|
||||
#if RENDER_USE_ADVANCED_SCALERS>2
|
||||
|
||||
#if (SBPP == DBPP)
|
||||
|
||||
|
||||
|
@ -549,6 +558,8 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
|||
|
||||
#endif // (SBPP == DBPP) && !defined (CACHEWITHPAL)
|
||||
|
||||
#endif // #if RENDER_USE_ADVANCED_SCALERS>2
|
||||
|
||||
#undef PSIZE
|
||||
#undef PTYPE
|
||||
#undef PMAKE
|
||||
|
|
Loading…
Add table
Reference in a new issue