1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-27 23:14:05 +00:00

Code refactor: add vi status constants

This commit is contained in:
gizmo98 2020-10-21 19:34:08 +02:00 committed by Sergey Lipskiy
parent cf7b3c84ce
commit 4981503bfc
4 changed files with 23 additions and 6 deletions

View File

@ -1077,7 +1077,7 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
const s32 delta_y = y2 - y1;
const u32 vitype = _SHIFTR( *REG.VI_STATUS, 0, 2 );
const bool serration_pulses = (*REG.VI_STATUS & 0x40) != 0;
const bool serration_pulses = (*REG.VI_STATUS & VI_STATUS_SERRATE_ENABLED) != 0;
const bool validinterlace = ((vitype & 2) != 0 ) && serration_pulses;
if (validinterlace && prevserrate && emucontrolsvicurrent < 0)
emucontrolsvicurrent = (*REG.VI_V_CURRENT_LINE & 1) != prevvicurrent ? 1 : 0;
@ -1167,7 +1167,7 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
_result.vi_lowerfield = lowerfield;
_result.vi_origin = _SHIFTR(*REG.VI_ORIGIN, 0, 24);
_result.vi_fsaa = (*REG.VI_STATUS & 512) == 0;
_result.vi_divot = (*REG.VI_STATUS & 16) != 0;
_result.vi_divot = (*REG.VI_STATUS & VI_STATUS_DIVOT_ENABLED) != 0;
return true;
#if 0

View File

@ -5,6 +5,7 @@
#include "PostProcessor.h"
#include "FrameBuffer.h"
#include "Config.h"
#include "VI.h"
#include <Graphics/Context.h>
#include <Graphics/Parameters.h>
@ -156,7 +157,7 @@ FrameBuffer * PostProcessor::_doGammaCorrection(FrameBuffer * _pBuffer)
if (_pBuffer == nullptr)
return nullptr;
if (((*REG.VI_STATUS & 8) | config.gammaCorrection.force) == 0)
if (((*REG.VI_STATUS & VI_STATUS_GAMMA_ENABLED) | config.gammaCorrection.force) == 0)
return _pBuffer;
return _doPostProcessing(_pBuffer, m_gammaCorrectionProgram.get());

View File

@ -49,7 +49,7 @@ void VI_UpdateSize()
VI.real_height = vEnd > vStart ? (((vEnd - vStart) >> 1) * vScale) >> 10 : 0;
VI.width = *REG.VI_WIDTH;
VI.interlaced = (*REG.VI_STATUS & 0x40) != 0;
VI.interlaced = (*REG.VI_STATUS & VI_STATUS_SERRATE_ENABLED) != 0;
if (VI.interlaced) {
f32 fullWidth = 640.0f;
@ -164,13 +164,13 @@ void VI_UpdateScreen()
wnd.updateScale();
bVIUpdated = true;
}
const u32 size = *REG.VI_STATUS & 3;
const u32 size = *REG.VI_STATUS & VI_STATUS_TYPE_32;
if (VI.height > 0 && size > G_IM_SIZ_8b && VI.width > 0)
frameBufferList().saveBuffer(*REG.VI_ORIGIN & 0xffffff, G_IM_FMT_RGBA, size, VI.width, true);
}
}
// if ((((*REG.VI_STATUS) & 3) > 0) && (gDP.colorImage.changed || bCFB)) { // Does not work in release build!!!
if (((*REG.VI_STATUS) & 3) > 0) {
if (((*REG.VI_STATUS) & VI_STATUS_TYPE_32) > 0) {
if (!bVIUpdated) {
VI_UpdateSize();
bVIUpdated = true;

View File

@ -2,6 +2,22 @@
#define VI_H
#include "Types.h"
// VI status register
#define VI_STATUS_TYPE_16 0x000002 /* 16 bit 5/5/5/3 */
#define VI_STATUS_TYPE_32 0x000003 /* 32 bit 8/8/8/8 */
#define VI_STATUS_GAMMA_DITHER_ENABLED 0x000004
#define VI_STATUS_GAMMA_ENABLED 0x000008
#define VI_STATUS_DIVOT_ENABLED 0x000010
#define VI_STATUS_SERRATE_ENABLED 0x000040
#define VI_STATUS_AA_MASK 0x000300 /* see AA modes */
#define VI_STATUS_DITHER_FILTER_ENABLED 0x010000
// AA modes
#define AA_MODE_AA_RESAMPLE_ALWAYS_FETCH 0x000000 /* Always fetch lines */
#define AA_MODE_AA_RESAMPLE 0x000100 /* Fetch extra line if needed */
#define AA_MODE_RESAMPLE_ONLY 0x000200
#define AA_MODE_NEITHER 0x000300 /* Replicate pixels, no interpolation */
struct VIInfo
{
u32 width, widthPrev, height, real_height;