1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00
GLideN64/src/BufferCopy/ColorBufferToRDRAM.h

58 lines
1.1 KiB
C
Raw Normal View History

#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>
#include <vector>
2017-01-23 07:43:40 +00:00
#include <Graphics/ObjectHandle.h>
2017-01-23 14:57:32 +00:00
namespace graphics {
class ColorBufferReader;
}
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);
static ColorBufferToRDRAM & get();
2017-01-23 14:57:32 +00:00
private:
ColorBufferToRDRAM();
ColorBufferToRDRAM(const ColorBufferToRDRAM &) = delete;
virtual ~ColorBufferToRDRAM();
union RGBA {
struct {
u8 r, g, b, a;
};
u32 raw;
};
2017-11-14 15:32:50 +00:00
bool _prepareCopy(u32& _startAddress);
void _copy(u32 _startAddress, u32 _endAddress, bool _sync);
// Convert pixel from video memory to N64 buffer format.
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);
FrameBuffer * m_pCurFrameBuffer;
u32 m_frameCount;
u32 m_startAddress;
2016-06-04 16:56:09 +00:00
static u32 m_blueNoiseIdx;
};
void copyWhiteToRDRAM(FrameBuffer * _pBuffer);
#endif // ColorBufferToRDRAM