1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00
GLideN64/src/DepthBuffer.h

75 lines
1.7 KiB
C
Raw Normal View History

#ifndef DEPTHBUFFER_H
#define DEPTHBUFFER_H
#include "Types.h"
2013-11-27 10:08:48 +00:00
#include "Textures.h"
struct DepthBuffer
{
2014-09-08 11:00:13 +00:00
DepthBuffer();
DepthBuffer(DepthBuffer && _other);
~DepthBuffer();
2015-01-27 16:00:06 +00:00
void initDepthImageTexture(FrameBuffer * _pBuffer);
void initDepthBufferTexture(FrameBuffer * _pBuffer);
CachedTexture * resolveDepthBufferTexture(FrameBuffer * _pBuffer);
2015-01-27 16:00:06 +00:00
void setDepthAttachment(GLenum _target);
void activateDepthBufferTexture(FrameBuffer * _pBuffer);
2015-01-27 16:00:06 +00:00
void bindDepthImageTexture();
2014-09-08 11:00:13 +00:00
u32 m_address, m_width;
u32 m_uly, m_lry; // Top and bottom bounds of fillrect command.
2014-09-08 11:00:13 +00:00
GLuint m_FBO;
2015-01-27 16:00:06 +00:00
CachedTexture *m_pDepthImageTexture;
CachedTexture *m_pDepthBufferTexture;
bool m_cleared;
// multisampling
CachedTexture *m_pResolveDepthBufferTexture;
bool m_resolved;
private:
void _initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture *_pTexture, bool _multisample);
};
2014-09-08 11:00:13 +00:00
class DepthBufferList
{
2014-09-08 11:00:13 +00:00
public:
void init();
void destroy();
void saveBuffer(u32 _address);
void removeBuffer(u32 _address);
void clearBuffer(u32 _uly, u32 _lry);
void setNotCleared();
2014-09-08 11:00:13 +00:00
DepthBuffer *findBuffer(u32 _address);
DepthBuffer * getCurrent() const {return m_pCurrent;}
static DepthBufferList & get();
const u16 * const getZLUT() const {return m_pzLUT;}
private:
DepthBufferList();
DepthBufferList(const FrameBufferList &);
~DepthBufferList();
2014-09-08 11:00:13 +00:00
typedef std::list<DepthBuffer> DepthBuffers;
DepthBuffers m_list;
DepthBuffer *m_pCurrent;
u16 * m_pzLUT;
};
inline
DepthBufferList & depthBufferList()
{
return DepthBufferList::get();
}
2013-12-14 14:30:20 +00:00
extern const GLuint ZlutImageUnit;
extern const GLuint TlutImageUnit;
extern const GLuint depthImageUnit;
void DepthBuffer_Init();
void DepthBuffer_Destroy();
#endif