mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-24 21:39:35 +00:00
Code refactor and cleanup:
* type cast fixes * signed/unsigned fixes * code formatting fixes * class members initialization fixes
This commit is contained in:
parent
ddd93673d8
commit
46c65776a0
|
@ -79,7 +79,7 @@ End:
|
|||
float len;
|
||||
|
||||
len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
|
||||
if (len != 0.0) {
|
||||
if (len != 0.0f) {
|
||||
len = sqrtf( len );
|
||||
v[0] /= len;
|
||||
v[1] /= len;
|
||||
|
@ -92,7 +92,7 @@ void InverseTransformVectorNormalizeN(float src[][3], float dst[][3], float mtx[
|
|||
{
|
||||
for (u32 i = 0; i < count; i++)
|
||||
{
|
||||
InverseTransformVectorNormalize((float(*))src[i], (float(*))dst[i], mtx);
|
||||
InverseTransformVectorNormalize(static_cast<float*>(src[i]), static_cast<float*>(dst[i]), mtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#include "CRC.h"
|
||||
|
||||
#define CRC32_POLYNOMIAL 0x04C11DB7
|
||||
#define CRC32_POLYNOMIAL 0x04C11DB7U
|
||||
|
||||
unsigned int CRCTable[ 256 ];
|
||||
static unsigned int CRCTable[ 256 ];
|
||||
|
||||
static
|
||||
u32 Reflect( u32 ref, char ch )
|
||||
u32 Reflect( u32 ref, u32 ch )
|
||||
{
|
||||
u32 value = 0;
|
||||
|
||||
// Swap bit 0 for bit 7
|
||||
// bit 1 for bit 6, etc.
|
||||
for (int i = 1; i < (ch + 1); ++i) {
|
||||
for (u32 i = 1; i < (ch + 1); ++i) {
|
||||
if(ref & 1)
|
||||
value |= 1 << (ch - i);
|
||||
ref >>= 1;
|
||||
|
@ -23,22 +23,21 @@ void CRC_Init()
|
|||
{
|
||||
u32 crc;
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
crc = Reflect( i, 8 ) << 24;
|
||||
for (u32 i = 0; i < 256; ++i) {
|
||||
crc = Reflect( i, 8U ) << 24U;
|
||||
for (int j = 0; j < 8; ++j)
|
||||
crc = (crc << 1) ^ (crc & (1 << 31) ? CRC32_POLYNOMIAL : 0);
|
||||
crc = (crc << 1U) ^ (crc & (1U << 31U) ? CRC32_POLYNOMIAL : 0U);
|
||||
|
||||
CRCTable[i] = Reflect( crc, 32 );
|
||||
CRCTable[i] = Reflect( crc, 32U );
|
||||
}
|
||||
}
|
||||
|
||||
u64 CRC_Calculate( u64 crc, const void * buffer, u32 count )
|
||||
{
|
||||
u8 *p;
|
||||
u32 crc32 = static_cast<u32>(crc);
|
||||
u32 orig = crc32;
|
||||
|
||||
p = (u8*) buffer;
|
||||
const u8 *p = reinterpret_cast<const u8*>(buffer);
|
||||
while (count--)
|
||||
crc32 = (crc32 >> 8) ^ CRCTable[(crc32 & 0xFF) ^ *p++];
|
||||
|
||||
|
@ -47,16 +46,15 @@ u64 CRC_Calculate( u64 crc, const void * buffer, u32 count )
|
|||
|
||||
u32 CRC_Calculate_Strict( u32 crc, const void * buffer, u32 count )
|
||||
{
|
||||
return CRC_Calculate(crc, buffer, count);
|
||||
return static_cast<u32>(CRC_Calculate(crc, buffer, count));
|
||||
}
|
||||
|
||||
u64 CRC_CalculatePalette(u64 crc, const void * buffer, u32 count )
|
||||
{
|
||||
u8 *p;
|
||||
u32 crc32 = static_cast<u32>(crc);
|
||||
u32 orig = crc32;
|
||||
|
||||
p = (u8*) buffer;
|
||||
const u8 *p = reinterpret_cast<const u8*>(buffer);
|
||||
while (count--) {
|
||||
crc32 = (crc32 >> 8) ^ CRCTable[(crc32 & 0xFF) ^ *p++];
|
||||
crc32 = (crc32 >> 8) ^ CRCTable[(crc32 & 0xFF) ^ *p++];
|
||||
|
|
|
@ -51,10 +51,10 @@
|
|||
|
||||
#define EncodeCombineMode( a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \
|
||||
a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1 ) \
|
||||
(u64)(((u64)(_SHIFTL( G_CCMUX_##a0, 20, 4 ) | _SHIFTL( G_CCMUX_##c0, 15, 5 ) | \
|
||||
static_cast<u64>((static_cast<u64>(_SHIFTL( G_CCMUX_##a0, 20, 4 ) | _SHIFTL( G_CCMUX_##c0, 15, 5 ) | \
|
||||
_SHIFTL( G_ACMUX_##Aa0, 12, 3 ) | _SHIFTL( G_ACMUX_##Ac0, 9, 3 ) | \
|
||||
_SHIFTL( G_CCMUX_##a1, 5, 4 ) | _SHIFTL( G_CCMUX_##c1, 0, 5 )) << 32) | \
|
||||
(u64)(_SHIFTL( G_CCMUX_##b0, 28, 4 ) | _SHIFTL( G_CCMUX_##d0, 15, 3 ) | \
|
||||
static_cast<u64>(_SHIFTL( G_CCMUX_##b0, 28, 4 ) | _SHIFTL( G_CCMUX_##d0, 15, 3 ) | \
|
||||
_SHIFTL( G_ACMUX_##Ab0, 12, 3 ) | _SHIFTL( G_ACMUX_##Ad0, 9, 3 ) | \
|
||||
_SHIFTL( G_CCMUX_##b1, 24, 4 ) | _SHIFTL( G_ACMUX_##Aa1, 21, 3 ) | \
|
||||
_SHIFTL( G_ACMUX_##Ac1, 18, 3 ) | _SHIFTL( G_CCMUX_##d1, 6, 3 ) | \
|
||||
|
@ -91,30 +91,32 @@
|
|||
#define G_GCI_ZERO 20
|
||||
#define G_GCI_HALF 21
|
||||
#define G_GCI_HW_LIGHT 22
|
||||
#define G_GCI_HW_LIGHT 22
|
||||
#define G_GCI_LAST 23
|
||||
|
||||
struct CombinerOp
|
||||
{
|
||||
int op = LOAD;
|
||||
int param1 = -1;
|
||||
int param2 = -1;
|
||||
int param3 = -1;
|
||||
u32 op = LOAD;
|
||||
u32 param1 = G_GCI_LAST;
|
||||
u32 param2 = G_GCI_LAST;
|
||||
u32 param3 = G_GCI_LAST;
|
||||
};
|
||||
|
||||
struct CombinerStage
|
||||
{
|
||||
int numOps;
|
||||
u32 numOps;
|
||||
CombinerOp op[6];
|
||||
};
|
||||
|
||||
struct Combiner
|
||||
{
|
||||
int numStages;
|
||||
u32 numStages;
|
||||
CombinerStage stage[2];
|
||||
};
|
||||
|
||||
struct CombineCycle
|
||||
{
|
||||
int sa, sb, m, a;
|
||||
u32 sa, sb, m, a;
|
||||
};
|
||||
|
||||
class CombinerInfo
|
||||
|
|
|
@ -66,7 +66,7 @@ bool CombinerKey::isRectKey() const
|
|||
|
||||
void CombinerKey::read(std::istream & _is)
|
||||
{
|
||||
_is.read((char*)&m_key.mux, sizeof(m_key.mux));
|
||||
_is.read(reinterpret_cast<char*>(&m_key.mux), sizeof(m_key.mux));
|
||||
}
|
||||
|
||||
const CombinerKey & CombinerKey::getEmpty()
|
||||
|
|
|
@ -17,17 +17,6 @@
|
|||
using namespace graphics;
|
||||
|
||||
DepthBuffer::DepthBuffer()
|
||||
: m_address(0)
|
||||
, m_width(0)
|
||||
, m_pDepthImageZTexture(nullptr)
|
||||
, m_pDepthImageDeltaZTexture(nullptr)
|
||||
, m_pDepthBufferTexture(nullptr)
|
||||
, m_depthRenderbufferWidth(0)
|
||||
, m_cleared(false)
|
||||
, m_pResolveDepthBufferTexture(nullptr)
|
||||
, m_resolved(false)
|
||||
, m_pDepthBufferCopyTexture(nullptr)
|
||||
, m_copied(false)
|
||||
{
|
||||
m_copyFBO = gfxContext.createFramebuffer();
|
||||
}
|
||||
|
@ -50,15 +39,15 @@ void DepthBuffer::_initDepthImageTexture(FrameBuffer * _pBuffer, CachedTexture&
|
|||
{
|
||||
const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats();
|
||||
|
||||
_cachedTexture.width = (u32)(_pBuffer->m_pTexture->width);
|
||||
_cachedTexture.height = (u32)(_pBuffer->m_pTexture->height);
|
||||
_cachedTexture.width = _pBuffer->m_pTexture->width;
|
||||
_cachedTexture.height = _pBuffer->m_pTexture->height;
|
||||
_cachedTexture.format = 0;
|
||||
_cachedTexture.size = 2;
|
||||
_cachedTexture.clampS = 1;
|
||||
_cachedTexture.clampT = 1;
|
||||
_cachedTexture.address = _pBuffer->m_startAddress;
|
||||
_cachedTexture.clampWidth = _pBuffer->m_width;
|
||||
_cachedTexture.clampHeight = _pBuffer->m_height;
|
||||
_cachedTexture.clampWidth = static_cast<u16>(_pBuffer->m_width);
|
||||
_cachedTexture.clampHeight = static_cast<u16>(_pBuffer->m_height);
|
||||
_cachedTexture.frameBufferTexture = CachedTexture::fbOneSample;
|
||||
_cachedTexture.maskS = 0;
|
||||
_cachedTexture.maskT = 0;
|
||||
|
@ -117,22 +106,22 @@ void DepthBuffer::_initDepthBufferTexture(const FrameBuffer * _pBuffer, CachedTe
|
|||
const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats();
|
||||
|
||||
if (_pBuffer != nullptr) {
|
||||
_pTexture->width = (u32)(_pBuffer->m_pTexture->width);
|
||||
_pTexture->height = (u32)(_pBuffer->m_pTexture->height);
|
||||
_pTexture->width = _pBuffer->m_pTexture->width;
|
||||
_pTexture->height = _pBuffer->m_pTexture->height;
|
||||
_pTexture->address = _pBuffer->m_startAddress;
|
||||
_pTexture->clampWidth = _pBuffer->m_width;
|
||||
_pTexture->clampHeight = VI_GetMaxBufferHeight(_pBuffer->m_width);
|
||||
_pTexture->clampWidth = static_cast<u16>(_pBuffer->m_width);
|
||||
_pTexture->clampHeight = VI_GetMaxBufferHeight(static_cast<u16>(_pBuffer->m_width));
|
||||
} else {
|
||||
const u16 maxHeight = VI_GetMaxBufferHeight(VI.width);
|
||||
const u16 maxHeight = VI_GetMaxBufferHeight(static_cast<u16>(VI.width));
|
||||
if (config.frameBufferEmulation.nativeResFactor == 0) {
|
||||
_pTexture->width = dwnd().getWidth();
|
||||
_pTexture->height = (u16)(u32)(maxHeight * dwnd().getScaleX());
|
||||
_pTexture->width = static_cast<u16>(dwnd().getWidth());
|
||||
_pTexture->height = static_cast<u16>(static_cast<u32>(static_cast<f32>(maxHeight) * dwnd().getScaleX()));
|
||||
} else {
|
||||
_pTexture->width = VI.width * config.frameBufferEmulation.nativeResFactor;
|
||||
_pTexture->height = maxHeight * config.frameBufferEmulation.nativeResFactor;
|
||||
_pTexture->width = static_cast<u16>(VI.width * config.frameBufferEmulation.nativeResFactor);
|
||||
_pTexture->height = static_cast<u16>(maxHeight * config.frameBufferEmulation.nativeResFactor);
|
||||
}
|
||||
_pTexture->address = gDP.depthImageAddress;
|
||||
_pTexture->clampWidth = VI.width;
|
||||
_pTexture->clampWidth = static_cast<u16>(VI.width);
|
||||
_pTexture->clampHeight = maxHeight;
|
||||
}
|
||||
_pTexture->format = 0;
|
||||
|
@ -175,16 +164,16 @@ void DepthBuffer::_initDepthBufferRenderbuffer(FrameBuffer * _pBuffer)
|
|||
if (m_depthRenderbuffer.isNotNull())
|
||||
return;
|
||||
u32 height;
|
||||
if (_pBuffer != NULL) {
|
||||
m_depthRenderbufferWidth = (u32)(_pBuffer->m_pTexture->width);
|
||||
height = (u32)(_pBuffer->m_pTexture->height);
|
||||
if (_pBuffer != nullptr) {
|
||||
m_depthRenderbufferWidth = _pBuffer->m_pTexture->width;
|
||||
height = _pBuffer->m_pTexture->height;
|
||||
} else {
|
||||
if (config.frameBufferEmulation.nativeResFactor == 0) {
|
||||
m_depthRenderbufferWidth = dwnd().getWidth();
|
||||
height = (u32)(VI_GetMaxBufferHeight(VI.width) * dwnd().getScaleX());
|
||||
height = static_cast<u32>(static_cast<f32>(VI_GetMaxBufferHeight(static_cast<u16>(VI.width))) * dwnd().getScaleX());
|
||||
} else {
|
||||
m_depthRenderbufferWidth = VI.width * config.frameBufferEmulation.nativeResFactor;
|
||||
height = VI_GetMaxBufferHeight(VI.width) * config.frameBufferEmulation.nativeResFactor;
|
||||
height = VI_GetMaxBufferHeight(static_cast<u16>(VI.width)) * config.frameBufferEmulation.nativeResFactor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,7 +351,7 @@ void DepthBuffer::bindDepthImageTexture(ObjectHandle _fbo)
|
|||
DepthBufferList::DepthBufferList() : m_pCurrent(nullptr), m_pzLUT(nullptr)
|
||||
{
|
||||
m_pzLUT = new u16[0x40000];
|
||||
for (int i = 0; i<0x40000; i++) {
|
||||
for (u32 i = 0; i<0x40000; i++) {
|
||||
u32 exponent = 0;
|
||||
u32 testbit = 1 << 17;
|
||||
while ((i & testbit) && (exponent < 7)) {
|
||||
|
@ -371,7 +360,7 @@ DepthBufferList::DepthBufferList() : m_pCurrent(nullptr), m_pzLUT(nullptr)
|
|||
}
|
||||
|
||||
const u32 mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
|
||||
m_pzLUT[i] = (u16)(((exponent << 11) | mantissa) << 2);
|
||||
m_pzLUT[i] = static_cast<u16>(((exponent << 11) | mantissa) << 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,27 +22,28 @@ struct DepthBuffer
|
|||
|
||||
void bindDepthImageTexture(graphics::ObjectHandle _fbo);
|
||||
|
||||
u32 m_address, m_width;
|
||||
bool m_cleared;
|
||||
u32 m_address = 0;
|
||||
u32 m_width = 0;
|
||||
bool m_cleared = false;
|
||||
|
||||
CachedTexture *m_pDepthBufferTexture;
|
||||
CachedTexture *m_pDepthBufferTexture = nullptr;
|
||||
|
||||
graphics::ObjectHandle m_depthRenderbuffer;
|
||||
u32 m_depthRenderbufferWidth;
|
||||
u32 m_depthRenderbufferWidth = 0;
|
||||
|
||||
CachedTexture *m_pDepthImageZTexture;
|
||||
CachedTexture *m_pDepthImageDeltaZTexture;
|
||||
CachedTexture *m_pDepthImageZTexture = nullptr;
|
||||
CachedTexture *m_pDepthImageDeltaZTexture = nullptr;
|
||||
graphics::ObjectHandle m_ZTextureClearFBO;
|
||||
graphics::ObjectHandle m_DeltaZTextureClearFBO;
|
||||
|
||||
// multisampling
|
||||
CachedTexture *m_pResolveDepthBufferTexture;
|
||||
bool m_resolved;
|
||||
CachedTexture *m_pResolveDepthBufferTexture = nullptr;
|
||||
bool m_resolved = false;
|
||||
|
||||
// render to depth buffer
|
||||
graphics::ObjectHandle m_copyFBO;
|
||||
CachedTexture *m_pDepthBufferCopyTexture;
|
||||
bool m_copied;
|
||||
CachedTexture *m_pDepthBufferCopyTexture = nullptr;
|
||||
bool m_copied = false;
|
||||
|
||||
static void copyDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture *& _pTexture, graphics::ObjectHandle _copyFBO);
|
||||
static void _initDepthBufferTexture(const FrameBuffer * _pBuffer, CachedTexture *_pTexture, bool _multisample);
|
||||
|
|
|
@ -208,7 +208,7 @@ void Rasterize(vertexi * vtx, int vertices, int dzdx)
|
|||
int shift;
|
||||
|
||||
const u16 * const zLUT = depthBufferList().getZLUT();
|
||||
const u32 depthBufferWidth = depthBufferList().getCurrent()->m_width;
|
||||
const s32 depthBufferWidth = static_cast<s32>(depthBufferList().getCurrent()->m_width);
|
||||
|
||||
for (;;) {
|
||||
int x1 = iceil(left_x);
|
||||
|
|
|
@ -129,8 +129,8 @@ void DisplayWindow::updateScale()
|
|||
{
|
||||
if (VI.width == 0 || VI.height == 0)
|
||||
return;
|
||||
m_scaleX = m_width / (float)VI.width;
|
||||
m_scaleY = m_height / (float)VI.height;
|
||||
m_scaleX = static_cast<f32>(m_width) / static_cast<f32>(VI.width);
|
||||
m_scaleY = static_cast<f32>(m_height) / static_cast<f32>(VI.height);
|
||||
}
|
||||
|
||||
void DisplayWindow::_setBufferSize()
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "N64.h"
|
||||
#include "RSP.h"
|
||||
#include "RDP.h"
|
||||
#include "gDP.h"
|
||||
#include "VI.h"
|
||||
#include "Textures.h"
|
||||
#include "Combiner.h"
|
||||
|
@ -32,41 +31,12 @@ using namespace std;
|
|||
using namespace graphics;
|
||||
|
||||
FrameBuffer::FrameBuffer()
|
||||
: m_startAddress(0)
|
||||
, m_endAddress(0)
|
||||
, m_size(0)
|
||||
, m_width(0)
|
||||
, m_height(0)
|
||||
, m_originX(0)
|
||||
, m_originY(0)
|
||||
, m_swapCount(0)
|
||||
, m_scale(0)
|
||||
, m_copiedToRdram(false)
|
||||
, m_fingerprint(false)
|
||||
, m_cleared(false)
|
||||
, m_changed(false)
|
||||
, m_cfb(false)
|
||||
, m_isDepthBuffer(false)
|
||||
, m_isPauseScreen(false)
|
||||
, m_isOBScreen(false)
|
||||
, m_isMainBuffer(false)
|
||||
, m_readable(false)
|
||||
, m_loadType(LOADTYPE_BLOCK)
|
||||
, m_pDepthBuffer(nullptr)
|
||||
, m_pResolveTexture(nullptr)
|
||||
, m_resolved(false)
|
||||
, m_pSubTexture(nullptr)
|
||||
, m_copied(false)
|
||||
, m_pFrameBufferCopyTexture(nullptr)
|
||||
, m_copyFBO(ObjectHandle::defaultFramebuffer)
|
||||
, m_validityChecked(0)
|
||||
: m_copyFBO(ObjectHandle::defaultFramebuffer)
|
||||
{
|
||||
m_loadTileOrigin.uls = m_loadTileOrigin.ult = 0;
|
||||
m_pTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0 ?
|
||||
textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D);
|
||||
m_FBO = gfxContext.createFramebuffer();
|
||||
|
||||
m_pDepthTexture = nullptr;
|
||||
if (config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0)
|
||||
m_depthFBO = gfxContext.createFramebuffer();
|
||||
}
|
||||
|
@ -91,8 +61,8 @@ void _initFrameBufferTexture(u32 _address, u16 _width, u16 _height, f32 _scale,
|
|||
{
|
||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||
|
||||
_pTexture->width = (u16)(u32)(_width * _scale);
|
||||
_pTexture->height = (u16)(u32)(_height * _scale);
|
||||
_pTexture->width = static_cast<u16>(static_cast<u32>(static_cast<f32>(_width) * _scale));
|
||||
_pTexture->height = static_cast<u16>(static_cast<u32>(static_cast<f32>(_height) * _scale));
|
||||
_pTexture->format = _format;
|
||||
_pTexture->size = _size;
|
||||
_pTexture->clampS = 1;
|
||||
|
@ -253,7 +223,7 @@ void FrameBuffer::copyRdram()
|
|||
// Validity check will see that the RDRAM is the same and thus the buffer is valid, which is false.
|
||||
const u32 twoPercent = max(4U, dataSize / 200);
|
||||
u32 start = m_startAddress >> 2;
|
||||
u32 * pData = (u32*)RDRAM;
|
||||
u32 * pData = reinterpret_cast<u32*>(RDRAM);
|
||||
for (u32 i = 0; i < twoPercent; ++i) {
|
||||
if (i < 4)
|
||||
pData[start++] = fingerprint[i];
|
||||
|
@ -282,17 +252,17 @@ bool FrameBuffer::isValid(bool _forceCheck) const
|
|||
m_validityChecked = dwnd().getBuffersSwapCount();
|
||||
}
|
||||
|
||||
const u32 * const pData = (const u32*)RDRAM;
|
||||
const u32 * const pData = reinterpret_cast<const u32*>(RDRAM);
|
||||
|
||||
if (m_cleared) {
|
||||
const u32 testColor = m_clearParams.fillcolor & 0xFFFEFFFE;
|
||||
const u32 stride = m_width << m_size >> 1;
|
||||
const s32 lry = (s32)_cutHeight(m_startAddress, m_clearParams.lry, stride);
|
||||
const s32 lry = static_cast<s32>(_cutHeight(m_startAddress, static_cast<u32>(m_clearParams.lry), stride));
|
||||
if (lry == 0)
|
||||
return false;
|
||||
|
||||
const u32 ci_width_in_dwords = m_width >> (3 - m_size);
|
||||
const u32 start = (m_startAddress >> 2) + m_clearParams.uly * ci_width_in_dwords;
|
||||
const u32 start = (m_startAddress >> 2) + static_cast<u32>(m_clearParams.uly) * ci_width_in_dwords;
|
||||
const u32 * dst = pData + start;
|
||||
u32 wrongPixels = 0;
|
||||
for (s32 y = m_clearParams.uly; y < lry; ++y) {
|
||||
|
@ -381,7 +351,7 @@ bool FrameBuffer::_initSubTexture(u32 _t)
|
|||
}
|
||||
|
||||
m_pSubTexture = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D);
|
||||
_initTexture(width, height, m_pTexture->format, m_pTexture->size, m_pSubTexture);
|
||||
_initTexture(static_cast<u16>(width), static_cast<u16>(height), m_pTexture->format, m_pTexture->size, m_pSubTexture);
|
||||
|
||||
m_pSubTexture->clampS = pTile->clamps;
|
||||
m_pSubTexture->clampT = pTile->clampt;
|
||||
|
@ -404,8 +374,8 @@ CachedTexture * FrameBuffer::_getSubTexture(u32 _t)
|
|||
if (!_initSubTexture(_t))
|
||||
return m_pTexture;
|
||||
|
||||
s32 x0 = (s32)(m_pTexture->offsetS * m_scale);
|
||||
s32 y0 = (s32)(m_pTexture->offsetT * m_scale);
|
||||
s32 x0 = static_cast<s32>(m_pTexture->offsetS * m_scale);
|
||||
s32 y0 = static_cast<s32>(m_pTexture->offsetT * m_scale);
|
||||
s32 copyWidth = m_pSubTexture->width;
|
||||
if (x0 + copyWidth > m_pTexture->width)
|
||||
copyWidth = m_pTexture->width - x0;
|
||||
|
@ -448,7 +418,8 @@ void FrameBuffer::_initCopyTexture()
|
|||
m_copyFBO = gfxContext.createFramebuffer();
|
||||
m_pFrameBufferCopyTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0 ?
|
||||
textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D);
|
||||
_initTexture(m_width, VI_GetMaxBufferHeight(m_width), m_pTexture->format, m_pTexture->size, m_pFrameBufferCopyTexture);
|
||||
_initTexture(static_cast<u16>(m_width), VI_GetMaxBufferHeight(static_cast<u16>(m_width)),
|
||||
m_pTexture->format, m_pTexture->size, m_pFrameBufferCopyTexture);
|
||||
_setAndAttachTexture(m_copyFBO, m_pFrameBufferCopyTexture, 0, config.video.multisampling != 0);
|
||||
if (config.video.multisampling != 0)
|
||||
m_pFrameBufferCopyTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
||||
|
@ -503,37 +474,37 @@ CachedTexture * FrameBuffer::getTexture(u32 _t)
|
|||
const u32 shift = (gSP.textureTile[_t]->imageAddress - m_startAddress) >> (m_size - 1);
|
||||
const u32 factor = m_width;
|
||||
if (m_loadType == LOADTYPE_TILE) {
|
||||
pTexture->offsetS = (float)(m_loadTileOrigin.uls + (shift % factor));
|
||||
pTexture->offsetT = (float)(m_loadTileOrigin.ult + shift / factor);
|
||||
pTexture->offsetS = static_cast<f32>(m_loadTileOrigin.uls + (shift % factor));
|
||||
pTexture->offsetT = static_cast<f32>(m_loadTileOrigin.ult + shift / factor);
|
||||
} else {
|
||||
pTexture->offsetS = (float)(shift % factor);
|
||||
pTexture->offsetT = (float)(shift / factor);
|
||||
pTexture->offsetS = static_cast<f32>(shift % factor);
|
||||
pTexture->offsetT = static_cast<f32>(shift / factor);
|
||||
}
|
||||
|
||||
if (!getDepthTexture && (gSP.textureTile[_t]->clamps == 0 || gSP.textureTile[_t]->clampt == 0))
|
||||
pTexture = _getSubTexture(_t);
|
||||
|
||||
pTexture->scaleS = m_scale / (float)pTexture->width;
|
||||
pTexture->scaleT = m_scale / (float)pTexture->height;
|
||||
pTexture->scaleS = m_scale / static_cast<f32>(pTexture->width);
|
||||
pTexture->scaleT = m_scale / static_cast<f32>(pTexture->height);
|
||||
|
||||
if (gSP.textureTile[_t]->shifts > 10)
|
||||
pTexture->shiftScaleS = (float)(1 << (16 - gSP.textureTile[_t]->shifts));
|
||||
pTexture->shiftScaleS = static_cast<f32>(1 << (16 - gSP.textureTile[_t]->shifts));
|
||||
else if (gSP.textureTile[_t]->shifts > 0)
|
||||
pTexture->shiftScaleS = 1.0f / (float)(1 << gSP.textureTile[_t]->shifts);
|
||||
pTexture->shiftScaleS = 1.0f / static_cast<f32>(1 << gSP.textureTile[_t]->shifts);
|
||||
else
|
||||
pTexture->shiftScaleS = 1.0f;
|
||||
|
||||
if (gSP.textureTile[_t]->shiftt > 10)
|
||||
pTexture->shiftScaleT = (float)(1 << (16 - gSP.textureTile[_t]->shiftt));
|
||||
pTexture->shiftScaleT = static_cast<f32>(1 << (16 - gSP.textureTile[_t]->shiftt));
|
||||
else if (gSP.textureTile[_t]->shiftt > 0)
|
||||
pTexture->shiftScaleT = 1.0f / (float)(1 << gSP.textureTile[_t]->shiftt);
|
||||
pTexture->shiftScaleT = 1.0f / static_cast<f32>(1 << gSP.textureTile[_t]->shiftt);
|
||||
else
|
||||
pTexture->shiftScaleT = 1.0f;
|
||||
|
||||
return pTexture;
|
||||
}
|
||||
|
||||
CachedTexture * FrameBuffer::getTextureBG(u32 _t)
|
||||
CachedTexture * FrameBuffer::getTextureBG()
|
||||
{
|
||||
CachedTexture *pTexture = m_pTexture;
|
||||
|
||||
|
@ -544,8 +515,8 @@ CachedTexture * FrameBuffer::getTextureBG(u32 _t)
|
|||
pTexture = _copyFrameBufferTexture();
|
||||
}
|
||||
|
||||
pTexture->scaleS = m_scale / (float)pTexture->width;
|
||||
pTexture->scaleT = m_scale / (float)pTexture->height;
|
||||
pTexture->scaleS = m_scale / static_cast<f32>(pTexture->width);
|
||||
pTexture->scaleT = m_scale / static_cast<f32>(pTexture->height);
|
||||
|
||||
pTexture->shiftScaleS = 1.0f;
|
||||
pTexture->shiftScaleT = 1.0f;
|
||||
|
@ -582,8 +553,8 @@ void FrameBufferList::destroy() {
|
|||
void FrameBufferList::setBufferChanged(f32 _maxY)
|
||||
{
|
||||
gDP.colorImage.changed = TRUE;
|
||||
gDP.colorImage.height = max(gDP.colorImage.height, (u32)_maxY);
|
||||
gDP.colorImage.height = min(gDP.colorImage.height, (u32)gDP.scissor.lry);
|
||||
gDP.colorImage.height = max(gDP.colorImage.height, static_cast<u32>(_maxY));
|
||||
gDP.colorImage.height = min(gDP.colorImage.height, static_cast<u32>(gDP.scissor.lry));
|
||||
if (m_pCurrent != nullptr) {
|
||||
m_pCurrent->m_height = max(m_pCurrent->m_height, gDP.colorImage.height);
|
||||
m_pCurrent->m_cfb = false;
|
||||
|
@ -687,7 +658,7 @@ void FrameBufferList::_createScreenSizeBuffer()
|
|||
return;
|
||||
m_list.emplace_front();
|
||||
FrameBuffer & buffer = m_list.front();
|
||||
buffer.init(VI.width * 2, G_IM_FMT_RGBA, G_IM_SIZ_16b, VI.width, false);
|
||||
buffer.init(VI.width * 2, G_IM_FMT_RGBA, G_IM_SIZ_16b, static_cast<u16>(VI.width), false);
|
||||
}
|
||||
|
||||
void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _width, bool _cfb)
|
||||
|
@ -696,7 +667,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
return;
|
||||
|
||||
if (_width == 512 && (config.generalEmulation.hacks & hack_RE2) != 0)
|
||||
_width = *REG.VI_WIDTH;
|
||||
_width = static_cast<u16>(*REG.VI_WIDTH);
|
||||
|
||||
if (config.frameBufferEmulation.enable == 0) {
|
||||
if (m_list.empty())
|
||||
|
@ -939,7 +910,7 @@ void FrameBufferList::attachDepthBuffer()
|
|||
goodDepthBufferTexture = pDepthBuffer->m_pDepthBufferTexture->width == pCurrent->m_pTexture->width;
|
||||
else
|
||||
goodDepthBufferTexture = pDepthBuffer->m_pDepthBufferTexture->width >= pCurrent->m_pTexture->width ||
|
||||
std::abs((s32)(pCurrent->m_width - pDepthBuffer->m_width)) < 2;
|
||||
std::abs(static_cast<s32>(pCurrent->m_width) - static_cast<s32>(pDepthBuffer->m_width)) < 2;
|
||||
} else {
|
||||
goodDepthBufferTexture = pDepthBuffer->m_depthRenderbufferWidth == pCurrent->m_pTexture->width;
|
||||
}
|
||||
|
@ -1107,8 +1078,8 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
|
|||
s32 vres = delta_y;
|
||||
s32 h_start = x1 - (ispal ? 128 : 108);
|
||||
s32 v_start = (y1 - (ispal ? 44 : 34)) / 2;
|
||||
u32 x_start = _SHIFTR(*REG.VI_X_SCALE, 16, 12);
|
||||
u32 y_start = _SHIFTR(*REG.VI_Y_SCALE, 16, 12);
|
||||
s32 x_start = _SHIFTR(*REG.VI_X_SCALE, 16, 12);
|
||||
s32 y_start = _SHIFTR(*REG.VI_Y_SCALE, 16, 12);
|
||||
|
||||
bool h_start_clamped = h_start < 0;
|
||||
if (h_start < 0) {
|
||||
|
@ -1119,7 +1090,7 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
|
|||
}
|
||||
|
||||
if (v_start < 0) {
|
||||
y_start += (y_add * (u32)(-v_start));
|
||||
y_start += (y_add * (-v_start));
|
||||
v_start = 0;
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1102,7 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
|
|||
if (vres + v_start > PRESCALE_HEIGHT)
|
||||
vres = PRESCALE_HEIGHT - v_start;
|
||||
|
||||
s32 vactivelines = v_sync - (ispal ? 44 : 34);
|
||||
s32 vactivelines = static_cast<s32>(v_sync - (ispal ? 44 : 34));
|
||||
if (vactivelines > PRESCALE_HEIGHT) {
|
||||
LOG(LOG_VERBOSE, "VI_V_SYNC_REG too big");
|
||||
return false;
|
||||
|
@ -1152,15 +1123,15 @@ bool FrameBufferList::RdpUpdate::update(RdpUpdateResult & _result)
|
|||
|
||||
prevwasblank = false;
|
||||
|
||||
_result.vi_hres = hres;
|
||||
_result.vi_vres = vres;
|
||||
_result.vi_hres = static_cast<u32>(hres);
|
||||
_result.vi_vres = static_cast<u32>(vres);
|
||||
_result.vi_ispal = ispal;
|
||||
_result.vi_h_start = h_start;
|
||||
_result.vi_v_start = v_start;
|
||||
_result.vi_x_start = x_start;
|
||||
_result.vi_y_start = y_start;
|
||||
_result.vi_x_add = x_add;
|
||||
_result.vi_y_add = y_add;
|
||||
_result.vi_h_start = static_cast<u32>(h_start);
|
||||
_result.vi_v_start = static_cast<u32>(v_start);
|
||||
_result.vi_x_start = static_cast<u32>(x_start);
|
||||
_result.vi_y_start = static_cast<u32>(y_start);
|
||||
_result.vi_x_add = static_cast<u32>(x_add);
|
||||
_result.vi_y_add = static_cast<u32>(y_add);
|
||||
_result.vi_minhpass = h_start_clamped ? 0 : 8;
|
||||
_result.vi_maxhpass = hres_clamped ? 0 : 7;
|
||||
_result.vi_width = _SHIFTR(*REG.VI_WIDTH, 0, 12);
|
||||
|
@ -1236,7 +1207,7 @@ f32 FrameBufferList::OverscanBuffer::getScaleY(u32 _fullHeight) const
|
|||
if (m_enabled)
|
||||
return m_scale;
|
||||
|
||||
return (float)dwnd().getHeight() / float(_fullHeight);
|
||||
return static_cast<f32>(dwnd().getHeight()) / static_cast<f32>(_fullHeight);
|
||||
}
|
||||
|
||||
void FrameBufferList::OverscanBuffer::init()
|
||||
|
@ -1342,14 +1313,14 @@ void FrameBufferList::OverscanBuffer::draw(u32 _fullHeight, bool _PAL)
|
|||
const s32 bottom = static_cast<s32>(overscan.bottom * m_scale);
|
||||
blitParams.srcX0 = left;
|
||||
blitParams.srcY0 = static_cast<s32>(_fullHeight * m_scale) - bottom;
|
||||
blitParams.srcX1 = m_bufferWidth - right;
|
||||
blitParams.srcX1 = static_cast<s32>(m_bufferWidth) - right;
|
||||
blitParams.srcY1 = top;
|
||||
blitParams.srcWidth = m_pTexture->width;
|
||||
blitParams.srcHeight = m_pTexture->height;
|
||||
blitParams.dstX0 = m_hOffset;
|
||||
blitParams.dstY0 = m_vOffset + wnd.getHeightOffset();
|
||||
blitParams.dstX1 = m_hOffset + wnd.getWidth();
|
||||
blitParams.dstY1 = m_vOffset + wnd.getHeight() + wnd.getHeightOffset();
|
||||
blitParams.dstY0 = m_vOffset + static_cast<s32>(wnd.getHeightOffset());
|
||||
blitParams.dstX1 = m_hOffset + static_cast<s32>(wnd.getWidth());
|
||||
blitParams.dstY1 = m_vOffset + static_cast<s32>(wnd.getHeight() + wnd.getHeightOffset());
|
||||
blitParams.dstWidth = wnd.getScreenWidth();
|
||||
blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset();
|
||||
blitParams.mask = blitMask::COLOR_BUFFER;
|
||||
|
@ -1414,23 +1385,23 @@ void FrameBufferList::renderBuffer()
|
|||
s32 srcPartHeight = 0;
|
||||
s32 dstPartHeight = 0;
|
||||
|
||||
dstY0 = rdpRes.vi_v_start;
|
||||
dstY0 = static_cast<s32>(rdpRes.vi_v_start);
|
||||
|
||||
const u32 vFullHeight = rdpRes.vi_ispal ? 288 : 240;
|
||||
const f32 dstScaleY = m_overscan.getScaleY(vFullHeight);
|
||||
|
||||
const u32 addrOffset = ((rdpRes.vi_origin - pBuffer->m_startAddress) << 1 >> pBuffer->m_size);
|
||||
srcY0 = addrOffset / pBuffer->m_width;
|
||||
srcY0 = static_cast<s32>(addrOffset / pBuffer->m_width);
|
||||
if ((addrOffset != 0) && (pBuffer->m_width == addrOffset * 2))
|
||||
srcY0 = 1;
|
||||
|
||||
if ((rdpRes.vi_width != addrOffset * 2) && (addrOffset % rdpRes.vi_width != 0))
|
||||
XoffsetRight = rdpRes.vi_width - addrOffset % rdpRes.vi_width;
|
||||
if (XoffsetRight == pBuffer->m_width) {
|
||||
XoffsetRight = static_cast<s32>(rdpRes.vi_width - addrOffset % rdpRes.vi_width);
|
||||
if (XoffsetRight == static_cast<s32>(pBuffer->m_width)) {
|
||||
XoffsetRight = 0;
|
||||
} else if (XoffsetRight > static_cast<s32>(pBuffer->m_width / 2)) {
|
||||
XoffsetRight = 0;
|
||||
XoffsetLeft = addrOffset % rdpRes.vi_width;
|
||||
XoffsetLeft = static_cast<s32>(addrOffset % rdpRes.vi_width);
|
||||
}
|
||||
|
||||
if (!rdpRes.vi_lowerfield) {
|
||||
|
@ -1445,8 +1416,8 @@ void FrameBufferList::renderBuffer()
|
|||
XoffsetRight = XoffsetLeft = 0;
|
||||
}
|
||||
|
||||
srcWidth = min(rdpRes.vi_width, (rdpRes.vi_hres * rdpRes.vi_x_add) >> 10);
|
||||
srcHeight = rdpRes.vi_width * ((rdpRes.vi_vres*rdpRes.vi_y_add + rdpRes.vi_y_start) >> 10) / pBuffer->m_width;
|
||||
srcWidth = static_cast<s32>(min(rdpRes.vi_width, (rdpRes.vi_hres * rdpRes.vi_x_add) >> 10));
|
||||
srcHeight = static_cast<s32>(rdpRes.vi_width * ((rdpRes.vi_vres*rdpRes.vi_y_add + rdpRes.vi_y_start) >> 10) / pBuffer->m_width);
|
||||
|
||||
const u32 stride = pBuffer->m_width << pBuffer->m_size >> 1;
|
||||
FrameBuffer *pNextBuffer = findBuffer(rdpRes.vi_origin + stride * min(u32(srcHeight) - 1, pBuffer->m_height - 1) - 1);
|
||||
|
@ -1457,9 +1428,9 @@ void FrameBufferList::renderBuffer()
|
|||
dstPartHeight = srcY0;
|
||||
srcPartHeight = srcY0;
|
||||
srcY1 = srcHeight;
|
||||
dstY1 = dstY0 + rdpRes.vi_vres - dstPartHeight;
|
||||
dstY1 = dstY0 + static_cast<s32>(rdpRes.vi_vres) - dstPartHeight;
|
||||
} else {
|
||||
dstY1 = dstY0 + rdpRes.vi_vres;
|
||||
dstY1 = dstY0 + static_cast<s32>(rdpRes.vi_vres);
|
||||
srcY1 = srcY0 + srcHeight;
|
||||
}
|
||||
PostProcessor & postProcessor = PostProcessor::get();
|
||||
|
@ -1470,22 +1441,22 @@ void FrameBufferList::renderBuffer()
|
|||
const f32 viScaleX = _FIXED2FLOAT(_SHIFTR(*REG.VI_X_SCALE, 0, 12), 10);
|
||||
const f32 srcScaleX = pFilteredBuffer->m_scale;
|
||||
const f32 dstScaleX = m_overscan.getDrawingWidth() / (640 * viScaleX);
|
||||
const s32 hx0 = rdpRes.vi_h_start + rdpRes.vi_minhpass;
|
||||
const s32 hx0 = static_cast<s32>(rdpRes.vi_h_start + rdpRes.vi_minhpass);
|
||||
const s32 h0 = (rdpRes.vi_ispal ? 128 : 108);
|
||||
const s32 hEnd = _SHIFTR(*REG.VI_H_START, 0, 10);
|
||||
const s32 hx1 = max(0, h0 + 640 - hEnd + (s32)rdpRes.vi_maxhpass);
|
||||
const s32 hx1 = max(0, h0 + 640 - hEnd + static_cast<s32>(rdpRes.vi_maxhpass));
|
||||
//const s32 hx1 = hx0 + rdpRes.vi_hres;
|
||||
dstX0 = (s32)((hx0 * viScaleX + f32(XoffsetRight)) * dstScaleX);
|
||||
dstX1 = m_overscan.getDrawingWidth() - (s32)(hx1 * viScaleX * dstScaleX);
|
||||
dstX0 = static_cast<s32>((hx0 * viScaleX + f32(XoffsetRight)) * dstScaleX);
|
||||
dstX1 = static_cast<s32>(m_overscan.getDrawingWidth()) - static_cast<s32>(hx1 * viScaleX * dstScaleX);
|
||||
|
||||
const f32 srcScaleY = pFilteredBuffer->m_scale;
|
||||
CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture;
|
||||
const s32 cutleft = static_cast<s32>(rdpRes.vi_minhpass * viScaleX * srcScaleX);
|
||||
const s32 cutright = static_cast<s32>(rdpRes.vi_maxhpass * viScaleX * srcScaleX);
|
||||
s32 srcCoord[4] = { (s32)((XoffsetLeft) * srcScaleX) + cutleft,
|
||||
(s32)(srcY0*srcScaleY),
|
||||
(s32)((srcWidth + XoffsetLeft - XoffsetRight) * srcScaleX) - cutright,
|
||||
min((s32)(srcY1*srcScaleY), (s32)pBufferTexture->height) };
|
||||
s32 srcCoord[4] = { static_cast<s32>((XoffsetLeft) * srcScaleX) + cutleft,
|
||||
static_cast<s32>(srcY0*srcScaleY),
|
||||
static_cast<s32>((srcWidth + XoffsetLeft - XoffsetRight) * srcScaleX) - cutright,
|
||||
min(static_cast<s32>(srcY1*srcScaleY), static_cast<s32>(pBufferTexture->height)) };
|
||||
if (srcCoord[2] > pBufferTexture->width || srcCoord[3] > pBufferTexture->height) {
|
||||
removeBuffer(pBuffer->m_startAddress);
|
||||
return;
|
||||
|
@ -1494,9 +1465,9 @@ void FrameBufferList::renderBuffer()
|
|||
const s32 hOffset = m_overscan.getHOffset();
|
||||
const s32 vOffset = m_overscan.getVOffset();
|
||||
s32 dstCoord[4] = { dstX0 + hOffset,
|
||||
vOffset + (s32)(dstY0*dstScaleY),
|
||||
vOffset + static_cast<s32>(dstY0*dstScaleY),
|
||||
hOffset + dstX1,
|
||||
vOffset + (s32)(dstY1*dstScaleY) };
|
||||
vOffset + static_cast<s32>(dstY1*dstScaleY) };
|
||||
|
||||
ObjectHandle readBuffer;
|
||||
|
||||
|
@ -1566,11 +1537,11 @@ void FrameBufferList::renderBuffer()
|
|||
}
|
||||
|
||||
blitParams.srcY0 = 0;
|
||||
blitParams.srcY1 = min((s32)(srcY1*srcScaleY), (s32)pFilteredBuffer->m_pTexture->height);
|
||||
blitParams.srcY1 = min(static_cast<s32>(srcY1*srcScaleY), static_cast<s32>(pFilteredBuffer->m_pTexture->height));
|
||||
blitParams.srcWidth = pBufferTexture->width;
|
||||
blitParams.srcHeight = pBufferTexture->height;
|
||||
blitParams.dstY0 = vOffset + (s32)(dstY0*dstScaleY);
|
||||
blitParams.dstY1 = vOffset + (s32)(dstY1*dstScaleY);
|
||||
blitParams.dstY0 = vOffset + static_cast<s32>(dstY0*dstScaleY);
|
||||
blitParams.dstY1 = vOffset + static_cast<s32>(dstY1*dstScaleY);
|
||||
blitParams.dstWidth = m_overscan.getBufferWidth();
|
||||
blitParams.dstHeight = m_overscan.getBufferHeight();
|
||||
blitParams.tex[0] = pBufferTexture;
|
||||
|
@ -1593,9 +1564,9 @@ void FrameBufferList::renderBuffer()
|
|||
}
|
||||
|
||||
const s32 X = hOffset;
|
||||
const s32 Y = wnd.getHeightOffset();
|
||||
const s32 W = wnd.getWidth();
|
||||
const s32 H = wnd.getHeight();
|
||||
const s32 Y = static_cast<s32>(wnd.getHeightOffset());
|
||||
const s32 W = static_cast<s32>(wnd.getWidth());
|
||||
const s32 H = static_cast<s32>(wnd.getHeight());
|
||||
|
||||
gfxContext.setScissor(X, Y, W, H);
|
||||
gDP.changed |= CHANGED_SCISSOR;
|
||||
|
@ -1610,20 +1581,20 @@ void FrameBufferList::fillRDRAM(s32 ulx, s32 uly, s32 lrx, s32 lry)
|
|||
// Do not write to RDRAM color buffer if copyFromRDRAM enabled.
|
||||
return;
|
||||
|
||||
ulx = (s32)min(max((float)ulx, gDP.scissor.ulx), gDP.scissor.lrx);
|
||||
lrx = (s32)min(max((float)lrx, gDP.scissor.ulx), gDP.scissor.lrx);
|
||||
uly = (s32)min(max((float)uly, gDP.scissor.uly), gDP.scissor.lry);
|
||||
lry = (s32)min(max((float)lry, gDP.scissor.uly), gDP.scissor.lry);
|
||||
ulx = static_cast<s32>(min(max(static_cast<f32>(ulx), gDP.scissor.ulx), gDP.scissor.lrx));
|
||||
lrx = static_cast<s32>(min(max(static_cast<f32>(lrx), gDP.scissor.ulx), gDP.scissor.lrx));
|
||||
uly = static_cast<s32>(min(max(static_cast<f32>(uly), gDP.scissor.uly), gDP.scissor.lry));
|
||||
lry = static_cast<s32>(min(max(static_cast<f32>(lry), gDP.scissor.uly), gDP.scissor.lry));
|
||||
|
||||
const u32 stride = gDP.colorImage.width << gDP.colorImage.size >> 1;
|
||||
const u32 lowerBound = gDP.colorImage.address + lry*stride;
|
||||
const u32 lowerBound = gDP.colorImage.address + static_cast<u32>(lry)*stride;
|
||||
if (lowerBound > RDRAMSize)
|
||||
lry -= (lowerBound - RDRAMSize) / stride;
|
||||
u32 ci_width_in_dwords = gDP.colorImage.width >> (3 - gDP.colorImage.size);
|
||||
ulx >>= (3 - gDP.colorImage.size);
|
||||
lrx >>= (3 - gDP.colorImage.size);
|
||||
u32 * dst = (u32*)(RDRAM + gDP.colorImage.address);
|
||||
dst += uly * ci_width_in_dwords;
|
||||
u32 * dst = reinterpret_cast<u32*>(RDRAM + gDP.colorImage.address);
|
||||
dst += static_cast<u32>(uly) * ci_width_in_dwords;
|
||||
if (!isMemoryWritable(dst, lowerBound - gDP.colorImage.address))
|
||||
return;
|
||||
for (s32 y = uly; y < lry; ++y) {
|
||||
|
@ -1657,7 +1628,7 @@ void FrameBuffer_ActivateBufferTextureBG(u32 t, u32 _frameBufferAddress)
|
|||
if (pBuffer == nullptr)
|
||||
return;
|
||||
|
||||
CachedTexture *pTexture = pBuffer->getTextureBG(t);
|
||||
CachedTexture *pTexture = pBuffer->getTextureBG();
|
||||
if (pTexture == nullptr)
|
||||
return;
|
||||
|
||||
|
@ -1719,7 +1690,7 @@ u32 cutHeight(u32 _address, u32 _height, u32 _stride)
|
|||
void calcCoordsScales(const FrameBuffer * _pBuffer, f32 & _scaleX, f32 & _scaleY)
|
||||
{
|
||||
const u32 bufferWidth = _pBuffer != nullptr ? _pBuffer->m_width : VI.width;
|
||||
const u32 bufferHeight = VI_GetMaxBufferHeight(bufferWidth);
|
||||
const u32 bufferHeight = VI_GetMaxBufferHeight(static_cast<u16>(bufferWidth));
|
||||
_scaleX = 1.0f / f32(bufferWidth);
|
||||
_scaleY = 1.0f / f32(bufferHeight);
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "Types.h"
|
||||
#include "gDP.h"
|
||||
#include "Textures.h"
|
||||
#include "Graphics/ObjectHandle.h"
|
||||
|
||||
struct gDPTile;
|
||||
struct DepthBuffer;
|
||||
|
||||
const int fingerprint[4] = { 2, 6, 4, 3 };
|
||||
const u32 fingerprint[4] = { 2, 6, 4, 3 };
|
||||
|
||||
struct FrameBuffer
|
||||
{
|
||||
|
@ -22,59 +22,60 @@ struct FrameBuffer
|
|||
void resolveMultisampledTexture(bool _bForce = false);
|
||||
void copyDepthTexture();
|
||||
CachedTexture * getTexture(u32 _t);
|
||||
CachedTexture * getTextureBG(u32 _t);
|
||||
CachedTexture * getTextureBG();
|
||||
void setBufferClearParams(u32 _fillcolor, s32 _ulx, s32 _uly, s32 _lrx, s32 _lry);
|
||||
void copyRdram();
|
||||
void setDirty();
|
||||
bool isValid(bool _forceCheck) const;
|
||||
bool isAuxiliary() const;
|
||||
|
||||
u32 m_startAddress;
|
||||
u32 m_endAddress;
|
||||
u32 m_size;
|
||||
u32 m_width;
|
||||
u32 m_height;
|
||||
u32 m_originX;
|
||||
u32 m_originY;
|
||||
u32 m_swapCount;
|
||||
float m_scale;
|
||||
bool m_copiedToRdram;
|
||||
bool m_fingerprint;
|
||||
bool m_cleared;
|
||||
bool m_changed;
|
||||
bool m_cfb;
|
||||
bool m_isDepthBuffer;
|
||||
bool m_isPauseScreen;
|
||||
bool m_isOBScreen;
|
||||
bool m_isMainBuffer;
|
||||
bool m_readable;
|
||||
bool m_copied;
|
||||
u32 m_startAddress = 0;
|
||||
u32 m_endAddress = 0;
|
||||
u32 m_size = 0;
|
||||
u32 m_width = 0;
|
||||
u32 m_height = 0;
|
||||
u32 m_originX = 0;
|
||||
u32 m_originY = 0;
|
||||
u32 m_swapCount = 0;
|
||||
float m_scale = 0.0f;
|
||||
bool m_copiedToRdram = false;
|
||||
bool m_fingerprint = false;
|
||||
bool m_cleared = false;
|
||||
bool m_changed = false;
|
||||
bool m_cfb = false;
|
||||
bool m_isDepthBuffer = false;
|
||||
bool m_isPauseScreen = false;
|
||||
bool m_isOBScreen = false;
|
||||
bool m_isMainBuffer = false;
|
||||
bool m_readable = false;
|
||||
bool m_copied = false;
|
||||
|
||||
struct {
|
||||
u32 uls, ult;
|
||||
u32 uls = 0;
|
||||
u32 ult = 0;;
|
||||
} m_loadTileOrigin;
|
||||
u32 m_loadType;
|
||||
u32 m_loadType = LOADTYPE_BLOCK;
|
||||
|
||||
graphics::ObjectHandle m_FBO;
|
||||
CachedTexture *m_pTexture;
|
||||
CachedTexture *m_pTexture = nullptr;
|
||||
|
||||
graphics::ObjectHandle m_depthFBO;
|
||||
CachedTexture *m_pDepthTexture;
|
||||
CachedTexture *m_pDepthTexture = nullptr;
|
||||
|
||||
DepthBuffer *m_pDepthBuffer;
|
||||
DepthBuffer *m_pDepthBuffer = nullptr;
|
||||
|
||||
// multisampling
|
||||
graphics::ObjectHandle m_resolveFBO;
|
||||
CachedTexture *m_pResolveTexture;
|
||||
bool m_resolved;
|
||||
CachedTexture *m_pResolveTexture = nullptr;
|
||||
bool m_resolved = false;
|
||||
|
||||
// subtexture
|
||||
graphics::ObjectHandle m_SubFBO;
|
||||
CachedTexture *m_pSubTexture;
|
||||
CachedTexture *m_pSubTexture = nullptr;
|
||||
|
||||
// copy FBO
|
||||
graphics::ObjectHandle m_copyFBO;
|
||||
CachedTexture * m_pFrameBufferCopyTexture;
|
||||
CachedTexture * m_pFrameBufferCopyTexture = nullptr;
|
||||
|
||||
std::vector<u8> m_RdramCopy;
|
||||
|
||||
|
@ -94,7 +95,7 @@ private:
|
|||
CachedTexture * _copyFrameBufferTexture();
|
||||
CachedTexture * _getSubTexture(u32 _t);
|
||||
|
||||
mutable u32 m_validityChecked;
|
||||
mutable u32 m_validityChecked = false;
|
||||
};
|
||||
|
||||
class FrameBufferList
|
||||
|
|
|
@ -56,21 +56,21 @@
|
|||
#define FIXED2FLOATRECIP16 1.52587890625e-05f
|
||||
|
||||
#define _FIXED2FLOAT( v, b ) \
|
||||
((f32)v * FIXED2FLOATRECIP##b)
|
||||
(static_cast<f32>(v) * FIXED2FLOATRECIP##b)
|
||||
|
||||
#define FIXED2FLOATRECIPCOLOR5 3.22580635547637939453125e-02f
|
||||
#define FIXED2FLOATRECIPCOLOR7 7.8740157186985015869140625e-03f
|
||||
#define FIXED2FLOATRECIPCOLOR8 3.9215688593685626983642578125e-03f
|
||||
|
||||
#define _FIXED2FLOATCOLOR( v, b ) \
|
||||
((f32)v * FIXED2FLOATRECIPCOLOR##b)
|
||||
(static_cast<f32>(v) * FIXED2FLOATRECIPCOLOR##b)
|
||||
|
||||
|
||||
// Useful macros for decoding GBI command's parameters
|
||||
#define _SHIFTL( v, s, w ) \
|
||||
(((u32)v & ((0x01 << w) - 1)) << s)
|
||||
((static_cast<u32>(v) & ((0x01 << w) - 1)) << s)
|
||||
#define _SHIFTR( v, s, w ) \
|
||||
(((u32)v >> s) & ((0x01 << w) - 1))
|
||||
((static_cast<u32>(v) >> s) & ((0x01 << w) - 1))
|
||||
|
||||
// These are all the constant flags
|
||||
#define G_ZBUFFER 0x00000001
|
||||
|
|
|
@ -40,7 +40,7 @@ bool CombinerInputs::usesHwLighting() const
|
|||
return (m_inputs & (1 << G_GCI_HW_LIGHT)) != 0;
|
||||
}
|
||||
|
||||
void CombinerInputs::addInput(int _input)
|
||||
void CombinerInputs::addInput(u32 _input)
|
||||
{
|
||||
m_inputs |= 1 << _input;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace glsl {
|
|||
|
||||
bool usesHwLighting() const;
|
||||
|
||||
void addInput(int _input);
|
||||
void addInput(u32 _input);
|
||||
|
||||
void operator+=(const CombinerInputs & _other);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ const char *AlphaInput[] = {
|
|||
};
|
||||
|
||||
inline
|
||||
int correctFirstStageParam(int _param)
|
||||
u32 correctFirstStageParam(u32 _param)
|
||||
{
|
||||
switch (_param) {
|
||||
case G_GCI_TEXEL1:
|
||||
|
@ -109,7 +109,7 @@ int correctFirstStageParam(int _param)
|
|||
static
|
||||
void _correctFirstStageParams(CombinerStage & _stage)
|
||||
{
|
||||
for (int i = 0; i < _stage.numOps; ++i) {
|
||||
for (u32 i = 0; i < _stage.numOps; ++i) {
|
||||
_stage.op[i].param1 = correctFirstStageParam(_stage.op[i].param1);
|
||||
_stage.op[i].param2 = correctFirstStageParam(_stage.op[i].param2);
|
||||
_stage.op[i].param3 = correctFirstStageParam(_stage.op[i].param3);
|
||||
|
@ -117,7 +117,7 @@ void _correctFirstStageParams(CombinerStage & _stage)
|
|||
}
|
||||
|
||||
inline
|
||||
int correctFirstStageParam2Cyc(int _param)
|
||||
u32 correctFirstStageParam2Cyc(u32 _param)
|
||||
{
|
||||
switch (_param) {
|
||||
case G_GCI_COMBINED:
|
||||
|
@ -129,7 +129,7 @@ int correctFirstStageParam2Cyc(int _param)
|
|||
static
|
||||
void _correctFirstStageParams2Cyc(CombinerStage & _stage)
|
||||
{
|
||||
for (int i = 0; i < _stage.numOps; ++i) {
|
||||
for (u32 i = 0; i < _stage.numOps; ++i) {
|
||||
_stage.op[i].param1 = correctFirstStageParam2Cyc(_stage.op[i].param1);
|
||||
_stage.op[i].param2 = correctFirstStageParam2Cyc(_stage.op[i].param2);
|
||||
_stage.op[i].param3 = correctFirstStageParam2Cyc(_stage.op[i].param3);
|
||||
|
@ -137,7 +137,7 @@ void _correctFirstStageParams2Cyc(CombinerStage & _stage)
|
|||
}
|
||||
|
||||
inline
|
||||
int correctSecondStageParam(int _param)
|
||||
u32 correctSecondStageParam(u32 _param)
|
||||
{
|
||||
switch (_param) {
|
||||
case G_GCI_TEXEL0:
|
||||
|
@ -154,7 +154,7 @@ int correctSecondStageParam(int _param)
|
|||
|
||||
static
|
||||
void _correctSecondStageParams(CombinerStage & _stage) {
|
||||
for (int i = 0; i < _stage.numOps; ++i) {
|
||||
for (u32 i = 0; i < _stage.numOps; ++i) {
|
||||
_stage.op[i].param1 = correctSecondStageParam(_stage.op[i].param1);
|
||||
_stage.op[i].param2 = correctSecondStageParam(_stage.op[i].param2);
|
||||
_stage.op[i].param3 = correctSecondStageParam(_stage.op[i].param3);
|
||||
|
@ -165,7 +165,7 @@ static
|
|||
CombinerInputs _compileCombiner(const CombinerStage & _stage, const char** _Input, std::stringstream & _strShader) {
|
||||
bool bBracketOpen = false;
|
||||
CombinerInputs inputs;
|
||||
for (int i = 0; i < _stage.numOps; ++i) {
|
||||
for (u32 i = 0; i < _stage.numOps; ++i) {
|
||||
switch (_stage.op[i].op) {
|
||||
case LOAD:
|
||||
// sprintf(buf, "(%s ", _Input[_stage.op[i].param1]);
|
||||
|
@ -2162,7 +2162,7 @@ public:
|
|||
class ShaderCalcLight : public ShaderPart
|
||||
{
|
||||
public:
|
||||
ShaderCalcLight(const opengl::GLInfo & _glinfo)
|
||||
ShaderCalcLight(const opengl::GLInfo & /*_glinfo*/)
|
||||
{
|
||||
m_part =
|
||||
"uniform mediump vec3 uLightDirection[8]; \n"
|
||||
|
@ -2714,7 +2714,7 @@ CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key,
|
|||
m_legacyBlender->write(ssShader);
|
||||
}
|
||||
|
||||
_strShader = std::move(ssShader.str());
|
||||
_strShader = ssShader.str();
|
||||
return inputs;
|
||||
}
|
||||
|
||||
|
@ -2856,7 +2856,7 @@ graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combine
|
|||
|
||||
m_shaderN64DepthRender->write(ssShader);
|
||||
|
||||
const std::string strFragmentShader(std::move(ssShader.str()));
|
||||
const std::string strFragmentShader(ssShader.str());
|
||||
|
||||
/* Create shader program */
|
||||
|
||||
|
@ -2910,7 +2910,7 @@ GLuint _createVertexShader(ShaderPart * _header, ShaderPart * _body, ShaderPart
|
|||
_header->write(ssShader);
|
||||
_body->write(ssShader);
|
||||
_footer->write(ssShader);
|
||||
const std::string strShader(std::move(ssShader.str()));
|
||||
const std::string strShader(ssShader.str());
|
||||
const GLchar * strShaderData = strShader.data();
|
||||
|
||||
GLuint shader_object = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace glsl {
|
|||
class ShaderPart
|
||||
{
|
||||
public:
|
||||
virtual ~ShaderPart() {}
|
||||
virtual void write(std::stringstream & shader) const
|
||||
{
|
||||
shader << m_part;
|
||||
|
|
|
@ -485,7 +485,6 @@ void ContextImpl::drawLine(f32 _width, SPVertex * _vertices)
|
|||
m_graphicsDrawer->drawLine(_width, _vertices);
|
||||
}
|
||||
|
||||
|
||||
f32 ContextImpl::getMaxLineWidth()
|
||||
{
|
||||
GLfloat lineWidthRange[2] = { 0.0f, 0.0f };
|
||||
|
|
|
@ -44,12 +44,12 @@ GraphicsDrawer::~GraphicsDrawer()
|
|||
std::this_thread::sleep_for(Milliseconds(1));
|
||||
}
|
||||
|
||||
void GraphicsDrawer::addTriangle(int _v0, int _v1, int _v2)
|
||||
void GraphicsDrawer::addTriangle(u32 _v0, u32 _v1, u32 _v2)
|
||||
{
|
||||
const u32 firstIndex = triangles.num;
|
||||
triangles.elements[triangles.num++] = _v0;
|
||||
triangles.elements[triangles.num++] = _v1;
|
||||
triangles.elements[triangles.num++] = _v2;
|
||||
triangles.elements[triangles.num++] = static_cast<u16>(_v0);
|
||||
triangles.elements[triangles.num++] = static_cast<u16>(_v1);
|
||||
triangles.elements[triangles.num++] = static_cast<u16>(_v2);
|
||||
triangles.maxElement = std::max(triangles.maxElement, _v0);
|
||||
triangles.maxElement = std::max(triangles.maxElement, _v1);
|
||||
triangles.maxElement = std::max(triangles.maxElement, _v2);
|
||||
|
@ -242,8 +242,8 @@ float _adjustViewportX(f32 _X0)
|
|||
inline
|
||||
void _adjustViewportToClipRatio(s32 & x, s32 & y, s32 & width, s32 & height)
|
||||
{
|
||||
x -= (gSP.clipRatio - 1) * width / 2;
|
||||
y -= (gSP.clipRatio - 1) * height / 2;
|
||||
x -= static_cast<s32>(gSP.clipRatio - 1) * width / 2;
|
||||
y -= static_cast<s32>(gSP.clipRatio - 1) * height / 2;
|
||||
width *= gSP.clipRatio;
|
||||
height *= gSP.clipRatio;
|
||||
}
|
||||
|
@ -259,10 +259,10 @@ void GraphicsDrawer::_updateViewport() const
|
|||
float Xf = gSP.viewport.vscale[0] < 0 ? (gSP.viewport.x + gSP.viewport.vscale[0] * 2.0f) : gSP.viewport.x;
|
||||
if (_needAdjustCoordinate(wnd))
|
||||
Xf = _adjustViewportX(Xf);
|
||||
s32 X = (s32)(Xf * scaleX);
|
||||
s32 Y = (s32)(gSP.viewport.y * scaleY);
|
||||
s32 WIDTH = std::max((s32)(gSP.viewport.width * scaleX), 0);
|
||||
s32 HEIGHT = std::max((s32)(gSP.viewport.height * scaleY), 0);
|
||||
s32 X = static_cast<s32>(Xf * scaleX);
|
||||
s32 Y = static_cast<s32>(gSP.viewport.y * scaleY);
|
||||
s32 WIDTH = std::max(static_cast<s32>(gSP.viewport.width * scaleX), 0);
|
||||
s32 HEIGHT = std::max(static_cast<s32>(gSP.viewport.height * scaleY), 0);
|
||||
_adjustViewportToClipRatio(X, Y, WIDTH, HEIGHT);
|
||||
gfxContext.setViewport(X, Y, WIDTH, HEIGHT);
|
||||
} else {
|
||||
|
@ -299,11 +299,11 @@ void GraphicsDrawer::_updateScreenCoordsViewport(const FrameBuffer * _pBuffer) c
|
|||
viewportScaleY = wnd.getScaleY();
|
||||
} else {
|
||||
bufferWidth = pCurrentBuffer->m_width;
|
||||
bufferHeight = VI_GetMaxBufferHeight(bufferWidth);
|
||||
bufferHeight = VI_GetMaxBufferHeight(static_cast<u16>(bufferWidth));
|
||||
viewportScaleX = viewportScaleY = pCurrentBuffer->m_scale;
|
||||
X = roundup(f32(pCurrentBuffer->m_originX), viewportScaleX);
|
||||
Y = roundup(f32(pCurrentBuffer->m_originY), viewportScaleY);
|
||||
if (RSP.LLE || gSP.viewport.width == 0) {
|
||||
if (RSP.LLE || gSP.viewport.width == 0.0f) {
|
||||
gSP.viewport.width = f32(bufferWidth);
|
||||
gSP.viewport.height = f32(bufferHeight);
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ void GraphicsDrawer::drawDMATriangles(u32 _numVtx)
|
|||
}
|
||||
}
|
||||
|
||||
void GraphicsDrawer::_drawThickLine(int _v0, int _v1, float _width)
|
||||
void GraphicsDrawer::_drawThickLine(u32 _v0, u32 _v1, float _width)
|
||||
{
|
||||
if ((gSP.geometryMode & G_LIGHTING) == 0) {
|
||||
if ((gSP.geometryMode & G_SHADE) == 0) {
|
||||
|
@ -965,13 +965,11 @@ void GraphicsDrawer::_drawThickLine(int _v0, int _v1, float _width)
|
|||
const f32 Y = pVtx[0].y;
|
||||
pVtx[0].y = pVtx[2].y = Y - _width;
|
||||
pVtx[1].y = pVtx[3].y = Y + _width;
|
||||
}
|
||||
else if (fabs(pVtx[0].x - pVtx[2].x) < 0.0001) {
|
||||
} else if (fabs(pVtx[0].x - pVtx[2].x) < 0.0001) {
|
||||
const f32 X = pVtx[0].x;
|
||||
pVtx[0].x = pVtx[2].x = X - _width;
|
||||
pVtx[1].x = pVtx[3].x = X + _width;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
const f32 X0 = pVtx[0].x;
|
||||
const f32 Y0 = pVtx[0].y;
|
||||
const f32 X1 = pVtx[2].x;
|
||||
|
@ -993,7 +991,7 @@ void GraphicsDrawer::_drawThickLine(int _v0, int _v1, float _width)
|
|||
drawScreenSpaceTriangle(4);
|
||||
}
|
||||
|
||||
void GraphicsDrawer::drawLine(int _v0, int _v1, float _width)
|
||||
void GraphicsDrawer::drawLine(u32 _v0, u32 _v1, float _width)
|
||||
{
|
||||
m_texrectDrawer.draw();
|
||||
|
||||
|
@ -1047,16 +1045,16 @@ void GraphicsDrawer::drawRect(int _ulx, int _uly, int _lrx, int _lry)
|
|||
calcCoordsScales(frameBufferList().getCurrent(), scaleX, scaleY);
|
||||
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f;
|
||||
const float W = 1.0f;
|
||||
m_rect[0].x = (float)_ulx * (2.0f * scaleX) - 1.0f;
|
||||
m_rect[0].y = (float)_uly * (2.0f * scaleY) - 1.0f;
|
||||
m_rect[0].x = static_cast<f32>(_ulx) * (2.0f * scaleX) - 1.0f;
|
||||
m_rect[0].y = static_cast<f32>(_uly) * (2.0f * scaleY) - 1.0f;
|
||||
m_rect[0].z = Z;
|
||||
m_rect[0].w = W;
|
||||
m_rect[1].x = (float)_lrx * (2.0f * scaleX) - 1.0f;
|
||||
m_rect[1].x = static_cast<f32>(_lrx) * (2.0f * scaleX) - 1.0f;
|
||||
m_rect[1].y = m_rect[0].y;
|
||||
m_rect[1].z = Z;
|
||||
m_rect[1].w = W;
|
||||
m_rect[2].x = m_rect[0].x;
|
||||
m_rect[2].y = (float)_lry * (2.0f * scaleY) - 1.0f;
|
||||
m_rect[2].y = static_cast<f32>(_lry) * (2.0f * scaleY) - 1.0f;
|
||||
m_rect[2].z = Z;
|
||||
m_rect[2].w = W;
|
||||
m_rect[3].x = m_rect[1].x;
|
||||
|
@ -1065,7 +1063,7 @@ void GraphicsDrawer::drawRect(int _ulx, int _uly, int _lrx, int _lry)
|
|||
m_rect[3].w = W;
|
||||
|
||||
DisplayWindow & wnd = dwnd();
|
||||
if (wnd.isAdjustScreen() && (gDP.colorImage.width > VI.width * 98 / 100) && ((u32)(_lrx - _ulx) < VI.width * 9 / 10)) {
|
||||
if (wnd.isAdjustScreen() && (gDP.colorImage.width > VI.width * 98 / 100) && (static_cast<u32>(_lrx - _ulx) < VI.width * 9 / 10)) {
|
||||
const float scale = wnd.getAdjustScale();
|
||||
for (u32 i = 0; i < 4; ++i)
|
||||
m_rect[i].x *= scale;
|
||||
|
@ -1132,10 +1130,10 @@ bool texturedRectDepthBufferCopy(const GraphicsDrawer::TexturedRectParams & _par
|
|||
RDP_RepeatLastLoadBlock();
|
||||
}
|
||||
|
||||
const u32 width = (u32)(_params.lrx - _params.ulx);
|
||||
const u32 ulx = (u32)_params.ulx;
|
||||
u16 * pSrc = ((u16*)TMEM) + _params.s/32;
|
||||
u16 *pDst = (u16*)(RDRAM + gDP.colorImage.address);
|
||||
const u32 width = static_cast<u32>(_params.lrx - _params.ulx);
|
||||
const u32 ulx = static_cast<u32>(_params.ulx);
|
||||
u16 * pSrc = reinterpret_cast<u16*>(TMEM) + _params.s/32;
|
||||
u16 *pDst = reinterpret_cast<u16*>(RDRAM + gDP.colorImage.address);
|
||||
for (u32 x = 0; x < width; ++x)
|
||||
pDst[(ulx + x) ^ 1] = swapword(pSrc[x]);
|
||||
|
||||
|
@ -1163,13 +1161,13 @@ bool texturedRectBGCopy(const GraphicsDrawer::TexturedRectParams & _params)
|
|||
if (flry > gDP.scissor.lry)
|
||||
flry = gDP.scissor.lry;
|
||||
|
||||
const u32 width = (u32)(_params.lrx - _params.ulx);
|
||||
const u32 width = static_cast<u32>(_params.lrx - _params.ulx);
|
||||
const u32 tex_width = gSP.textureTile[0]->line << 3;
|
||||
const u32 uly = (u32)_params.uly;
|
||||
const u32 lry = (u32)flry;
|
||||
const u32 uly = static_cast<u32>(_params.uly);
|
||||
const u32 lry = static_cast<u32>(flry);
|
||||
|
||||
u8 * texaddr = RDRAM + gDP.loadInfo[gSP.textureTile[0]->tmem].texAddress + tex_width*_params.t/32 + _params.s/32;
|
||||
u8 * fbaddr = RDRAM + gDP.colorImage.address + (u32)_params.ulx;
|
||||
u8 * fbaddr = RDRAM + gDP.colorImage.address + static_cast<u32>(_params.ulx);
|
||||
// LOG(LOG_VERBOSE, "memrect (%d, %d, %d, %d), ci_width: %d texaddr: 0x%08lx fbaddr: 0x%08lx\n", (u32)_params.ulx, uly, (u32)_params.lrx, lry, gDP.colorImage.width, gSP.textureTile[0]->imageAddress + tex_width*(u32)_params.ult + (u32)_params.uls, gDP.colorImage.address + (u32)_params.ulx);
|
||||
|
||||
for (u32 y = uly; y < lry; ++y) {
|
||||
|
@ -1207,16 +1205,16 @@ bool texturedRectPaletteMod(const GraphicsDrawer::TexturedRectParams & _params)
|
|||
// Modify palette for Paper Mario "2D lighting" effect
|
||||
if (gDP.scissor.lrx != 16 || gDP.scissor.lry != 1 || _params.lrx != 16 || _params.lry != 1)
|
||||
return false;
|
||||
u8 envr = (u8)(gDP.envColor.r * 31.0f);
|
||||
u8 envg = (u8)(gDP.envColor.g * 31.0f);
|
||||
u8 envb = (u8)(gDP.envColor.b * 31.0f);
|
||||
u16 env16 = (u16)((envr << 11) | (envg << 6) | (envb << 1) | 1);
|
||||
u8 prmr = (u8)(gDP.primColor.r * 31.0f);
|
||||
u8 prmg = (u8)(gDP.primColor.g * 31.0f);
|
||||
u8 prmb = (u8)(gDP.primColor.b * 31.0f);
|
||||
u16 prim16 = (u16)((prmr << 11) | (prmg << 6) | (prmb << 1) | 1);
|
||||
u16 * src = (u16*)&TMEM[256];
|
||||
u16 * dst = (u16*)(RDRAM + gDP.colorImage.address);
|
||||
u8 envr = static_cast<u8>(gDP.envColor.r * 31.0f);
|
||||
u8 envg = static_cast<u8>(gDP.envColor.g * 31.0f);
|
||||
u8 envb = static_cast<u8>(gDP.envColor.b * 31.0f);
|
||||
u16 env16 = static_cast<u16>((envr << 11) | (envg << 6) | (envb << 1) | 1);
|
||||
u8 prmr = static_cast<u8>(gDP.primColor.r * 31.0f);
|
||||
u8 prmg = static_cast<u8>(gDP.primColor.g * 31.0f);
|
||||
u8 prmb = static_cast<u8>(gDP.primColor.b * 31.0f);
|
||||
u16 prim16 = static_cast<u16>((prmr << 11) | (prmg << 6) | (prmb << 1) | 1);
|
||||
u16 * src = reinterpret_cast<u16*>(&TMEM[256]);
|
||||
u16 * dst = reinterpret_cast<u16*>(RDRAM + gDP.colorImage.address);
|
||||
for (u32 i = 0; i < 16; ++i)
|
||||
dst[i ^ 1] = (src[i << 2] & 0x100) ? prim16 : env16;
|
||||
return true;
|
||||
|
@ -1224,7 +1222,7 @@ bool texturedRectPaletteMod(const GraphicsDrawer::TexturedRectParams & _params)
|
|||
|
||||
// Special processing of textured rect.
|
||||
// Return true if actuial rendering is not necessary
|
||||
bool(*texturedRectSpecial)(const GraphicsDrawer::TexturedRectParams & _params) = nullptr;
|
||||
static bool(*texturedRectSpecial)(const GraphicsDrawer::TexturedRectParams & _params) = nullptr;
|
||||
|
||||
void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
||||
{
|
||||
|
@ -1317,12 +1315,12 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
s16 S = _params.s;
|
||||
if (gSP.textureTile[t]->shifts > 10) {
|
||||
const u32 shifts = 16 - gSP.textureTile[t]->shifts;
|
||||
S = (s16)(S << shifts);
|
||||
shiftScaleS = (f32)(1 << shifts);
|
||||
S = static_cast<s16>(S << shifts);
|
||||
shiftScaleS = static_cast<f32>(1 << shifts);
|
||||
} else if (gSP.textureTile[t]->shifts > 0) {
|
||||
const u32 shifts = gSP.textureTile[t]->shifts;
|
||||
S = (s16)(S >> shifts);
|
||||
shiftScaleS /= (f32)(1 << shifts);
|
||||
S = static_cast<s16>(S >> shifts);
|
||||
shiftScaleS /= static_cast<f32>(1 << shifts);
|
||||
}
|
||||
const f32 uls = _FIXED2FLOAT(S, 5);
|
||||
const f32 lrs = uls + offsetX * shiftScaleS;
|
||||
|
@ -1330,12 +1328,12 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
s16 T = _params.t;
|
||||
if (gSP.textureTile[t]->shiftt > 10) {
|
||||
const u32 shiftt = 16 - gSP.textureTile[t]->shiftt;
|
||||
T = (s16)(T << shiftt);
|
||||
shiftScaleT = (f32)(1 << shiftt);
|
||||
T = static_cast<s16>(T << shiftt);
|
||||
shiftScaleT = static_cast<f32>(1 << shiftt);
|
||||
} else if (gSP.textureTile[t]->shiftt > 0) {
|
||||
const u32 shiftt = gSP.textureTile[t]->shiftt;
|
||||
T = (s16)(T >> shiftt);
|
||||
shiftScaleT /= (f32)(1 << shiftt);
|
||||
T = static_cast<s16>(T >> shiftt);
|
||||
shiftScaleT /= static_cast<f32>(1 << shiftt);
|
||||
}
|
||||
const f32 ult = _FIXED2FLOAT(T, 5);
|
||||
const f32 lrt = ult + offsetY * shiftScaleT;
|
||||
|
@ -1366,15 +1364,15 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
|
||||
if ((cache.current[t]->mirrorS == 0 && cache.current[t]->maskS == 0 &&
|
||||
(texST[t].s0 < texST[t].s1 ?
|
||||
texST[t].s0 >= 0.0 && texST[t].s1 <= (float)cache.current[t]->width :
|
||||
texST[t].s1 >= 0.0 && texST[t].s0 <= (float)cache.current[t]->width))
|
||||
texST[t].s0 >= 0.0f && texST[t].s1 <= static_cast<f32>(cache.current[t]->width) :
|
||||
texST[t].s1 >= 0.0f && texST[t].s0 <= static_cast<f32>(cache.current[t]->width)))
|
||||
|| (cache.current[t]->maskS == 0 && (texST[t].s0 < -1024.0f || texST[t].s1 > 1023.99f)))
|
||||
texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
|
||||
if (cache.current[t]->mirrorT == 0 &&
|
||||
(texST[t].t0 < texST[t].t1 ?
|
||||
texST[t].t0 >= 0.0f && texST[t].t1 <= (float)cache.current[t]->height :
|
||||
texST[t].t1 >= 0.0f && texST[t].t0 <= (float)cache.current[t]->height))
|
||||
texST[t].t0 >= 0.0f && texST[t].t1 <= static_cast<f32>(cache.current[t]->height) :
|
||||
texST[t].t1 >= 0.0f && texST[t].t0 <= static_cast<f32>(cache.current[t]->height)))
|
||||
texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
|
||||
if (texParams.wrapS.isValid() || texParams.wrapT.isValid()) {
|
||||
|
@ -1444,7 +1442,7 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
|
||||
if (wnd.isAdjustScreen() &&
|
||||
(_params.forceAjustScale ||
|
||||
((gDP.colorImage.width > VI.width * 98 / 100) && ((u32)(_params.lrx - _params.ulx) < VI.width * 9 / 10))))
|
||||
((gDP.colorImage.width > VI.width * 98 / 100) && (static_cast<u32>(_params.lrx - _params.ulx) < VI.width * 9 / 10))))
|
||||
{
|
||||
const float scale = wnd.getAdjustScale();
|
||||
for (u32 i = 0; i < 4; ++i)
|
||||
|
@ -1552,9 +1550,9 @@ void GraphicsDrawer::drawOSD()
|
|||
|
||||
DisplayWindow & wnd = DisplayWindow::get();
|
||||
const s32 X = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const s32 Y = wnd.getHeightOffset();
|
||||
const s32 W = wnd.getWidth();
|
||||
const s32 H = wnd.getHeight();
|
||||
const s32 Y = static_cast<s32>(wnd.getHeightOffset());
|
||||
const s32 W = static_cast<s32>(wnd.getWidth());
|
||||
const s32 H = static_cast<s32>(wnd.getHeight());
|
||||
|
||||
gfxContext.setViewport(X, Y, W, H);
|
||||
gfxContext.setScissor(X, Y, W, H);
|
||||
|
@ -1648,7 +1646,7 @@ void GraphicsDrawer::clearColorBuffer(float *_pColor)
|
|||
gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
bool GraphicsDrawer::isRejected(s32 _v0, s32 _v1, s32 _v2) const
|
||||
bool GraphicsDrawer::isRejected(u32 _v0, u32 _v1, u32 _v2) const
|
||||
{
|
||||
if (!GBI.isRej() || gSP.clipRatio < 2)
|
||||
return false;
|
||||
|
@ -1663,7 +1661,7 @@ bool GraphicsDrawer::isRejected(s32 _v0, s32 _v1, s32 _v2) const
|
|||
rejectBox.lry = gDP.scissor.lry + scissorHeight2;
|
||||
gDP.changed ^= CHANGED_REJECT_BOX;
|
||||
}
|
||||
s32 verts[3] = { _v0, _v1, _v2 };
|
||||
u32 verts[3] = { _v0, _v1, _v2 };
|
||||
const f32 ySign = GBI.isNegativeY() ? -1.0f : 1.0f;
|
||||
for (u32 i = 0; i < 3; ++i) {
|
||||
const SPVertex & v = triangles.vertices[verts[i]];
|
||||
|
@ -1758,7 +1756,7 @@ void GraphicsDrawer::copyTexturedRect(const CopyRectParams & _params)
|
|||
gfxContext.setTextureParameters(texParams);
|
||||
}
|
||||
|
||||
gfxContext.setViewport(0, 0, _params.dstWidth, _params.dstHeight);
|
||||
gfxContext.setViewport(0, 0, static_cast<s32>(_params.dstWidth), static_cast<s32>(_params.dstHeight));
|
||||
gfxContext.enable(enable::CULL_FACE, false);
|
||||
gfxContext.enable(enable::BLEND, false);
|
||||
|
||||
|
@ -1837,11 +1835,12 @@ void GraphicsDrawer::_initStates()
|
|||
}
|
||||
|
||||
DisplayWindow & wnd = DisplayWindow::get();
|
||||
gfxContext.setViewport(0, wnd.getHeightOffset(), wnd.getScreenWidth(), wnd.getScreenHeight());
|
||||
gfxContext.setViewport(0, static_cast<s32>(wnd.getHeightOffset()),
|
||||
static_cast<s32>(wnd.getScreenWidth()), static_cast<s32>(wnd.getScreenHeight()));
|
||||
|
||||
gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
srand((unsigned int)time(nullptr));
|
||||
srand(static_cast<u32>(time(nullptr)));
|
||||
|
||||
wnd.swapBuffers();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef std::chrono::milliseconds Milliseconds;
|
|||
class GraphicsDrawer
|
||||
{
|
||||
public:
|
||||
void addTriangle(int _v0, int _v1, int _v2);
|
||||
void addTriangle(u32 _v0, u32 _v1, u32 _v2);
|
||||
|
||||
void drawTriangles();
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
void drawDMATriangles(u32 _numVtx);
|
||||
|
||||
void drawLine(int _v0, int _v1, float _width);
|
||||
void drawLine(u32 _v0, u32 _v1, float _width);
|
||||
|
||||
void drawRect(int _ulx, int _uly, int _lrx, int _lry);
|
||||
|
||||
|
@ -128,12 +128,12 @@ public:
|
|||
|
||||
int getTrianglesCount() const { return triangles.num; }
|
||||
|
||||
bool isClipped(s32 _v0, s32 _v1, s32 _v2) const
|
||||
bool isClipped(u32 _v0, u32 _v1, u32 _v2) const
|
||||
{
|
||||
return (triangles.vertices[_v0].clip & triangles.vertices[_v1].clip & triangles.vertices[_v2].clip) != 0;
|
||||
}
|
||||
|
||||
bool isRejected(s32 _v0, s32 _v1, s32 _v2) const;
|
||||
bool isRejected(u32 _v0, u32 _v1, u32 _v2) const;
|
||||
|
||||
SPVertex & getVertex(u32 _v) { return triangles.vertices[_v]; }
|
||||
|
||||
|
@ -187,7 +187,7 @@ private:
|
|||
void _updateStates(DrawingState _drawingState) const;
|
||||
void _prepareDrawTriangle(DrawingState _drawingState);
|
||||
bool _canDraw() const;
|
||||
void _drawThickLine(int _v0, int _v1, float _width);
|
||||
void _drawThickLine(u32 _v0, u32 _v1, float _width);
|
||||
|
||||
void _drawOSD(const char *_pText, float _x, float & _y);
|
||||
|
||||
|
@ -201,7 +201,7 @@ private:
|
|||
std::array<SPVertex, VERTBUFF_SIZE> vertices;
|
||||
std::array<u16, ELEMBUFF_SIZE> elements;
|
||||
u32 num = 0;
|
||||
int maxElement = 0;
|
||||
u32 maxElement = 0;
|
||||
} triangles;
|
||||
|
||||
std::vector<SPVertex> m_dmaVertices;
|
||||
|
|
|
@ -105,7 +105,7 @@ void UnswapCopyWrap(const u8 *src, u32 srcIdx, u8 *dest, u32 destIdx, u32 destMa
|
|||
u32 leadingBytes = srcIdx & 3;
|
||||
if (leadingBytes != 0) {
|
||||
leadingBytes = 4 - leadingBytes;
|
||||
if ((u32)leadingBytes > numBytes)
|
||||
if (leadingBytes > numBytes)
|
||||
leadingBytes = numBytes;
|
||||
numBytes -= leadingBytes;
|
||||
|
||||
|
|
113
src/gDP.cpp
113
src/gDP.cpp
|
@ -143,7 +143,7 @@ void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address )
|
|||
gDP.colorImage.height = 0;
|
||||
gDP.colorImage.address = address;
|
||||
|
||||
frameBufferList().saveBuffer(address, (u16)format, (u16)size, (u16)width, false);
|
||||
frameBufferList().saveBuffer(address, static_cast<u16>(format), static_cast<u16>(size), static_cast<u16>(width), false);
|
||||
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetColorImage( %s, %s, %i, 0x%08X );\n",
|
||||
|
@ -163,7 +163,7 @@ void gDPSetTextureImage(u32 format, u32 size, u32 width, u32 address)
|
|||
gDP.textureImage.bpl = gDP.textureImage.width << gDP.textureImage.size >> 1;
|
||||
if (gSP.DMAOffsets.tex_offset != 0) {
|
||||
if (format == G_IM_FMT_RGBA) {
|
||||
u16 * t = (u16*)(RDRAM + gSP.DMAOffsets.tex_offset);
|
||||
u16 * t = reinterpret_cast<u16*>(RDRAM + gSP.DMAOffsets.tex_offset);
|
||||
gSP.DMAOffsets.tex_shift = t[gSP.DMAOffsets.tex_count ^ 1];
|
||||
gDP.textureImage.address += gSP.DMAOffsets.tex_shift;
|
||||
} else {
|
||||
|
@ -227,8 +227,8 @@ void gDPSetFogColor( u32 r, u32 g, u32 b, u32 a )
|
|||
void gDPSetFillColor( u32 c )
|
||||
{
|
||||
gDP.fillColor.color = c;
|
||||
gDP.fillColor.z = (f32)_SHIFTR( c, 2, 14 );
|
||||
gDP.fillColor.dz = (f32)_SHIFTR( c, 0, 2 );
|
||||
gDP.fillColor.z = static_cast<f32>(_SHIFTR( c, 2, 14 ));
|
||||
gDP.fillColor.dz = static_cast<f32>(_SHIFTR( c, 0, 2 ));
|
||||
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetFillColor( 0x%08X );\n", c );
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ void gDPGetFillColor(f32 _fillColor[4])
|
|||
_fillColor[0] = _FIXED2FLOATCOLOR( _SHIFTR( c, 11, 5 ), 5 );
|
||||
_fillColor[1] = _FIXED2FLOATCOLOR( _SHIFTR( c, 6, 5 ), 5 );
|
||||
_fillColor[2] = _FIXED2FLOATCOLOR( _SHIFTR( c, 1, 5 ), 5 );
|
||||
_fillColor[3] = (f32)_SHIFTR( c, 0, 1 );
|
||||
_fillColor[3] = static_cast<f32>(_SHIFTR( c, 0, 1 ));
|
||||
} else {
|
||||
_fillColor[0] = _FIXED2FLOATCOLOR( _SHIFTR( c, 24, 8 ), 8 );
|
||||
_fillColor[1] = _FIXED2FLOATCOLOR( _SHIFTR( c, 16, 8 ), 8 );
|
||||
|
@ -380,7 +380,7 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _width, u32 _bytes)
|
|||
|
||||
const u32 texEndAddress = _address + _bytes - 1;
|
||||
if (_address > pBuffer->m_startAddress &&
|
||||
std::abs((s32)pBuffer->m_width - (s32)_width) > 1 &&
|
||||
std::abs(static_cast<s32>(pBuffer->m_width) - static_cast<s32>(_width)) > 1 &&
|
||||
texEndAddress > (pBuffer->m_endAddress + (pBuffer->m_width << pBuffer->m_size >> 1))) {
|
||||
//fbList.removeBuffer(pBuffer->m_startAddress);
|
||||
bRes = false;
|
||||
|
@ -409,7 +409,7 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _width, u32 _bytes)
|
|||
break;
|
||||
}
|
||||
|
||||
for (int nTile = gSP.texture.tile; nTile < 6; ++nTile) {
|
||||
for (u32 nTile = gSP.texture.tile; nTile < 6; ++nTile) {
|
||||
if (gDP.tiles[nTile].tmem == gDP.loadTile->tmem) {
|
||||
gDPTile & curTile = gDP.tiles[nTile];
|
||||
curTile.textureMode = gDP.loadTile->textureMode;
|
||||
|
@ -432,8 +432,8 @@ void gDPLoadTile32b(u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
const u32 line = gDP.loadTile->line << 2;
|
||||
const u32 tbase = gDP.loadTile->tmem << 2;
|
||||
const u32 addr = gDP.textureImage.address >> 2;
|
||||
const u32 * src = (const u32*)RDRAM;
|
||||
u16 * tmem16 = (u16*)TMEM;
|
||||
const u32 * src = reinterpret_cast<const u32*>(RDRAM);
|
||||
u16 * tmem16 = reinterpret_cast<u16*>(TMEM);
|
||||
u32 c, ptr, tline, s, xorval;
|
||||
|
||||
for (u32 j = 0; j < height; ++j) {
|
||||
|
@ -483,14 +483,14 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
|
||||
gDPLoadTileInfo &info = gDP.loadInfo[gDP.loadTile->tmem];
|
||||
info.texAddress = gDP.loadTile->imageAddress;
|
||||
info.uls = gDP.loadTile->uls;
|
||||
info.ult = gDP.loadTile->ult;
|
||||
info.lrs = gDP.loadTile->lrs;
|
||||
info.lrt = gDP.loadTile->lrt;
|
||||
info.width = gDP.loadTile->masks != 0 ? (u16)min(width, 1U << gDP.loadTile->masks) : (u16)width;
|
||||
info.height = gDP.loadTile->maskt != 0 ? (u16)min(height, 1U << gDP.loadTile->maskt) : (u16)height;
|
||||
info.texWidth = gDP.textureImage.width;
|
||||
info.size = gDP.textureImage.size;
|
||||
info.uls = static_cast<u16>(gDP.loadTile->uls);
|
||||
info.ult = static_cast<u16>(gDP.loadTile->ult);
|
||||
info.lrs = static_cast<u16>(gDP.loadTile->lrs);
|
||||
info.lrt = static_cast<u16>(gDP.loadTile->lrt);
|
||||
info.width = static_cast<u16>(gDP.loadTile->masks != 0 ? min(width, 1U << gDP.loadTile->masks) : width);
|
||||
info.height = static_cast<u16>(gDP.loadTile->maskt != 0 ? min(height, 1U << gDP.loadTile->maskt) : height);
|
||||
info.texWidth = static_cast<u16>(gDP.textureImage.width);
|
||||
info.size = static_cast<u8>(gDP.textureImage.size);
|
||||
info.loadType = LOADTYPE_TILE;
|
||||
info.bytes = bpl * height;
|
||||
if (gDP.loadTile->size == G_IM_SIZ_32b)
|
||||
|
@ -504,7 +504,7 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
gDP.loadTile->loadWidth = max(gDP.loadTile->loadWidth, info.width);
|
||||
if (gDP.loadTile->maskt == 0) {
|
||||
if (gDP.otherMode.cycleType != G_CYC_2CYCLE && gDP.loadTile->tmem % gDP.loadTile->line == 0) {
|
||||
u16 theight = info.height + gDP.loadTile->tmem / gDP.loadTile->line;
|
||||
u16 theight = static_cast<u16>(info.height + gDP.loadTile->tmem / gDP.loadTile->line);
|
||||
gDP.loadTile->loadHeight = max(gDP.loadTile->loadHeight, theight);
|
||||
} else
|
||||
gDP.loadTile->loadHeight = max(gDP.loadTile->loadHeight, info.height);
|
||||
|
@ -516,7 +516,7 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
bpl2 = (gDP.textureImage.width - gDP.loadTile->uls);
|
||||
u32 height2 = height;
|
||||
if (gDP.loadTile->lrt > gDP.scissor.lry)
|
||||
height2 = (u32)gDP.scissor.lry - gDP.loadTile->ult;
|
||||
height2 = static_cast<u32>(gDP.scissor.lry) - gDP.loadTile->ult;
|
||||
|
||||
if (CheckForFrameBufferTexture(address, info.width, bpl2*height2))
|
||||
return;
|
||||
|
@ -529,11 +529,11 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
const u32 qwpr = bpr >> 3;
|
||||
for (u32 y = 0; y < height; ++y) {
|
||||
if (address + bpl > RDRAMSize)
|
||||
UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, RDRAMSize - address);
|
||||
UnswapCopyWrap(RDRAM, address, reinterpret_cast<u8*>(TMEM), tmemAddr << 3, 0xFFF, RDRAMSize - address);
|
||||
else
|
||||
UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bpr);
|
||||
UnswapCopyWrap(RDRAM, address, reinterpret_cast<u8*>(TMEM), tmemAddr << 3, 0xFFF, bpr);
|
||||
if (y & 1)
|
||||
DWordInterleaveWrap((u32*)TMEM, tmemAddr << 1, 0x3FF, qwpr);
|
||||
DWordInterleaveWrap(reinterpret_cast<u32*>(TMEM), tmemAddr << 1, 0x3FF, qwpr);
|
||||
|
||||
address += gDP.textureImage.bpl;
|
||||
if (address >= RDRAMSize)
|
||||
|
@ -552,17 +552,17 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
//
|
||||
void gDPLoadBlock32(u32 uls,u32 lrs, u32 dxt)
|
||||
{
|
||||
const u32 * src = (const u32*)RDRAM;
|
||||
const u32 * src = reinterpret_cast<const u32*>(RDRAM);
|
||||
const u32 tb = gDP.loadTile->tmem << 2;
|
||||
const u32 line = gDP.loadTile->line << 2;
|
||||
|
||||
u16 *tmem16 = (u16*)TMEM;
|
||||
u16 *tmem16 = reinterpret_cast<u16*>(TMEM);
|
||||
u32 addr = gDP.loadTile->imageAddress >> 2;
|
||||
u32 width = (lrs - uls + 1) << 2;
|
||||
if (width == 4) // lr_s == 0, 1x1 texture
|
||||
width = 1;
|
||||
else if (width & 7)
|
||||
width = (width & (~7)) + 8;
|
||||
width = (width & (~7U)) + 8;
|
||||
|
||||
if (dxt != 0) {
|
||||
u32 j = 0;
|
||||
|
@ -617,19 +617,19 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
|
|||
|
||||
gDPLoadTileInfo &info = gDP.loadInfo[gDP.loadTile->tmem];
|
||||
info.texAddress = gDP.loadTile->imageAddress;
|
||||
info.uls = gDP.loadTile->uls;
|
||||
info.ult = gDP.loadTile->ult;
|
||||
info.lrs = gDP.loadTile->lrs;
|
||||
info.lrt = gDP.loadTile->lrt;
|
||||
info.width = gDP.loadTile->lrs;
|
||||
info.uls = static_cast<u16>(gDP.loadTile->uls);
|
||||
info.ult = static_cast<u16>(gDP.loadTile->ult);
|
||||
info.lrs = static_cast<u16>(gDP.loadTile->lrs);
|
||||
info.lrt = static_cast<u16>(gDP.loadTile->lrt);
|
||||
info.width = static_cast<u16>(gDP.loadTile->lrs);
|
||||
info.dxt = dxt;
|
||||
info.size = gDP.textureImage.size;
|
||||
info.size = static_cast<u8>(gDP.textureImage.size);
|
||||
info.loadType = LOADTYPE_BLOCK;
|
||||
|
||||
const u32 width = (lrs - uls + 1) & 0x0FFF;
|
||||
u32 bytes = width << gDP.loadTile->size >> 1;
|
||||
if ((bytes & 7) != 0)
|
||||
bytes = (bytes & (~7)) + 8;
|
||||
bytes = (bytes & (~7U)) + 8;
|
||||
|
||||
info.bytes = bytes;
|
||||
u32 address = gDP.textureImage.address + ult * gDP.textureImage.bpl + (uls << gDP.textureImage.size >> 1);
|
||||
|
@ -658,7 +658,7 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
|
|||
memcpy(TMEM, &RDRAM[address], bytes); // HACK!
|
||||
else {
|
||||
u32 tmemAddr = gDP.loadTile->tmem;
|
||||
UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bytes);
|
||||
UnswapCopyWrap(RDRAM, address, reinterpret_cast<u8*>(TMEM), tmemAddr << 3, 0xFFF, bytes);
|
||||
if (dxt != 0) {
|
||||
u32 dxtCounter = 0;
|
||||
u32 qwords = (bytes >> 3);
|
||||
|
@ -678,12 +678,12 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
|
|||
goto end_dxt_test;
|
||||
dxtCounter += dxt;
|
||||
} while ((dxtCounter & 0x800) != 0);
|
||||
DWordInterleaveWrap((u32*)TMEM, tmemAddr << 1, 0x3FF, line);
|
||||
DWordInterleaveWrap(reinterpret_cast<u32*>(TMEM), tmemAddr << 1, 0x3FF, line);
|
||||
tmemAddr += line;
|
||||
line = 0;
|
||||
}
|
||||
end_dxt_test:
|
||||
DWordInterleaveWrap((u32*)TMEM, tmemAddr << 1, 0x3FF, line);
|
||||
DWordInterleaveWrap(reinterpret_cast<u32*>(TMEM), tmemAddr << 1, 0x3FF, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -697,16 +697,16 @@ void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt )
|
|||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "gDPLoadTLUT wrong tile tmem addr: tile[%d].tmem=%04x;\n", tile, gDP.tiles[tile].tmem);
|
||||
return;
|
||||
}
|
||||
u16 count = (u16)((gDP.tiles[tile].lrs - gDP.tiles[tile].uls + 1) * (gDP.tiles[tile].lrt - gDP.tiles[tile].ult + 1));
|
||||
u16 count = static_cast<u16>((gDP.tiles[tile].lrs - gDP.tiles[tile].uls + 1) * (gDP.tiles[tile].lrt - gDP.tiles[tile].ult + 1));
|
||||
u32 address = gDP.textureImage.address + gDP.tiles[tile].ult * gDP.textureImage.bpl + (gDP.tiles[tile].uls << gDP.textureImage.size >> 1);
|
||||
u16 pal = (u16)((gDP.tiles[tile].tmem - 256) >> 4);
|
||||
u16 pal = static_cast<u16>((gDP.tiles[tile].tmem - 256) >> 4);
|
||||
u16 * dest = reinterpret_cast<u16*>(TMEM);
|
||||
u32 destIdx = gDP.tiles[tile].tmem << 2;
|
||||
|
||||
int i = 0;
|
||||
while (i < count) {
|
||||
for (u16 j = 0; (j < 16) && (i < count); ++j, ++i) {
|
||||
dest[(destIdx | 0x0400) & 0x07FF] = swapword(*(u16*)(RDRAM + (address ^ 2)));
|
||||
dest[(destIdx | 0x0400) & 0x07FF] = swapword(*reinterpret_cast<u16*>(RDRAM + (address ^ 2)));
|
||||
address += 2;
|
||||
destIdx += 4;
|
||||
}
|
||||
|
@ -718,9 +718,9 @@ void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt )
|
|||
gDP.paletteCRC256 = CRC_Calculate(UINT64_MAX, gDP.paletteCRC16, sizeof(u64) * 16);
|
||||
|
||||
if (TFH.isInited()) {
|
||||
const u16 start = gDP.tiles[tile].tmem - 256; // starting location in the palettes
|
||||
u16 *spal = (u16*)(RDRAM + gDP.textureImage.address);
|
||||
memcpy((u8*)(gDP.TexFilterPalette + start), spal, count<<1);
|
||||
const u16 start = static_cast<u16>(gDP.tiles[tile].tmem) - 256; // starting location in the palettes
|
||||
u16 *spal = reinterpret_cast<u16*>(RDRAM + gDP.textureImage.address);
|
||||
memcpy(reinterpret_cast<u8*>(gDP.TexFilterPalette + start), spal, u32(count)<<1);
|
||||
}
|
||||
|
||||
gDP.changed |= CHANGED_TMEM;
|
||||
|
@ -814,10 +814,10 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry )
|
|||
|
||||
void gDPSetConvert( s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5 )
|
||||
{
|
||||
gDP.convert.k0 = (s32)((u32)SIGN(k0, 9) << 1) + 1;
|
||||
gDP.convert.k1 = (s32)((u32)SIGN(k1, 9) << 1) + 1;
|
||||
gDP.convert.k2 = (s32)((u32)SIGN(k2, 9) << 1) + 1;
|
||||
gDP.convert.k3 = (s32)((u32)SIGN(k3, 9) << 1) + 1;
|
||||
gDP.convert.k0 = static_cast<s32>(static_cast<u32>(SIGN(k0, 9) << 1)) + 1;
|
||||
gDP.convert.k1 = static_cast<s32>(static_cast<u32>(SIGN(k1, 9) << 1)) + 1;
|
||||
gDP.convert.k2 = static_cast<s32>(static_cast<u32>(SIGN(k2, 9) << 1)) + 1;
|
||||
gDP.convert.k3 = static_cast<s32>(static_cast<u32>(SIGN(k3, 9) << 1)) + 1;
|
||||
gDP.convert.k4 = k4;
|
||||
gDP.convert.k5 = k5;
|
||||
|
||||
|
@ -1447,8 +1447,6 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
|||
if (_texture) {
|
||||
if (gDP.otherMode.texturePersp != 0) {
|
||||
f32 vw = wf + dwdef * diffY + dwdxf * diffx * 4.0f;
|
||||
if (vw == 0)
|
||||
int t = 0;
|
||||
vtx->w = static_cast<f32>(1.0f / (vw > 0.0f ? vw : (1.0f + vw - ceil(vw))));
|
||||
//vtx->w = static_cast<f32>(1.0f / vw);
|
||||
if (vw <= 0.0f) {
|
||||
|
@ -1504,24 +1502,24 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
|||
|
||||
SPVertex * vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(xhyf);
|
||||
vtx->y = static_cast<f32>(yf * 0.25);
|
||||
vtx->y = static_cast<f32>(yf * 0.25f);
|
||||
updateVtx(vtx, diffyf, 0.0f);
|
||||
|
||||
vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(xmyf);
|
||||
vtx->y = static_cast<f32>(yf * 0.25);
|
||||
vtx->y = static_cast<f32>(yf * 0.25f);
|
||||
updateVtx(vtx, diffyf, diffxf);
|
||||
}
|
||||
#endif
|
||||
|
||||
vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(xhym);
|
||||
vtx->y = static_cast<f32>(ymf * 0.25);
|
||||
vtx->y = static_cast<f32>(ymf * 0.25f);
|
||||
updateVtx(vtx, diffym, 0.0f);
|
||||
|
||||
vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(xmym);
|
||||
vtx->y = static_cast<f32>(ymf * 0.25);
|
||||
vtx->y = static_cast<f32>(ymf * 0.25f);
|
||||
updateVtx(vtx, diffym, diffxm);
|
||||
|
||||
if (dxldy != dxmdy && ym < yl) {
|
||||
|
@ -1531,7 +1529,7 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
|||
f32 y4f = (lc - hc) / (hk - lk);
|
||||
vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(hk * y4f + hc);
|
||||
vtx->y = static_cast<f32>(y4f * 0.25);
|
||||
vtx->y = static_cast<f32>(y4f * 0.25f);
|
||||
updateVtx(vtx, (y4f - yhf), 0.0f);
|
||||
}
|
||||
} else {
|
||||
|
@ -1558,7 +1556,7 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
|||
|
||||
vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(xlf);
|
||||
vtx->y = static_cast<f32>(y1f * 0.25);
|
||||
vtx->y = static_cast<f32>(y1f * 0.25f);
|
||||
|
||||
f32 x1f = hk * y1f + hc;
|
||||
f32 diffx1 = xlf - x1f;
|
||||
|
@ -1620,20 +1618,17 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
|||
f32 x2f = hk * ylf + hc;
|
||||
f32 diffx2 = vtx->x - x2f;
|
||||
updateVtx(vtx, ydiff, diffx2);
|
||||
}
|
||||
else if (mk == lk) {
|
||||
} else if (mk == lk) {
|
||||
vtx = &vertices[vtxCount++];
|
||||
vtx->x = static_cast<f32>(hk * ylf + hc);
|
||||
vtx->y = static_cast<f32>(ylf * 0.25f);
|
||||
updateVtx(vtx, (ylf - yhf), 0.0f);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
f32 y2f = ylf;
|
||||
|
||||
if (yl == ym) {
|
||||
y2f = (lc - mc) / (mk - lk);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
y2f = (lc - hc) / (hk - lk);
|
||||
}
|
||||
|
||||
|
|
26
src/gDP.h
26
src/gDP.h
|
@ -3,20 +3,20 @@
|
|||
|
||||
#include "Types.h"
|
||||
|
||||
#define CHANGED_RENDERMODE 0x001
|
||||
#define CHANGED_CYCLETYPE 0x002
|
||||
#define CHANGED_SCISSOR 0x004
|
||||
#define CHANGED_TMEM 0x008
|
||||
#define CHANGED_TILE 0x010
|
||||
#define CHANGED_REJECT_BOX 0x020
|
||||
#define CHANGED_RENDERMODE 0x001U
|
||||
#define CHANGED_CYCLETYPE 0x002U
|
||||
#define CHANGED_SCISSOR 0x004U
|
||||
#define CHANGED_TMEM 0x008U
|
||||
#define CHANGED_TILE 0x010U
|
||||
#define CHANGED_REJECT_BOX 0x020U
|
||||
//#define CHANGED_COMBINE_COLORS 0x020
|
||||
#define CHANGED_COMBINE 0x040
|
||||
#define CHANGED_ALPHACOMPARE 0x080
|
||||
#define CHANGED_FOGCOLOR 0x100
|
||||
#define CHANGED_BLENDCOLOR 0x200
|
||||
#define CHANGED_FB_TEXTURE 0x400
|
||||
#define CHANGED_COLORBUFFER 0x1000
|
||||
#define CHANGED_CPU_FB_WRITE 0x2000
|
||||
#define CHANGED_COMBINE 0x040U
|
||||
#define CHANGED_ALPHACOMPARE 0x080U
|
||||
#define CHANGED_FOGCOLOR 0x100U
|
||||
#define CHANGED_BLENDCOLOR 0x200U
|
||||
#define CHANGED_FB_TEXTURE 0x400U
|
||||
#define CHANGED_COLORBUFFER 0x1000U
|
||||
#define CHANGED_CPU_FB_WRITE 0x2000U
|
||||
|
||||
#define TEXTUREMODE_NORMAL 0
|
||||
#define TEXTUREMODE_BGIMAGE 2
|
||||
|
|
20
src/gSP.cpp
20
src/gSP.cpp
|
@ -66,7 +66,7 @@ void gSPCombineMatrices(u32 _mode)
|
|||
DebugMsg(DEBUG_NORMAL, "gSPCombineMatrices();\n");
|
||||
}
|
||||
|
||||
void gSPTriangle(s32 v0, s32 v1, s32 v2)
|
||||
void gSPTriangle(u32 v0, u32 v1, u32 v2)
|
||||
{
|
||||
GraphicsDrawer & drawer = dwnd().getDrawer();
|
||||
if ((v0 < INDEXMAP_SIZE) && (v1 < INDEXMAP_SIZE) && (v2 < INDEXMAP_SIZE)) {
|
||||
|
@ -83,7 +83,7 @@ void gSPTriangle(s32 v0, s32 v1, s32 v2)
|
|||
}
|
||||
}
|
||||
|
||||
void gSP1Triangle( const s32 v0, const s32 v1, const s32 v2)
|
||||
void gSP1Triangle( const u32 v0, const u32 v1, const u32 v2)
|
||||
{
|
||||
DebugMsg(DEBUG_NORMAL, "gSP1Triangle (%i, %i, %i)\n", v0, v1, v2);
|
||||
|
||||
|
@ -91,8 +91,8 @@ void gSP1Triangle( const s32 v0, const s32 v1, const s32 v2)
|
|||
gSPFlushTriangles();
|
||||
}
|
||||
|
||||
void gSP2Triangles(const s32 v00, const s32 v01, const s32 v02, const s32 flag0,
|
||||
const s32 v10, const s32 v11, const s32 v12, const s32 flag1 )
|
||||
void gSP2Triangles(const u32 v00, const u32 v01, const u32 v02, const u32 flag0,
|
||||
const u32 v10, const u32 v11, const u32 v12, const u32 flag1 )
|
||||
{
|
||||
DebugMsg(DEBUG_NORMAL, "gSP2Triangle (%i, %i, %i)-(%i, %i, %i)\n", v00, v01, v02, v10, v11, v12);
|
||||
|
||||
|
@ -101,10 +101,10 @@ void gSP2Triangles(const s32 v00, const s32 v01, const s32 v02, const s32 flag0,
|
|||
gSPFlushTriangles();
|
||||
}
|
||||
|
||||
void gSP4Triangles(const s32 v00, const s32 v01, const s32 v02,
|
||||
const s32 v10, const s32 v11, const s32 v12,
|
||||
const s32 v20, const s32 v21, const s32 v22,
|
||||
const s32 v30, const s32 v31, const s32 v32 )
|
||||
void gSP4Triangles(const u32 v00, const u32 v01, const u32 v02,
|
||||
const u32 v10, const u32 v11, const u32 v12,
|
||||
const u32 v20, const u32 v21, const u32 v22,
|
||||
const u32 v30, const u32 v31, const u32 v32 )
|
||||
{
|
||||
DebugMsg(DEBUG_NORMAL, "gSP4Triangle (%i, %i, %i)-(%i, %i, %i)-(%i, %i, %i)-(%i, %i, %i)\n",
|
||||
v00, v01, v02, v10, v11, v12, v20, v21, v22, v30, v31, v32);
|
||||
|
@ -1944,14 +1944,14 @@ void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data)
|
|||
DebugMsg(DEBUG_NORMAL, " result: %08x\n", gDP.otherMode.l);
|
||||
}
|
||||
|
||||
void gSPLine3D( s32 v0, s32 v1, s32 flag )
|
||||
void gSPLine3D(u32 v0, u32 v1, u32 flag )
|
||||
{
|
||||
dwnd().getDrawer().drawLine(v0, v1, 1.5f);
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLine3D( %i, %i, %i )\n", v0, v1, flag);
|
||||
}
|
||||
|
||||
void gSPLineW3D( s32 v0, s32 v1, s32 wd, s32 flag )
|
||||
void gSPLineW3D(u32 v0, u32 v1, u32 wd, u32 flag )
|
||||
{
|
||||
dwnd().getDrawer().drawLine(v0, v1, 1.5f + wd * 0.5f);
|
||||
|
||||
|
|
38
src/gSP.h
38
src/gSP.h
|
@ -5,15 +5,15 @@
|
|||
#include "GBI.h"
|
||||
#include "gDP.h"
|
||||
|
||||
#define CHANGED_VIEWPORT 0x01
|
||||
#define CHANGED_MATRIX 0x02
|
||||
#define CHANGED_TEXTURE 0x04
|
||||
#define CHANGED_GEOMETRYMODE 0x08
|
||||
#define CHANGED_FOGPOSITION 0x10
|
||||
#define CHANGED_LIGHT 0x20
|
||||
#define CHANGED_LOOKAT 0x40
|
||||
#define CHANGED_TEXTURESCALE 0x80
|
||||
#define CHANGED_HW_LIGHT 0x100
|
||||
#define CHANGED_VIEWPORT 0x01U
|
||||
#define CHANGED_MATRIX 0x02U
|
||||
#define CHANGED_TEXTURE 0x04U
|
||||
#define CHANGED_GEOMETRYMODE 0x08U
|
||||
#define CHANGED_FOGPOSITION 0x10U
|
||||
#define CHANGED_LIGHT 0x20U
|
||||
#define CHANGED_LOOKAT 0x40U
|
||||
#define CHANGED_TEXTURESCALE 0x80U
|
||||
#define CHANGED_HW_LIGHT 0x100U
|
||||
|
||||
#define CLIP_X 0x03
|
||||
#define CLIP_NEGX 0x01
|
||||
|
@ -192,22 +192,22 @@ void gSPSetGeometryMode( u32 mode );
|
|||
void gSPClearGeometryMode( u32 mode );
|
||||
void gSPSetOtherMode_H(u32 _length, u32 _shift, u32 _data);
|
||||
void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data);
|
||||
void gSPLine3D(s32 v0, s32 v1, s32 flag);
|
||||
void gSPLineW3D( s32 v0, s32 v1, s32 wd, s32 flag );
|
||||
void gSPLine3D(u32 v0, u32 v1, u32 flag);
|
||||
void gSPLineW3D( u32 v0, u32 v1, u32 wd, u32 flag );
|
||||
void gSPSetStatus(u32 sid, u32 val);
|
||||
void gSPSetDMAOffsets( u32 mtxoffset, u32 vtxoffset );
|
||||
void gSPSetDMATexOffset(u32 _addr);
|
||||
void gSPSetVertexColorBase( u32 base );
|
||||
void gSPCombineMatrices(u32 _mode);
|
||||
|
||||
void gSPTriangle(s32 v0, s32 v1, s32 v2);
|
||||
void gSP1Triangle(s32 v0, s32 v1, s32 v2);
|
||||
void gSP2Triangles(const s32 v00, const s32 v01, const s32 v02, const s32 flag0,
|
||||
const s32 v10, const s32 v11, const s32 v12, const s32 flag1 );
|
||||
void gSP4Triangles(const s32 v00, const s32 v01, const s32 v02,
|
||||
const s32 v10, const s32 v11, const s32 v12,
|
||||
const s32 v20, const s32 v21, const s32 v22,
|
||||
const s32 v30, const s32 v31, const s32 v32 );
|
||||
void gSPTriangle(u32 v0, u32 v1, u32 v2);
|
||||
void gSP1Triangle(u32 v0, u32 v1, u32 v2);
|
||||
void gSP2Triangles(const u32 v00, const u32 v01, const u32 v02, const u32 flag0,
|
||||
const u32 v10, const u32 v11, const u32 v12, const u32 flag1 );
|
||||
void gSP4Triangles(const u32 v00, const u32 v01, const u32 v02,
|
||||
const u32 v10, const u32 v11, const u32 v12,
|
||||
const u32 v20, const u32 v21, const u32 v22,
|
||||
const u32 v30, const u32 v31, const u32 v32 );
|
||||
|
||||
void gSPLightVertex(SPVertex & _vtx);
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ u32 G_GOLDEN_MOVEWORD;
|
|||
void F3D_TriX(u32 w0, u32 w1)
|
||||
{
|
||||
while(w1 != 0) {
|
||||
s32 v0 = w1 & 0xf;
|
||||
u32 v0 = w1 & 0xf;
|
||||
w1 >>= 4;
|
||||
|
||||
s32 v1 = w1 & 0xf;
|
||||
u32 v1 = w1 & 0xf;
|
||||
w1 >>= 4;
|
||||
|
||||
s32 v2 = w0 & 0xf;
|
||||
u32 v2 = w0 & 0xf;
|
||||
w0 >>= 4;
|
||||
|
||||
gSPTriangle(v0, v1, v2);
|
||||
|
|
Loading…
Reference in New Issue
Block a user