mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Code refactor: add vi status constants
This commit is contained in:
parent
cf7b3c84ce
commit
4981503bfc
|
@ -1077,7 +1077,7 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
|
||||||
const s32 delta_y = y2 - y1;
|
const s32 delta_y = y2 - y1;
|
||||||
const u32 vitype = _SHIFTR( *REG.VI_STATUS, 0, 2 );
|
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;
|
const bool validinterlace = ((vitype & 2) != 0 ) && serration_pulses;
|
||||||
if (validinterlace && prevserrate && emucontrolsvicurrent < 0)
|
if (validinterlace && prevserrate && emucontrolsvicurrent < 0)
|
||||||
emucontrolsvicurrent = (*REG.VI_V_CURRENT_LINE & 1) != prevvicurrent ? 1 : 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_lowerfield = lowerfield;
|
||||||
_result.vi_origin = _SHIFTR(*REG.VI_ORIGIN, 0, 24);
|
_result.vi_origin = _SHIFTR(*REG.VI_ORIGIN, 0, 24);
|
||||||
_result.vi_fsaa = (*REG.VI_STATUS & 512) == 0;
|
_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;
|
return true;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "PostProcessor.h"
|
#include "PostProcessor.h"
|
||||||
#include "FrameBuffer.h"
|
#include "FrameBuffer.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "VI.h"
|
||||||
|
|
||||||
#include <Graphics/Context.h>
|
#include <Graphics/Context.h>
|
||||||
#include <Graphics/Parameters.h>
|
#include <Graphics/Parameters.h>
|
||||||
|
@ -156,7 +157,7 @@ FrameBuffer * PostProcessor::_doGammaCorrection(FrameBuffer * _pBuffer)
|
||||||
if (_pBuffer == nullptr)
|
if (_pBuffer == nullptr)
|
||||||
return 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 _pBuffer;
|
||||||
|
|
||||||
return _doPostProcessing(_pBuffer, m_gammaCorrectionProgram.get());
|
return _doPostProcessing(_pBuffer, m_gammaCorrectionProgram.get());
|
||||||
|
|
|
@ -49,7 +49,7 @@ void VI_UpdateSize()
|
||||||
|
|
||||||
VI.real_height = vEnd > vStart ? (((vEnd - vStart) >> 1) * vScale) >> 10 : 0;
|
VI.real_height = vEnd > vStart ? (((vEnd - vStart) >> 1) * vScale) >> 10 : 0;
|
||||||
VI.width = *REG.VI_WIDTH;
|
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) {
|
if (VI.interlaced) {
|
||||||
f32 fullWidth = 640.0f;
|
f32 fullWidth = 640.0f;
|
||||||
|
@ -164,13 +164,13 @@ void VI_UpdateScreen()
|
||||||
wnd.updateScale();
|
wnd.updateScale();
|
||||||
bVIUpdated = true;
|
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)
|
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);
|
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) && (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) {
|
if (!bVIUpdated) {
|
||||||
VI_UpdateSize();
|
VI_UpdateSize();
|
||||||
bVIUpdated = true;
|
bVIUpdated = true;
|
||||||
|
|
16
src/VI.h
16
src/VI.h
|
@ -2,6 +2,22 @@
|
||||||
#define VI_H
|
#define VI_H
|
||||||
#include "Types.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
|
struct VIInfo
|
||||||
{
|
{
|
||||||
u32 width, widthPrev, height, real_height;
|
u32 width, widthPrev, height, real_height;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user