|
wavelength 1.0.0
|
The display and draw environments of a double-buffered framebuffer. More...
#include <gsdoublebuffer.h>
Classes | |
| struct | DispEnv |
| One display environment, 0x40 bytes. More... | |
| struct | DrawHalf |
| One draw environment preceded by its GIFtag and followed by its clear, 0xf0 bytes. More... | |
Public Member Functions | |
| void | SetBufferPages (short nWidth, short nHeight, short nPsm) |
| Place buffer 0 at page 0, buffer 1 after it, and the depth buffer after both. | |
| void | SetDefaults (short nWidth, short nHeight, short nPsm, short nZTest, short nZPsm, short nClear) |
| Fill both halves for a framebuffer and a depth buffer laid out from page 0. | |
| void | SetDispBuffers (short nWidth, short nHeight, short nPsm, short nFbp0, short nFbp1) |
| Build both display environments. | |
| void | SetDrawBuffersSmall (short nWidth, short nHeight, short nPsm, short nFbp0, short nFbp1, short nZbp, short nZTest, short nZPsm, short nClear) |
| Build both draw environments, their GIFtags, and their clears. | |
| void | PutDispBuffer (int nHalf, int bEnableCircuit1) |
| Write one display environment to the privileged GS registers. | |
| void | PutDrawBufferSmall (int nHalf, int bClear) |
| Send one draw environment to the GS through the SDK. | |
| short | GetZbp () const |
| Display environments of the two halves. | |
| DrawHalf & | GetHalf (int nHalf) |
| Report one of the two buffers. | |
| const DrawHalf & | GetHalf (int nHalf) const |
| Report one of the two buffers. | |
The display and draw environments of a double-buffered framebuffer.
This is the game's own structure rather than the SDK's sceGsDBuff. Its draw halves begin at +0x80 and +0x170, and it records its parameters from +0x268 on. The extra room at the front comes from each display environment recording a second pair of display registers for read circuit 1 beside the SDK's pair for read circuit 2.
The two read circuits show the same buffer one line apart, and PMODE blends them at half strength. SetDispBuffers() builds both pairs.
The class is not polymorphic and has no RTTI, and no literal in the image identifies it. Its name and the names of its members are inferred from what the routines below do with it. Ps addresses the one instance at an uncached address and reads the draw environments and the depth buffer page directly with no accessor. The data members are therefore public.
| void GsDoubleBuffer::SetBufferPages | ( | short | nWidth, |
| short | nHeight, | ||
| short | nPsm ) |
Place buffer 0 at page 0, buffer 1 after it, and the depth buffer after both.
The page count assumes 4 bytes per pixel for any format other than PSMCT24 and PSMCT16. The name is inferred.
| nWidth | Width in pixels. |
| nHeight | Height in pixels. |
| nPsm | Pixel storage format of the frame buffers. |
| void GsDoubleBuffer::SetDefaults | ( | short | nWidth, |
| short | nHeight, | ||
| short | nPsm, | ||
| short | nZTest, | ||
| short | nZPsm, | ||
| short | nClear ) |
Fill both halves for a framebuffer and a depth buffer laid out from page 0.
Records the geometry, places the buffers with SetBufferPages(), then builds the display and draw environments.
| nWidth | Width in pixels. |
| nHeight | Height in pixels. |
| nPsm | Pixel storage format of the frame buffers. |
| nZTest | Depth test, where zero also masks depth writes. |
| nZPsm | Pixel storage format of the depth buffer. |
| nClear | Passed through to SetDrawBuffersSmall() and never read. |
| void GsDoubleBuffer::SetDispBuffers | ( | short | nWidth, |
| short | nHeight, | ||
| short | nPsm, | ||
| short | nFbp0, | ||
| short | nFbp1 ) |
Build both display environments.
Each takes the SDK defaults with PMODE blending at 0x80 and both circuits enabled. Circuit 1 shows the buffer as the SDK set it, and circuit 2 starts one line lower, one line shorter, and two units to the right.
| nWidth | Width in pixels. |
| nHeight | Height in pixels. |
| nPsm | Pixel storage format. |
| nFbp0 | Page of buffer 0. |
| nFbp1 | Page of buffer 1. |
| void GsDoubleBuffer::SetDrawBuffersSmall | ( | short | nWidth, |
| short | nHeight, | ||
| short | nPsm, | ||
| short | nFbp0, | ||
| short | nFbp1, | ||
| short | nZbp, | ||
| short | nZTest, | ||
| short | nZPsm, | ||
| short | nClear ) |
Build both draw environments, their GIFtags, and their clears.
| nWidth | Width in pixels. |
| nHeight | Height in pixels. |
| nPsm | Pixel storage format of the frame buffers. |
| nFbp0 | Page of buffer 0. |
| nFbp1 | Page of buffer 1. |
| nZbp | Page of the depth buffer. |
| nZTest | Depth test, where zero also masks depth writes. |
| nZPsm | Pixel storage format of the depth buffer. |
| nClear | Never read. The caller passes it in the tenth argument slot on the stack. |
| void GsDoubleBuffer::PutDispBuffer | ( | int | nHalf, |
| int | bEnableCircuit1 ) |
Write one display environment to the privileged GS registers.
Read circuit 2 is always enabled. Circuit 1 is enabled or disabled by bEnableCircuit1, and the choice is stored back into the environment.
| nHalf | Zero for half 0, anything else for half 1. |
| bEnableCircuit1 | Non-zero to enable read circuit 1. |
| void GsDoubleBuffer::PutDrawBufferSmall | ( | int | nHalf, |
| int | bClear ) |
Send one draw environment to the GS through the SDK.
Both GIFtags receive the loop count first. The choice of clear therefore persists into the other half.
| nHalf | Zero for half 0, anything else for half 1. |
| bClear | Non-zero to send the clear with the environment. |
|
inline |
Display environments of the two halves.
+0x000
|
inline |
Report one of the two buffers.
| nHalf | The buffer, 0 or 1. |
|
inline |
Report one of the two buffers.
| nHalf | The buffer, 0 or 1. |