mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Do not test values of 8bit buffer before write them to RDRAM.
Fixed copy of 8bit aux buffers to RDRAM. refs #2461
This commit is contained in:
parent
35554dabf0
commit
e09d153233
|
@ -320,16 +320,16 @@ void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
|
|||
if (m_pCurFrameBuffer->m_size == G_IM_SIZ_32b) {
|
||||
u32 *ptr_src = (u32*)pPixels;
|
||||
u32 *ptr_dst = (u32*)(RDRAM + _startAddress);
|
||||
writeToRdram<u32, u32>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA32, 0, 0, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
writeToRdram<u32, u32>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA32, valueTester<u32, 0>, 0, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
} else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_16b) {
|
||||
u32 *ptr_src = (u32*)pPixels;
|
||||
u16 *ptr_dst = (u16*)(RDRAM + _startAddress);
|
||||
m_blueNoiseIdx++;
|
||||
writeToRdram<u32, u16>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA16, 0, 1, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
writeToRdram<u32, u16>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA16, valueTester<u32, 0>, 1, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
} else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_8b) {
|
||||
u8 *ptr_src = (u8*)pPixels;
|
||||
u8 *ptr_dst = RDRAM + _startAddress;
|
||||
writeToRdram<u8, u8>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoR8, 0, 3, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
writeToRdram<u8, u8>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoR8, dummyTester<u8>, 3, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
}
|
||||
|
||||
m_pCurFrameBuffer->m_copiedToRdram = true;
|
||||
|
|
|
@ -255,7 +255,7 @@ bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress)
|
|||
writeToRdram<f32, u16>(srcBuf.data(),
|
||||
ptr_dst,
|
||||
&DepthBufferToRDRAM::_FloatToUInt16,
|
||||
2.0f,
|
||||
dummyTester<f32>,
|
||||
1,
|
||||
width,
|
||||
height,
|
||||
|
|
|
@ -4,8 +4,29 @@
|
|||
|
||||
#include "../Types.h"
|
||||
|
||||
template <typename T, T testValue>
|
||||
bool valueTester(T _c)
|
||||
{
|
||||
return _c != testValue;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool dummyTester(T _c)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename TSrc, typename TDst>
|
||||
void writeToRdram(TSrc* _src, TDst* _dst, TDst(*converter)(TSrc _c, u32 x, u32 y), TSrc _testValue, u32 _xor, u32 _width, u32 _height, u32 _numPixels, u32 _startAddress, u32 _bufferAddress, u32 _bufferSize)
|
||||
void writeToRdram(TSrc* _src, TDst* _dst,
|
||||
TDst(*converter)(TSrc _c, u32 x, u32 y),
|
||||
bool(*tester)(TSrc _c),
|
||||
u32 _xor,
|
||||
u32 _width,
|
||||
u32 _height,
|
||||
u32 _numPixels,
|
||||
u32 _startAddress,
|
||||
u32 _bufferAddress,
|
||||
u32 _bufferSize)
|
||||
{
|
||||
u32 chunkStart = ((_startAddress - _bufferAddress) >> (_bufferSize - 1)) % _width;
|
||||
if (chunkStart % 2 != 0) {
|
||||
|
@ -20,7 +41,7 @@ void writeToRdram(TSrc* _src, TDst* _dst, TDst(*converter)(TSrc _c, u32 x, u32 y
|
|||
if (chunkStart > 0) {
|
||||
for (u32 x = chunkStart; x < _width; ++x) {
|
||||
c = _src[x];
|
||||
if (c != _testValue)
|
||||
if (tester(c))
|
||||
_dst[numStored ^ _xor] = converter(c, x, y);
|
||||
++numStored;
|
||||
}
|
||||
|
@ -32,7 +53,7 @@ void writeToRdram(TSrc* _src, TDst* _dst, TDst(*converter)(TSrc _c, u32 x, u32 y
|
|||
for (; y < _height; ++y) {
|
||||
for (u32 x = 0; x < _width && numStored < _numPixels; ++x) {
|
||||
c = _src[x + y *_width];
|
||||
if (c != _testValue)
|
||||
if (tester(c))
|
||||
_dst[(x + dsty*_width) ^ _xor] = converter(c, x, y);
|
||||
++numStored;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user