1 #ifndef FRAMEBUFFER_H
2 #define FRAMEBUFFER_H
3 
4 #include <stdint.h>
5 
6 #include "DepthBuffer.h"
7 #include "Textures.h"
8 
9 struct FrameBuffer
10 {
11 	struct FrameBuffer *higher, *lower;
12 
13 	CachedTexture *texture;
14 
15 	uint32_t m_startAddress, m_endAddress;
16 	uint32_t m_size, m_width, m_height, m_fillcolor, m_validityChecked;
17 	float m_scaleX, m_scaleY;
18 
19 	bool m_copiedToRdram;
20 	bool m_cleared;
21 	bool m_changed;
22 	bool m_cfb;
23 	bool m_isDepthBuffer;
24 	bool m_isPauseScreen;
25 	bool m_isOBScreen;
26 	bool m_needHeightCorrection;
27 	bool m_postProcessed;
28 
29 	GLuint m_FBO;
30 	struct gDPTile *m_pLoadTile;
31 	CachedTexture *m_pTexture;
32 	struct DepthBuffer *m_pDepthBuffer;
33 	// multisampling
34 	CachedTexture *m_pResolveTexture;
35 	GLuint m_resolveFBO;
36 	bool m_resolved;
37 };
38 
39 struct FrameBufferInfo
40 {
41 	struct FrameBuffer *top, *bottom, *current;
42 	int numBuffers;
43 };
44 
45 extern struct FrameBufferInfo frameBuffer;
46 
47 void FrameBuffer_Init(void);
48 void FrameBuffer_Destroy(void);
49 void FrameBuffer_CopyToRDRAM( uint32_t _address );
50 void FrameBuffer_CopyFromRDRAM( uint32_t _address, bool _bUseAlpha );
51 void FrameBuffer_CopyDepthBuffer( uint32_t _address );
52 void FrameBuffer_ActivateBufferTexture( int16_t t, struct FrameBuffer *buffer);
53 void FrameBuffer_ActivateBufferTextureBG(int16_t t, struct FrameBuffer *buffer);
54 
55 void FrameBuffer_SaveBuffer( uint32_t address, uint16_t format, uint16_t size, uint16_t width, uint16_t height, bool unknown );
56 void FrameBuffer_RenderBuffer( uint32_t address );
57 void FrameBuffer_RestoreBuffer( uint32_t address, uint16_t size, uint16_t width );
58 void FrameBuffer_RemoveBuffer( uint32_t address );
59 struct FrameBuffer *FrameBuffer_FindBuffer( uint32_t address );
60 struct FrameBuffer *FrameBuffer_GetCurrent(void);
61 
62 #endif
63