resonance 1.0.1
Loading...
Searching...
No Matches
GsDoubleBuffer Class Reference

The display and draw environments of a double-buffered framebuffer. More...

#include <gsdoublebuffer.h>

Collaboration diagram for GsDoubleBuffer:

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 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.

Public Attributes

DispEnv mDisp [2]
 Display environments of the two halves.
DrawHalf mHalves [2]
 Draw environments of the two halves.
unsigned char mReserved260 [8]
short mWidth
 Width SetDefaults() recorded.
short mHeight
 Height SetDefaults() recorded.
short mPsm
 Frame buffer pixel storage format SetDefaults() recorded.
short mFbp0
 Page of buffer 0, always zero.
short mFbp1
 Page of buffer 1, the pages one buffer occupies.
short mZPsm
 Depth buffer pixel storage format SetDefaults() recorded.
short mZbp
 Page of the depth buffer, twice mFbp1.

Detailed Description

The display and draw environments of a double-buffered framebuffer.

This is the game's own structure rather than the SDK's sceGsDBuff. The SDK setter at 0x005e4b30 takes its arguments as (psm, w, h, ztest, zpsm, clear) and fills a 0x230-byte sceGsDBuff, whereas SetDefaults() takes (w, h, psm, ztest, zpsm, clear) and fills a structure whose draw halves begin at +0x80 and +0x170 and which 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. GfxDevice 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.

Member Function Documentation

◆ SetDefaults()

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 buffer 0 at page 0, buffer 1 after it, and the depth buffer after both, then builds the display and draw environments. The page count assumes 4 bytes per pixel for any format other than PSMCT24 and PSMCT16.

Parameters
nWidthWidth in pixels.
nHeightHeight in pixels.
nPsmPixel storage format of the frame buffers.
nZTestDepth test, where zero also masks depth writes.
nZPsmPixel storage format of the depth buffer.
nClearPassed through to SetDrawBuffersSmall() and never read.
Ghidra address:
NTSC-U/C: 0x0058e9b0
Ghidra address:
PAL: 0x005d1d08

Member Data Documentation

◆ mDisp

DispEnv GsDoubleBuffer::mDisp[2]

Display environments of the two halves.

+0x000

◆ mHalves

DrawHalf GsDoubleBuffer::mHalves[2]

Draw environments of the two halves.

+0x080

◆ mReserved260

unsigned char GsDoubleBuffer::mReserved260[8]

◆ mWidth

short GsDoubleBuffer::mWidth

Width SetDefaults() recorded.

+0x268

◆ mHeight

short GsDoubleBuffer::mHeight

Height SetDefaults() recorded.

+0x26a

◆ mPsm

short GsDoubleBuffer::mPsm

Frame buffer pixel storage format SetDefaults() recorded.

+0x26c

◆ mFbp0

short GsDoubleBuffer::mFbp0

Page of buffer 0, always zero.

+0x26e

◆ mFbp1

short GsDoubleBuffer::mFbp1

Page of buffer 1, the pages one buffer occupies.

+0x270

◆ mZPsm

short GsDoubleBuffer::mZPsm

Depth buffer pixel storage format SetDefaults() recorded.

+0x272

◆ mZbp

short GsDoubleBuffer::mZbp

Page of the depth buffer, twice mFbp1.

GfxDevice::GetReservedVramWords() reads it to find where the buffers end. +0x274


The documentation for this class was generated from the following file: