[Video] Remove GRCOLORCOMBINEEXT definition

This commit is contained in:
zilmar 2017-05-21 20:44:34 +10:00
parent 9d6fea8549
commit 34c481c04f
6 changed files with 82 additions and 182 deletions

View File

@ -15908,21 +15908,8 @@ void InitCombine()
{
WriteTrace(TraceGlide64, TraceDebug, "-");
memset(&cmb, 0, sizeof(cmb));
cmb.grColorCombineExt = (GRCOLORCOMBINEEXT)grColorCombineExt;
cmb.grAlphaCombineExt = (GRCOLORCOMBINEEXT)grAlphaCombineExt;
cmb.grTexColorCombineExt = (GRTEXCOLORCOMBINEEXT)grTexColorCombineExt;
cmb.grTexAlphaCombineExt = (GRTEXCOLORCOMBINEEXT)grTexAlphaCombineExt;
cmb.grConstantColorValueExt = (GRCONSTANTCOLORVALUEEXT)grConstantColorValueExt;
if (cmb.grColorCombineExt && cmb.grAlphaCombineExt &&
cmb.grTexColorCombineExt && cmb.grTexAlphaCombineExt)
{
cmb.combine_ext = TRUE;
WriteTrace(TraceGlide64, TraceDebug, "initialized.");
}
else
{
cmb.combine_ext = FALSE;
}
cmb.combine_ext = TRUE;
WriteTrace(TraceGlide64, TraceDebug, "initialized.");
cmb.dc0_lodbias = cmb.dc1_lodbias = 31;
cmb.dc0_detailscale = cmb.dc1_detailscale = 7;
cmb.lodbias0 = cmb.lodbias1 = 1.0f;

View File

@ -44,52 +44,47 @@
typedef struct
{
uint32_t ccolor; // constant color to set at the end, color and alpha
uint32_t c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
uint32_t a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
uint32_t tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
uint32_t tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
int dc0_lodbias, dc1_lodbias;
uint8_t dc0_detailscale, dc1_detailscale;
float dc0_detailmax, dc1_detailmax;
float lodbias0, lodbias1;
uint32_t abf1, abf2;
uint32_t mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
uint32_t mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
//combine extensions
uint32_t c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
int c_ext_c_invert, c_ext_d_invert;
uint32_t a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
int a_ext_c_invert, a_ext_d_invert;
uint32_t t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
int t0c_ext_c_invert, t0c_ext_d_invert;
uint32_t t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
int t0a_ext_c_invert, t0a_ext_d_invert;
uint32_t t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
int t1c_ext_c_invert, t1c_ext_d_invert;
uint32_t t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
int t1a_ext_c_invert, t1a_ext_d_invert;
GRCOLORCOMBINEEXT grColorCombineExt;
GRCOLORCOMBINEEXT grAlphaCombineExt;
GRTEXCOLORCOMBINEEXT grTexColorCombineExt;
GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt;
GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
uint32_t tex_ccolor;
int combine_ext;
uint8_t cmb_ext_use;
uint8_t tex_cmb_ext_use;
uint32_t shade_mod_hash;
uint32_t ccolor; // constant color to set at the end, color and alpha
uint32_t c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
uint32_t a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
uint32_t tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
uint32_t tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
int dc0_lodbias, dc1_lodbias;
uint8_t dc0_detailscale, dc1_detailscale;
float dc0_detailmax, dc1_detailmax;
float lodbias0, lodbias1;
uint32_t abf1, abf2;
uint32_t mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
uint32_t mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
//combine extensions
uint32_t c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
int c_ext_c_invert, c_ext_d_invert;
uint32_t a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
int a_ext_c_invert, a_ext_d_invert;
uint32_t t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
int t0c_ext_c_invert, t0c_ext_d_invert;
uint32_t t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
int t0a_ext_c_invert, t0a_ext_d_invert;
uint32_t t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
int t1c_ext_c_invert, t1c_ext_d_invert;
uint32_t t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
int t1a_ext_c_invert, t1a_ext_d_invert;
uint32_t tex_ccolor;
int combine_ext;
uint8_t cmb_ext_use;
uint8_t tex_cmb_ext_use;
uint32_t shade_mod_hash;
} COMBINE;
extern COMBINE cmb;
void Combine ();
void CombineBlender ();
void CountCombine ();
void InitCombine ();
void ColorCombinerToExtension ();
void AlphaCombinerToExtension ();
void TexColorCombinerToExtension (GrChipID_t tmu);
void TexAlphaCombinerToExtension (GrChipID_t tmu);
void Combine();
void CombineBlender();
void CountCombine();
void InitCombine();
void ColorCombinerToExtension();
void AlphaCombinerToExtension();
void TexColorCombinerToExtension(GrChipID_t tmu);
void TexAlphaCombinerToExtension(GrChipID_t tmu);
#endif //COMBINE _H

View File

@ -25,7 +25,6 @@
#include "Settings.h"
#if defined __VISUALC__
typedef unsigned char boolean;
#define GLIDE64_TRY __try
#define GLIDE64_CATCH __except (EXCEPTION_EXECUTE_HANDLER)
#else
@ -164,44 +163,12 @@ extern "C" {
extern GFX_INFO gfx;
extern bool no_dlist;
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
GrCombineMode_t a_mode,
GrCCUColor_t b,
GrCombineMode_t b_mode,
GrCCUColor_t c,
FxBool c_invert,
GrCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu,
GrTCCUColor_t a,
GrCombineMode_t a_mode,
GrTCCUColor_t b,
GrCombineMode_t b_mode,
GrTCCUColor_t c,
FxBool c_invert,
GrTCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
(GrChipID_t tmu,
GrColor_t value);
typedef void (FX_CALL *GRSTIPPLE)(FxI32 mode);
typedef int(*GETTEXADDR)(int tmu, int texsize);
extern GETTEXADDR GetTexAddr;
#ifndef GR_STIPPLE_DISABLE
#define GR_STIPPLE_DISABLE 0x0
#define GR_STIPPLE_PATTERN 0x1
#define GR_STIPPLE_ROTATE 0x2
#endif
enum
{
GFX_STIPPLE_DISABLE = 0x0,
GFX_STIPPLE_PATTERN = 0x1,
GFX_STIPPLE_ROTATE = 0x2,
};
/******************************************************************
Function: CaptureScreen
@ -468,5 +435,5 @@ extern "C" {
EXPORT void CALL PluginLoaded(void);
#if defined(__cplusplus)
}
}
#endif

View File

@ -222,7 +222,6 @@ int GetTexAddrNonUMA(int tmu, int texsize)
voodoo.tmem_ptr[tmu] += texsize;
return addr;
}
GETTEXADDR GetTexAddr = GetTexAddrNonUMA;
// guLoadTextures - used to load the cursor and font textures
void guLoadTextures()
@ -265,14 +264,11 @@ void guLoadTextures()
if ((nbTextureUnits > 2 ? 2 : 1) > 1)
{
rdp.texbufs[1].tmu = GR_TMU1;
rdp.texbufs[1].begin = voodoo.tex_UMA ? rdp.texbufs[0].end : voodoo.tex_min_addr[GR_TMU1];
rdp.texbufs[1].begin = rdp.texbufs[0].end;
rdp.texbufs[1].end = rdp.texbufs[1].begin + tbuf_size;
rdp.texbufs[1].count = 0;
rdp.texbufs[1].clear_allowed = TRUE;
if (voodoo.tex_UMA)
offset_font += tbuf_size;
else
offset_texbuf1 = tbuf_size;
offset_font += tbuf_size;
}
#include "font.h"
@ -479,11 +475,8 @@ int InitGfx()
unsigned int SST_type = GR_SSTTYPE_Voodoo5;
// 2Mb Texture boundary
voodoo.has_2mb_tex_boundary = (SST_type < GR_SSTTYPE_Banshee) && !evoodoo;
// use UMA if available
voodoo.tex_UMA = FALSE;
// we get better texture cache hits with UMA on
grEnable(GR_TEXTURE_UMA_EXT);
voodoo.tex_UMA = TRUE;
WriteTrace(TraceGlide64, TraceDebug, "Using TEXUMA extension");
ChangeSize();
@ -507,20 +500,8 @@ int InitGfx()
grGet(GR_MAX_TEXTURE_SIZE, 4, (FxI32*)&voodoo.max_tex_size);
voodoo.sup_large_tex = (voodoo.max_tex_size > 256 && !g_settings->hacks(CSettings::hack_PPL));
if (voodoo.tex_UMA)
{
GetTexAddr = GetTexAddrUMA;
voodoo.tex_min_addr[0] = voodoo.tex_min_addr[1] = grTexMinAddress(GR_TMU0);
voodoo.tex_max_addr[0] = voodoo.tex_max_addr[1] = grTexMaxAddress(GR_TMU0);
}
else
{
GetTexAddr = GetTexAddrNonUMA;
voodoo.tex_min_addr[0] = grTexMinAddress(GR_TMU0);
voodoo.tex_min_addr[1] = grTexMinAddress(GR_TMU1);
voodoo.tex_max_addr[0] = grTexMaxAddress(GR_TMU0);
voodoo.tex_max_addr[1] = grTexMaxAddress(GR_TMU1);
}
voodoo.tex_min_addr[0] = voodoo.tex_min_addr[1] = grTexMinAddress(GR_TMU0);
voodoo.tex_max_addr[0] = voodoo.tex_max_addr[1] = grTexMaxAddress(GR_TMU0);
// Is mirroring allowed?
if (!g_settings->hacks(CSettings::hack_Zelda)) //zelda's trees suffer from hardware mirroring

View File

@ -84,8 +84,7 @@ void AddToList(NODE **list, uint32_t crc, uintptr_t data, int tmu, int number)
node->pNext = *list;
*list = node;
rdp.n_cached[tmu] ++;
if (voodoo.tex_UMA)
rdp.n_cached[tmu ^ 1] = rdp.n_cached[tmu];
rdp.n_cached[tmu ^ 1] = rdp.n_cached[tmu];
}
void DeleteList(NODE **list)
@ -113,7 +112,7 @@ void ClearCache()
{
voodoo.tmem_ptr[0] = offset_textures;
rdp.n_cached[0] = 0;
voodoo.tmem_ptr[1] = voodoo.tex_UMA ? offset_textures : offset_texbuf1;
voodoo.tmem_ptr[1] = offset_textures;
rdp.n_cached[1] = 0;
for (int i = 0; i < 65536; i++)
@ -453,11 +452,8 @@ void GetTexInfo(int id, int tile)
{
WriteTrace(TraceRDP, TraceDebug, " | | | |- Texture found in cache (tmu=%d).", node->tmu);
tex_found[id][node->tmu] = node->number;
if (voodoo.tex_UMA)
{
tex_found[id][node->tmu ^ 1] = node->number;
return;
}
tex_found[id][node->tmu ^ 1] = node->number;
return;
}
}
}
@ -473,16 +469,7 @@ void GetTexInfo(int id, int tile)
int ChooseBestTmu(int tmu1, int tmu2)
{
if (!GfxInitDone) return tmu1;
if (voodoo.tex_UMA) return 0;
if (tmu1 >= (nbTextureUnits > 2 ? 2 : 1)) return tmu2;
if (tmu2 >= (nbTextureUnits > 2 ? 2 : 1)) return tmu1;
if (voodoo.tex_max_addr[tmu1] - voodoo.tmem_ptr[tmu1] >
voodoo.tex_max_addr[tmu2] - voodoo.tmem_ptr[tmu2])
return tmu1;
else
return tmu2;
return 0;
}
//****************************************************************
@ -690,14 +677,8 @@ void TexCache()
ColorCombinerToExtension();
if (!(cmb.cmb_ext_use & COMBINE_EXT_ALPHA))
AlphaCombinerToExtension();
cmb.grColorCombineExt(cmb.c_ext_a, cmb.c_ext_a_mode,
cmb.c_ext_b, cmb.c_ext_b_mode,
cmb.c_ext_c, cmb.c_ext_c_invert,
cmb.c_ext_d, cmb.c_ext_d_invert, 0, 0);
cmb.grAlphaCombineExt(cmb.a_ext_a, cmb.a_ext_a_mode,
cmb.a_ext_b, cmb.a_ext_b_mode,
cmb.a_ext_c, cmb.a_ext_c_invert,
cmb.a_ext_d, cmb.a_ext_d_invert, 0, 0);
grColorCombineExt(cmb.c_ext_a, cmb.c_ext_a_mode, cmb.c_ext_b, cmb.c_ext_b_mode, cmb.c_ext_c, cmb.c_ext_c_invert, cmb.c_ext_d, cmb.c_ext_d_invert, 0, 0);
grAlphaCombineExt(cmb.a_ext_a, cmb.a_ext_a_mode, cmb.a_ext_b, cmb.a_ext_b_mode, cmb.a_ext_c, cmb.a_ext_c_invert, cmb.a_ext_d, cmb.a_ext_d_invert, 0, 0);
}
else
{
@ -719,21 +700,17 @@ void TexCache()
TexColorCombinerToExtension(GR_TMU1);
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
TexAlphaCombinerToExtension(GR_TMU1);
cmb.grTexColorCombineExt(tmu_1, cmb.t1c_ext_a, cmb.t1c_ext_a_mode,
cmb.t1c_ext_b, cmb.t1c_ext_b_mode,
cmb.t1c_ext_c, cmb.t1c_ext_c_invert,
cmb.t1c_ext_d, cmb.t1c_ext_d_invert, 0, 0);
cmb.grTexAlphaCombineExt(tmu_1, cmb.t1a_ext_a, cmb.t1a_ext_a_mode,
cmb.t1a_ext_b, cmb.t1a_ext_b_mode,
cmb.t1a_ext_c, cmb.t1a_ext_c_invert,
cmb.t1a_ext_d, cmb.t1a_ext_d_invert, 0, 0);
cmb.grConstantColorValueExt(tmu_1, cmb.tex_ccolor);
grTexColorCombineExt(tmu_1, cmb.t1c_ext_a, cmb.t1c_ext_a_mode, cmb.t1c_ext_b, cmb.t1c_ext_b_mode, cmb.t1c_ext_c, cmb.t1c_ext_c_invert, cmb.t1c_ext_d, cmb.t1c_ext_d_invert, 0, 0);
grTexAlphaCombineExt(tmu_1, cmb.t1a_ext_a, cmb.t1a_ext_a_mode, cmb.t1a_ext_b, cmb.t1a_ext_b_mode, cmb.t1a_ext_c, cmb.t1a_ext_c_invert, cmb.t1a_ext_d, cmb.t1a_ext_d_invert, 0, 0);
grConstantColorValueExt(tmu_1, cmb.tex_ccolor);
}
else
{
grTexCombine(tmu_1, cmb.tmu1_func, cmb.tmu1_fac, cmb.tmu1_a_func, cmb.tmu1_a_fac, cmb.tmu1_invert, cmb.tmu1_a_invert);
if (cmb.combine_ext)
cmb.grConstantColorValueExt(tmu_1, 0);
{
grConstantColorValueExt(tmu_1, 0);
}
}
grTexDetailControl(tmu_1, cmb.dc1_lodbias, cmb.dc1_detailscale, cmb.dc1_detailmax);
grTexLodBiasValue(tmu_1, cmb.lodbias1);
@ -744,24 +721,24 @@ void TexCache()
{
WriteTrace(TraceRDP, TraceDebug, " | | | |- combiner extension tmu0");
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
{
TexColorCombinerToExtension(GR_TMU0);
}
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
{
TexAlphaCombinerToExtension(GR_TMU0);
cmb.grTexColorCombineExt(tmu_0, cmb.t0c_ext_a, cmb.t0c_ext_a_mode,
cmb.t0c_ext_b, cmb.t0c_ext_b_mode,
cmb.t0c_ext_c, cmb.t0c_ext_c_invert,
cmb.t0c_ext_d, cmb.t0c_ext_d_invert, 0, 0);
cmb.grTexAlphaCombineExt(tmu_0, cmb.t0a_ext_a, cmb.t0a_ext_a_mode,
cmb.t0a_ext_b, cmb.t0a_ext_b_mode,
cmb.t0a_ext_c, cmb.t0a_ext_c_invert,
cmb.t0a_ext_d, cmb.t0a_ext_d_invert, 0, 0);
cmb.grConstantColorValueExt(tmu_0, cmb.tex_ccolor);
}
grTexColorCombineExt(tmu_0, cmb.t0c_ext_a, cmb.t0c_ext_a_mode, cmb.t0c_ext_b, cmb.t0c_ext_b_mode, cmb.t0c_ext_c, cmb.t0c_ext_c_invert, cmb.t0c_ext_d, cmb.t0c_ext_d_invert, 0, 0);
grTexAlphaCombineExt(tmu_0, cmb.t0a_ext_a, cmb.t0a_ext_a_mode, cmb.t0a_ext_b, cmb.t0a_ext_b_mode, cmb.t0a_ext_c, cmb.t0a_ext_c_invert, cmb.t0a_ext_d, cmb.t0a_ext_d_invert, 0, 0);
grConstantColorValueExt(tmu_0, cmb.tex_ccolor);
}
else
{
grTexCombine(tmu_0, cmb.tmu0_func, cmb.tmu0_fac, cmb.tmu0_a_func, cmb.tmu0_a_fac, cmb.tmu0_invert, cmb.tmu0_a_invert);
if (cmb.combine_ext)
cmb.grConstantColorValueExt(tmu_0, 0);
{
grConstantColorValueExt(tmu_0, 0);
}
}
grTexDetailControl(tmu_0, cmb.dc0_lodbias, cmb.dc0_detailscale, cmb.dc0_detailmax);
grTexLodBiasValue(tmu_0, cmb.lodbias0);
@ -785,7 +762,7 @@ void TexCache()
WriteTrace(TraceRDP, TraceDebug, " | |- T0 found in cache.");
if (GfxInitDone)
{
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[0][0]] : &rdp.cache[tmu_0][tex_found[0][tmu_0]];
CACHE_LUT *cache = &rdp.cache[0][tex_found[0][0]];
rdp.cur_cache_n[0] = tex_found[0][tmu_0];
rdp.cur_cache[0] = cache;
rdp.cur_cache[0]->last_used = frame_count;
@ -816,7 +793,7 @@ void TexCache()
WriteTrace(TraceRDP, TraceDebug, " | |- T1 found in cache.");
if (GfxInitDone)
{
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[1][0]] : &rdp.cache[tmu_1][tex_found[1][tmu_1]];
CACHE_LUT *cache = &rdp.cache[0][tex_found[1][0]];
rdp.cur_cache_n[1] = tex_found[1][tmu_1];
rdp.cur_cache[1] = cache;
rdp.cur_cache[1]->last_used = frame_count;
@ -971,7 +948,7 @@ void LoadTex(int id, int tmu)
}
// Get this cache object
cache = voodoo.tex_UMA ? &rdp.cache[0][rdp.n_cached[0]] : &rdp.cache[tmu][rdp.n_cached[tmu]];
cache = &rdp.cache[0][rdp.n_cached[0]];
memset(cache, 0, sizeof(*cache));
rdp.cur_cache[id] = cache;
rdp.cur_cache_n[id] = rdp.n_cached[tmu];
@ -1701,17 +1678,11 @@ void LoadTex(int id, int tmu)
// DON'T CONTINUE (already done)
}
uint32_t tex_addr = GetTexAddr(tmu, texture_size);
grTexDownloadMipMap(tmu,
tex_addr,
GR_MIPMAPLEVELMASK_BOTH,
t_info);
grTexSource(tmu,
tex_addr,
GR_MIPMAPLEVELMASK_BOTH,
t_info);
uint32_t tex_addr = voodoo.tex_min_addr[0] + voodoo.tmem_ptr[0];
voodoo.tmem_ptr[0] += texture_size;
voodoo.tmem_ptr[1] = voodoo.tmem_ptr[0];
grTexDownloadMipMap(tmu, tex_addr, GR_MIPMAPLEVELMASK_BOTH, t_info);
grTexSource(tmu, tex_addr, GR_MIPMAPLEVELMASK_BOTH, t_info);
}
WriteTrace(TraceRDP, TraceDebug, " | | +- LoadTex end");
}

View File

@ -158,7 +158,6 @@ typedef struct
int sup_mirroring;
int sup_32bit_tex;
int has_2mb_tex_boundary;
int tex_UMA;
int gamma_correction;
FxI32 gamma_table_size;
FxU32 *gamma_table_r;