diff --git a/glide3x/h5/glide3/src/fxglide.h b/glide3x/h5/glide3/src/fxglide.h index 2b2b2eb..618a34e 100644 --- a/glide3x/h5/glide3/src/fxglide.h +++ b/glide3x/h5/glide3/src/fxglide.h @@ -2085,7 +2085,7 @@ struct _GlideRoot_s { FxI32 forceOldAA; /* Force AA to use SLI when possible */ FxI32 waxon ; /* Enable use of WAX */ FxU32 aaToggleKey; /* Raw Key code for AA toggle */ - FxU32 aaScreenshotKey; /* Raw Key code for AA toggle */ + FxU32 aaScreenshotKey; /* Raw Key code for AA toggle */ FxI32 analogSli ; /* force digital or analog sli */ FxI32 lodBias; /* User-adjustable lod bias value (signed) */ FxU32 sliBandHeightForce; /* Force user-specified band height */ @@ -2105,8 +2105,8 @@ struct _GlideRoot_s { FxU32 columnWidth; /* 'n' in columns of n */ /* Anti-aliasing default perturbation values */ - FxU32 aaXOffset[13][8]; /* increase arrays for 8xaa */ - FxU32 aaYOffset[13][8]; + FxU32 aaXOffset[15][8]; /* increase arrays for 8xaa */ + FxU32 aaYOffset[15][8]; /* Limit number of writes between fences */ FxI32 fenceLimit; FxBool texSubLodDither; /* always do subsample mipmap dithering */ @@ -2121,6 +2121,8 @@ struct _GlideRoot_s { #endif FxU32 ditherHwcAA; /* Specifies whether to use HwcAAReadRegion should dither */ + FxU32 taaToggleKey; /* Raw key code for TemporalAA toggle */ + FxBool taaEnabled; /* TemporalAA enabled */ } environment; GrHwConfiguration hwConfig; diff --git a/glide3x/h5/glide3/src/gglide.c b/glide3x/h5/glide3/src/gglide.c index 8eb0c48..cb7cccc 100644 --- a/glide3x/h5/glide3/src/gglide.c +++ b/glide3x/h5/glide3/src/gglide.c @@ -2644,6 +2644,16 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth)) } /* grBufferClear */ #endif +#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) +#define KBHIT(key) ((GetAsyncKeyState(key) & 0x8001) == 0x8001) +#elif (GLIDE_PLATFORM & GLIDE_OS_UNIX) +#define KBHIT(key) (0) +#elif defined(__DJGPP__) +#define KBHIT(key) (0) +#else +#define KBHIT(key) (0) +#endif + #ifndef DRI_BUILD /*--------------------------------------------------------------------------- ** grBufferSwap @@ -2656,6 +2666,8 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth)) GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval)) { #define FN_NAME "grBufferSwap" + static FxU32 aaEnabled = 1; + GR_BEGIN_NOFIFOCHECK(FN_NAME,86); GDBG_INFO_MORE(gc->myLevel,"(%d)\n",swapInterval); @@ -2672,6 +2684,34 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval)) } #endif + // test + if (aaEnabled) { + /* aaEnabled doesn't mean we have AA. + * It only means the user didn't forbid any kind of AA + * at run-time with _GlideRoot.environment.aaToggleKey + */ + static FxU32 taaFrame = 1; + if (KBHIT(_GlideRoot.environment.taaToggleKey)) { + _GlideRoot.environment.taaEnabled ^= 1; + if (!_GlideRoot.environment.taaEnabled) { + int jOffset = 0; /* reset the offsets to default */ + if (gc->grPixelSample > 1) { + /* reset the offsets to whatever our AA defaults */ + jOffset = gc->sampleOffsetIndex; + } + _grAAOffsetValue(_GlideRoot.environment.aaXOffset[jOffset], + _GlideRoot.environment.aaYOffset[jOffset], + 0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer); + } + } + if (_GlideRoot.environment.taaEnabled) { + _grAAOffsetValue(_GlideRoot.environment.aaXOffset[13 + taaFrame], + _GlideRoot.environment.aaYOffset[13 + taaFrame], + 0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer); + taaFrame ^= 1; + } + } + // 4x FSAA or greater FSAA if (0 && gc->grPixelSample >= 4) { int sample = gc->stats.bufferSwaps%4; @@ -2698,9 +2738,8 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval)) #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) if (_GlideRoot.environment.aaToggleKey) { if(gc->grPixelSample > 1) { - FxU16 keyState = GetAsyncKeyState(_GlideRoot.environment.aaToggleKey); - if((keyState & 0x8001) == 0x8001) { - static FxU32 aaEnabled = 1; + if (KBHIT(_GlideRoot.environment.aaToggleKey)) { + //static FxU32 aaEnabled = 1; aaEnabled ^= 1; if(aaEnabled) { @@ -2712,8 +2751,7 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval)) } } if(_GlideRoot.environment.aaScreenshotKey) { - FxU16 keyState = GetAsyncKeyState(_GlideRoot.environment.aaScreenshotKey); - if((keyState & 0x8001) == 0x8001) { + if (KBHIT(_GlideRoot.environment.aaScreenshotKey)) { grFinish(); hwcAAScreenShot(gc->bInfo, gc->curBuffer, _GlideRoot.environment.ditherHwcAA); } @@ -2947,6 +2985,34 @@ GR_ENTRY(grDRIBufferSwap, void, (FxU32 swapInterval)) GDBG_INFO_MORE(gc->myLevel,"(%d)\n",swapInterval); #ifdef FX_GLIDE_NAPALM + // test + if (1/*aaEnabled*/) { + /* aaEnabled doesn't mean we have AA. + * It only means the user didn't forbid any kind of AA + * at run-time with _GlideRoot.environment.aaToggleKey + */ + static FxU32 taaFrame = 1; + if (KBHIT(_GlideRoot.environment.taaToggleKey)) { + _GlideRoot.environment.taaEnabled ^= 1; + if (!_GlideRoot.environment.taaEnabled) { + int jOffset = 0; /* reset the offsets to default */ + if (gc->grPixelSample > 1) { + /* reset the offsets to whatever our AA defaults */ + jOffset = gc->sampleOffsetIndex; + } + _grAAOffsetValue(_GlideRoot.environment.aaXOffset[jOffset], + _GlideRoot.environment.aaYOffset[jOffset], + 0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer); + } + } + if (_GlideRoot.environment.taaEnabled) { + _grAAOffsetValue(_GlideRoot.environment.aaXOffset[13 + taaFrame], + _GlideRoot.environment.aaYOffset[13 + taaFrame], + 0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer); + taaFrame ^= 1; + } + } + if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) { _grChipMask( SST_CHIP_MASK_ALL_CHIPS ); } diff --git a/glide3x/h5/glide3/src/gpci.c b/glide3x/h5/glide3/src/gpci.c index f1d28f6..06d208a 100644 --- a/glide3x/h5/glide3/src/gpci.c +++ b/glide3x/h5/glide3/src/gpci.c @@ -1520,21 +1520,21 @@ _GlideInitEnvironment(void) /* 4xaa */ _GlideRoot.environment.aaXOffset[6][0] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X0", PRIBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][1] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X2", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][4] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X0", PRIBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][5] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X2", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[6][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][1] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X2", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][4] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X0", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][5] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", PRIBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X2", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[6][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); _GlideRoot.environment.aaYOffset[6][0] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y0", PRIBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[6][1] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[6][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y2", PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[6][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[6][4] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y0", PRIBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[6][5] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[6][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y2", PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[6][1] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[6][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y2", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[6][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[6][4] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y0", PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[6][5] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", PRIBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[6][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y2", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); _GlideRoot.environment.aaYOffset[6][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); /* jcochrane 4 chip offsets @@ -1686,21 +1686,21 @@ _GlideInitEnvironment(void) /* 4chip 4xaa */ _GlideRoot.environment.aaXOffset[11][0] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X0", PRIBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); // 375 _GlideRoot.environment.aaXOffset[11][1] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X2", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[11][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); // 875 - _GlideRoot.environment.aaXOffset[11][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[11][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); // 875 + _GlideRoot.environment.aaXOffset[11][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); _GlideRoot.environment.aaXOffset[11][4] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X2", PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); // 125 _GlideRoot.environment.aaXOffset[11][5] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X0", PRIBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaXOffset[11][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); // 625 - _GlideRoot.environment.aaXOffset[11][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaXOffset[11][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X3", SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF); // 625 + _GlideRoot.environment.aaXOffset[11][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_X1", SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF); _GlideRoot.environment.aaYOffset[11][0] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y0", PRIBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); // 125 _GlideRoot.environment.aaYOffset[11][1] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y2", PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[11][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); // - _GlideRoot.environment.aaYOffset[11][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[11][2] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); // + _GlideRoot.environment.aaYOffset[11][3] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); _GlideRoot.environment.aaYOffset[11][4] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y2", PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); _GlideRoot.environment.aaYOffset[11][5] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y0", PRIBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[11][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); - _GlideRoot.environment.aaYOffset[11][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[11][6] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y3", SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF); + _GlideRoot.environment.aaYOffset[11][7] = GLIDE_34GETENV("FX_GLIDE_AA4_OFFSET_Y1", SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF); /* 4chip 8xaa */ _GlideRoot.environment.aaXOffset[12][0] = GLIDE_34GETENV("FX_GLIDE_AA8_OFFSET_X0", PRIBUFVTXOFFX_8SMPL_CHP0_CORRECT_DEF); @@ -1810,6 +1810,10 @@ _GlideInitEnvironment(void) */ _GlideRoot.environment.aaToggleKey = GLIDE_GETENV("FX_GLIDE_AA_TOGGLE_KEY", 0L) ; + /* tempAA toggle key */ + _GlideRoot.environment.taaToggleKey = GLIDE_GETENV("FX_GLIDE_TAA_TOGGLE_KEY", 0L) ; + _GlideRoot.environment.taaEnabled = (_GlideRoot.environment.taaToggleKey != 0); + /* Save off 32-bit screenshots from four-sample 16-bit AA buffers */ _GlideRoot.environment.aaScreenshotKey = GLIDE_GETENV("FX_GLIDE_SCREENSHOT_KEY", 0L) ; diff --git a/glide3x/h5/glide3/src/gsst.c b/glide3x/h5/glide3/src/gsst.c index ef544d5..dd6f8d4 100644 --- a/glide3x/h5/glide3/src/gsst.c +++ b/glide3x/h5/glide3/src/gsst.c @@ -2012,6 +2012,99 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd, return 0; } + // test + if (gc->chipCount == 4 && gc->grPixelSample == 2) { + _GlideRoot.environment.aaXOffset[13][0] = + _GlideRoot.environment.aaXOffset[13][4] = _GlideRoot.environment.aaXOffset[6][0]; + _GlideRoot.environment.aaXOffset[13][2] = + _GlideRoot.environment.aaXOffset[13][6] = _GlideRoot.environment.aaXOffset[6][2]; + _GlideRoot.environment.aaYOffset[13][0] = + _GlideRoot.environment.aaYOffset[13][4] = _GlideRoot.environment.aaYOffset[6][0]; + _GlideRoot.environment.aaYOffset[13][2] = + _GlideRoot.environment.aaYOffset[13][6] = _GlideRoot.environment.aaYOffset[6][2]; + + _GlideRoot.environment.aaXOffset[14][0] = + _GlideRoot.environment.aaXOffset[14][4] = _GlideRoot.environment.aaXOffset[6][1]; + _GlideRoot.environment.aaXOffset[14][2] = + _GlideRoot.environment.aaXOffset[14][6] = _GlideRoot.environment.aaXOffset[6][3]; + _GlideRoot.environment.aaYOffset[14][0] = + _GlideRoot.environment.aaYOffset[14][4] = _GlideRoot.environment.aaYOffset[6][1]; + _GlideRoot.environment.aaYOffset[14][2] = + _GlideRoot.environment.aaYOffset[14][6] = _GlideRoot.environment.aaYOffset[6][3]; + } + else if (gc->chipCount == 4 && gc->grPixelSample == 4) { + _GlideRoot.environment.aaXOffset[13][0] = _GlideRoot.environment.aaXOffset[12][0]; + _GlideRoot.environment.aaXOffset[13][2] = _GlideRoot.environment.aaXOffset[12][2]; + _GlideRoot.environment.aaXOffset[13][4] = _GlideRoot.environment.aaXOffset[12][4]; + _GlideRoot.environment.aaXOffset[13][6] = _GlideRoot.environment.aaXOffset[12][6]; + _GlideRoot.environment.aaYOffset[13][0] = _GlideRoot.environment.aaYOffset[12][0]; + _GlideRoot.environment.aaYOffset[13][2] = _GlideRoot.environment.aaYOffset[12][2]; + _GlideRoot.environment.aaYOffset[13][4] = _GlideRoot.environment.aaYOffset[12][4]; + _GlideRoot.environment.aaYOffset[13][6] = _GlideRoot.environment.aaYOffset[12][6]; + + _GlideRoot.environment.aaXOffset[14][0] = _GlideRoot.environment.aaXOffset[12][1]; + _GlideRoot.environment.aaXOffset[14][2] = _GlideRoot.environment.aaXOffset[12][3]; + _GlideRoot.environment.aaXOffset[14][4] = _GlideRoot.environment.aaXOffset[12][5]; + _GlideRoot.environment.aaXOffset[14][6] = _GlideRoot.environment.aaXOffset[12][7]; + _GlideRoot.environment.aaYOffset[14][0] = _GlideRoot.environment.aaYOffset[12][1]; + _GlideRoot.environment.aaYOffset[14][2] = _GlideRoot.environment.aaYOffset[12][3]; + _GlideRoot.environment.aaYOffset[14][4] = _GlideRoot.environment.aaYOffset[12][5]; + _GlideRoot.environment.aaYOffset[14][6] = _GlideRoot.environment.aaYOffset[12][7]; + } + else if (gc->chipCount == 4 && gc->grPixelSample == 8) { + /* TODO: temporalAA over 4-chip 8xFSAA + * probably too slow and probably not needed anyway + */ + } + else if (gc->chipCount == 2 && gc->grPixelSample == 2) { + _GlideRoot.environment.aaXOffset[13][0] = _GlideRoot.environment.aaXOffset[6][0]; + _GlideRoot.environment.aaXOffset[13][2] = _GlideRoot.environment.aaXOffset[6][2]; + _GlideRoot.environment.aaYOffset[13][0] = _GlideRoot.environment.aaYOffset[6][0]; + _GlideRoot.environment.aaYOffset[13][2] = _GlideRoot.environment.aaYOffset[6][2]; + + _GlideRoot.environment.aaXOffset[14][0] = _GlideRoot.environment.aaXOffset[6][1]; + _GlideRoot.environment.aaXOffset[14][2] = _GlideRoot.environment.aaXOffset[6][3]; + _GlideRoot.environment.aaYOffset[14][0] = _GlideRoot.environment.aaYOffset[6][1]; + _GlideRoot.environment.aaYOffset[14][2] = _GlideRoot.environment.aaYOffset[6][3]; + } + else if (gc->chipCount == 2 && gc->grPixelSample == 4) { + _GlideRoot.environment.aaXOffset[13][0] = _GlideRoot.environment.aaXOffset[12][0]; + _GlideRoot.environment.aaXOffset[13][1] = _GlideRoot.environment.aaXOffset[12][2]; + _GlideRoot.environment.aaXOffset[13][2] = _GlideRoot.environment.aaXOffset[12][4]; + _GlideRoot.environment.aaXOffset[13][3] = _GlideRoot.environment.aaXOffset[12][6]; + _GlideRoot.environment.aaYOffset[13][0] = _GlideRoot.environment.aaYOffset[12][0]; + _GlideRoot.environment.aaYOffset[13][1] = _GlideRoot.environment.aaYOffset[12][2]; + _GlideRoot.environment.aaYOffset[13][2] = _GlideRoot.environment.aaYOffset[12][4]; + _GlideRoot.environment.aaYOffset[13][3] = _GlideRoot.environment.aaYOffset[12][6]; + + _GlideRoot.environment.aaXOffset[14][0] = _GlideRoot.environment.aaXOffset[12][1]; + _GlideRoot.environment.aaXOffset[14][1] = _GlideRoot.environment.aaXOffset[12][3]; + _GlideRoot.environment.aaXOffset[14][2] = _GlideRoot.environment.aaXOffset[12][5]; + _GlideRoot.environment.aaXOffset[14][3] = _GlideRoot.environment.aaXOffset[12][7]; + _GlideRoot.environment.aaYOffset[14][0] = _GlideRoot.environment.aaYOffset[12][1]; + _GlideRoot.environment.aaYOffset[14][1] = _GlideRoot.environment.aaYOffset[12][3]; + _GlideRoot.environment.aaYOffset[14][2] = _GlideRoot.environment.aaYOffset[12][5]; + _GlideRoot.environment.aaYOffset[14][3] = _GlideRoot.environment.aaYOffset[12][7]; + } + else if (gc->chipCount == 1 && gc->grPixelSample == 2) { + /* TODO: temporalAA over 1-chip 2xFSAA + * probably too slow + */ + } + if (gc->grPixelSample < 2) { + int i; + /* default perturbation values */ + for (i = 0; i < 8; i++) { + _GlideRoot.environment.aaXOffset[13][i] = _GlideRoot.environment.aaXOffset[0][i]; + _GlideRoot.environment.aaYOffset[13][i] = _GlideRoot.environment.aaYOffset[0][i]; + } + /* jittered values */ + for (i = 0; i < 8; i++) { + _GlideRoot.environment.aaXOffset[14][i] = _GlideRoot.environment.aaXOffset[13][i] + 0x6; + _GlideRoot.environment.aaYOffset[14][i] = _GlideRoot.environment.aaXOffset[13][i] + 0x6; + } + } + /* ** 2 pixel per clock rendering will only be enabled if ** 1) we are in 15/16 bpp rendering mode (may not help in high res) diff --git a/glide3x/h5/incsrc/h3defs.h b/glide3x/h5/incsrc/h3defs.h index beaf08d..4d4fd64 100644 --- a/glide3x/h5/incsrc/h3defs.h +++ b/glide3x/h5/incsrc/h3defs.h @@ -579,8 +579,8 @@ #define PRIBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF "-0.125" #define PRIBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF "-0.375" #define PRIBUFVTXOFFX_8SMPL_CHP0_CORRECT_DEF "-0.125" - #define PRIBUFVTXOFFX_8SMPL_CHP1_CORRECT_DEF "0.375" - #define PRIBUFVTXOFFX_8SMPL_CHP2_CORRECT_DEF "-0.375" + #define PRIBUFVTXOFFX_8SMPL_CHP1_CORRECT_DEF "-0.375" + #define PRIBUFVTXOFFX_8SMPL_CHP2_CORRECT_DEF "0.375" #define PRIBUFVTXOFFX_8SMPL_CHP3_CORRECT_DEF "0.125" // Note: Glide uses the binary values, and these are still the *original* values that ar // centered around the pixel center, rather than offset by -0.5 @@ -605,8 +605,8 @@ #define PRIBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF "-0.375" #define PRIBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF "0.125" #define PRIBUFVTXOFFY_8SMPL_CHP0_CORRECT_DEF "-0.375" - #define PRIBUFVTXOFFY_8SMPL_CHP1_CORRECT_DEF "-0.125" - #define PRIBUFVTXOFFY_8SMPL_CHP2_CORRECT_DEF "0.125" + #define PRIBUFVTXOFFY_8SMPL_CHP1_CORRECT_DEF "0.125" + #define PRIBUFVTXOFFY_8SMPL_CHP2_CORRECT_DEF "-0.125" #define PRIBUFVTXOFFY_8SMPL_CHP3_CORRECT_DEF "0.375" // Note: Glide uses the binary values, and these are still the *original* values that ar // centered around the pixel center, rather than offset by -0.5 @@ -631,9 +631,9 @@ #define SECBUFVTXOFFX_4SMPL_CHP0_CORRECT_DEF "0.375" #define SECBUFVTXOFFX_4SMPL_CHP1_CORRECT_DEF "0.125" #define SECBUFVTXOFFX_8SMPL_CHP0_CORRECT_DEF "-0.25" - #define SECBUFVTXOFFX_8SMPL_CHP1_CORRECT_DEF "0.125" - #define SECBUFVTXOFFX_8SMPL_CHP2_CORRECT_DEF "0.25" - #define SECBUFVTXOFFX_8SMPL_CHP3_CORRECT_DEF "-0.125" + #define SECBUFVTXOFFX_8SMPL_CHP1_CORRECT_DEF "-0.125" + #define SECBUFVTXOFFX_8SMPL_CHP2_CORRECT_DEF "0.125" + #define SECBUFVTXOFFX_8SMPL_CHP3_CORRECT_DEF "0.25" // Note: Glide uses the binary values, and these are still the *original* values that ar // centered around the pixel center, rather than offset by -0.5 #define SECBUFVTXOFFX_2SMPL_DEF_VAL 0x04 @@ -657,9 +657,9 @@ #define SECBUFVTXOFFY_4SMPL_CHP0_CORRECT_DEF "-0.125" #define SECBUFVTXOFFY_4SMPL_CHP1_CORRECT_DEF "0.375" #define SECBUFVTXOFFY_8SMPL_CHP0_CORRECT_DEF "-0.125" - #define SECBUFVTXOFFY_8SMPL_CHP1_CORRECT_DEF "-0.25" - #define SECBUFVTXOFFY_8SMPL_CHP2_CORRECT_DEF "0.125" - #define SECBUFVTXOFFY_8SMPL_CHP3_CORRECT_DEF "0.25" + #define SECBUFVTXOFFY_8SMPL_CHP1_CORRECT_DEF "0.25" + #define SECBUFVTXOFFY_8SMPL_CHP2_CORRECT_DEF "-0.25" + #define SECBUFVTXOFFY_8SMPL_CHP3_CORRECT_DEF "0.125" // Note: Glide uses the binary values, and these are still the *original* values that ar // centered around the pixel center, rather than offset by -0.5 #define SECBUFVTXOFFY_2SMPL_DEF_VAL 0x04