2016-05-28 15:37:20 +00:00
|
|
|
#ifndef ColorBufferToRDRAM_H
|
|
|
|
#define ColorBufferToRDRAM_H
|
|
|
|
|
2017-01-23 14:57:32 +00:00
|
|
|
#include <memory>
|
2016-06-04 16:56:09 +00:00
|
|
|
#include <array>
|
2016-06-08 15:57:50 +00:00
|
|
|
#include <vector>
|
2017-01-23 07:43:40 +00:00
|
|
|
#include <Graphics/ObjectHandle.h>
|
2016-05-28 15:37:20 +00:00
|
|
|
|
2017-01-23 14:57:32 +00:00
|
|
|
namespace graphics {
|
|
|
|
class ColorBufferReader;
|
|
|
|
}
|
|
|
|
|
2016-05-28 15:37:20 +00:00
|
|
|
struct CachedTexture;
|
|
|
|
struct FrameBuffer;
|
|
|
|
|
|
|
|
class ColorBufferToRDRAM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void init();
|
|
|
|
void destroy();
|
|
|
|
|
|
|
|
void copyToRDRAM(u32 _address, bool _sync);
|
2017-11-14 15:32:50 +00:00
|
|
|
void copyChunkToRDRAM(u32 _startAddress);
|
2016-05-28 15:37:20 +00:00
|
|
|
|
|
|
|
static ColorBufferToRDRAM & get();
|
|
|
|
|
2017-01-23 14:57:32 +00:00
|
|
|
private:
|
2016-05-28 15:37:20 +00:00
|
|
|
ColorBufferToRDRAM();
|
2017-11-18 15:07:27 +00:00
|
|
|
ColorBufferToRDRAM(const ColorBufferToRDRAM &) = delete;
|
2016-05-29 09:30:20 +00:00
|
|
|
virtual ~ColorBufferToRDRAM();
|
|
|
|
|
2016-05-28 15:37:20 +00:00
|
|
|
union RGBA {
|
|
|
|
struct {
|
|
|
|
u8 r, g, b, a;
|
|
|
|
};
|
|
|
|
u32 raw;
|
|
|
|
};
|
|
|
|
|
2017-11-14 15:32:50 +00:00
|
|
|
bool _prepareCopy(u32& _startAddress);
|
2016-05-28 15:37:20 +00:00
|
|
|
|
|
|
|
void _copy(u32 _startAddress, u32 _endAddress, bool _sync);
|
|
|
|
|
|
|
|
// Convert pixel from video memory to N64 buffer format.
|
2020-02-26 18:18:50 +00:00
|
|
|
static u8 _RGBAtoR8(u8 _c, u32 x, u32 y);
|
|
|
|
static u16 _RGBAtoRGBA16(u32 _c, u32 x, u32 y);
|
|
|
|
static u32 _RGBAtoRGBA32(u32 _c, u32 x, u32 y);
|
2016-05-28 15:37:20 +00:00
|
|
|
|
|
|
|
FrameBuffer * m_pCurFrameBuffer;
|
|
|
|
u32 m_frameCount;
|
|
|
|
u32 m_startAddress;
|
2016-06-04 16:56:09 +00:00
|
|
|
|
2020-03-28 10:01:18 +00:00
|
|
|
static u32 m_blueNoiseIdx;
|
2016-05-28 15:37:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void copyWhiteToRDRAM(FrameBuffer * _pBuffer);
|
|
|
|
|
|
|
|
#endif // ColorBufferToRDRAM
|