coastline 0.0.4
Loading...
Searching...
No Matches
displaylist.h File Reference

The interpreter of the display lists of the game in the PC port. More...

#include <array>
#include <windows.h>
#include "common/framestatistics.h"
#include "common/gbicommand.h"
#include "common/textureupload.h"
#include "common/vecmath.h"
#include <glide.h>
Include dependency graph for displaylist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GbiVertexSource
 The vertex a command of the display lists loaded. More...
struct  GbiVertex
 A vertex of the display lists after its transform. More...
struct  GbiClipPolygon
 A circular list of vertices undergoing homogeneous clipping. More...

Macros

#define GBI_DISPLAY_LIST_STACK_SIZE   10
 The number of entries of g_apGbiDisplayListReturnStack.
#define GBI_MATRIX_STACK_RESET_DEPTH   10
 The depth g_dwGbiMatrixStackDepth takes when a pop empties it.
#define GBI_LIGHT_COUNT   8
 The number of entries of g_aGbiLights.
#define GBI_VERTEX_CACHE_SIZE   128
 The number of entries of g_aGbiVertexCache and g_apVertexPool.
#define GBI_CLIP_VERTEX_POOL_SIZE   64
 The number of vertices available while clipping display-list geometry.
#define OVERLAY_DISPLAY_LIST_SIZE   0x8000
 The bytes of the display list of the text drawn over a frame.
#define OVERLAY_TEXT_SIZE   20
 The size of the text drawn over a frame.
#define OVERLAY_TEXT_X   0
 The left of the text drawn over a frame.
#define OVERLAY_TEXT_Y   60
 The top of the text drawn over a frame.
#define GBI_END_DISPLAY_LIST_W0   0xb8000000
 The first word of the command that ends a display list.
#define DEBUG_OVERLAY_TEXT_SIZE   0x408
 The size of g_szDebugOverlayText, the room before the next datum.
#define GBI_HANDLER_COUNT   256
 The number of entries of g_apfnGbiHandlers, one for each opcode.

Typedefs

using GbiLight = Light
 A light of the display lists, in the shared console format.
typedef struct GbiVertexSource GbiVertexSource
 The vertex a command of the display lists loaded, named for C and for both renderers.
typedef GbiCommand *(* GbiHandler) (GbiCommand *pCommand)
 A handler of a command of a display list.

Functions

void SelectVertexSubmitterForCombineMode (unsigned dwCombineHi, unsigned dwCombineLo)
 Choose the routine that submits vertices for a combine mode, and the colour of the combine modes that draw in one colour.
void ApplyGeometryModeChanges (void)
 Apply the geometry mode after a change: the culling and the comparison of depth of the device when they changed, and the handlers of vertices and triangles in g_apfnGbiHandlers.
GbiCommand * HandleGbiSetTexRectW (GbiCommand *pCommand)
 Set the scale of the width of a texture rectangle.
GbiCommand * HandleGbiSetTexRectDepth (GbiCommand *pCommand)
 Set the depth of a texture rectangle.
GbiCommand * HandleGbiSetCombine (GbiCommand *pCommand)
 Set the combine mode and choose the routine that submits vertices for it.
GbiCommand * HandleGbiClearGeometryMode (GbiCommand *pCommand)
 Clear bits of the geometry mode.
GbiCommand * HandleGbiSetGeometryMode (GbiCommand *pCommand)
 Set bits of the geometry mode.
GbiCommand * HandleGbiPopMatrix (GbiCommand *pCommand)
 Pop the stack of matrices.
GbiCommand * HandleGbiDisplayList (GbiCommand *pCommand)
 Branch to a display list, or call it when bits 16 to 23 of the first word are clear.
GbiCommand * HandleGbiNoOp (GbiCommand *pCommand)
 Skip a command.
void ApplyRdpRenderMode (unsigned dwRenderMode)
 Apply the blending, the depth, and the test of alpha of a render mode of the console.
GbiCommand * HandleGbiSetRenderMode (GbiCommand *pCommand)
 Set the render mode.
GbiCommand * HandleGbiSetOtherModeL (GbiCommand *pCommand)
 Set the low word of the other modes.
void DrawFillRectangle (int nLeft, int nTop, int nRight, int nBottom)
 Fill a rectangle of the screen with the fill colour.
GbiCommand * HandleGbiFillRectangleIntCoords (GbiCommand *pCommand)
 Fill a rectangle given in whole pixels of the console, whose rows run up from the bottom of the screen of the PC.
GbiCommand * HandleGbiFillRectangle (GbiCommand *pCommand)
 Fill a rectangle given in pixels of the console with two bits of fraction, whose rows run up from the bottom of the screen of the PC.
GbiCommand * HandleGbiSetFillColor (GbiCommand *pCommand)
 Set the fill colour from the RGBA 5551 colour in the low 16 bits of the command.
GbiCommand * HandleGbiSetEnvColor (GbiCommand *pCommand)
 Set the environment colour from the RGBA colour of the command.
void DrawTextureRectangle (int nUpperLeftX, int nUpperLeftY, int nLowerRightX, int nLowerRightY, int nTile)
 Draw a rectangle of a tile of texture.
GbiCommand * HandleGbiTextureRectangle (GbiCommand *pCommand)
 Draw a texture rectangle of a command of one word pair, its corners in pixels with two bits of fraction, as DrawTextureRectangle() reads them with four.
GbiCommand * HandleGbiTextureRectangleNative (GbiCommand *pCommand)
 Draw a texture rectangle of the console, which takes three commands, its corners as the console gives them.
GbiCommand * HandleGbiSetViewport (GbiCommand *pCommand)
 Set the viewport.
void HalveGbiTriangleVertexIndices (GbiCommand *pCommand)
 Convert the packed indices of a single-triangle command from doubled byte offsets to vertices.
void HalveGbiTrianglePairVertexIndices (GbiCommand *pCommand)
 Convert both packed triangle index triples from doubled byte offsets to vertices.
GbiCommand * HandleGbiMoveWord (GbiCommand *pCommand)
 Set the number of lights or the colour of a light.
GbiCommand * HandleGbiLoadMatrix (GbiCommand *pCommand)
 Copy the matrix of the command into g_GbiMvpMatrix.
GbiCommand * HandleGbiMoveMem (GbiCommand *pCommand)
 Set the viewport, a vector of the look-at, a light, or g_GbiMvpMatrix from memory.
GbiCommand * HandleGbiSetTileSize (GbiCommand *pCommand)
 Set the edges of the tile, and its width and height in whole texels.
GbiCommand * HandleGbiLoadPreparedTexture (GbiCommand *pCommand)
 Upload a texture the game loaded to its surface.
void ComputeVertexDirectionalLight (const ConvertedModelVertex *pVertex, GbiVertexSource *pDest)
 Light a vertex normal with the first directional light and the ambient colour.
int ComputeVertexClipCodes (const GbiVertexSource *pVertex)
 Mark every homogeneous clip plane outside pVertex, including unordered coordinates.
void TransformVertexToScreen (GrVertex *pDest, const GbiVertexSource *pSource, float fRed, float fGreen, float fBlue)
 Take a vertex inside the view to the screen with a colour, its position snapped to a quarter of a pixel.
GbiVertexSource * LerpVertexFromPool (const GbiVertexSource *pFirst, const GbiVertexSource *pSecond, float fFraction)
 Take a clipping vertex from the free list and interpolate its attributes.
void ClipPolygonPositiveWPlane (GbiClipPolygon *pPolygon)
 Clip a polygon to vertices with nonnegative homogeneous W.
void ClipPolygonLeftPlane (GbiClipPolygon *pPolygon)
 Clip a polygon against the left plane, where X is at least negative W.
void ClipPolygonRightPlane (GbiClipPolygon *pPolygon)
 Clip a polygon against the right plane, where X is at most W.
void ClipPolygonBottomPlane (GbiClipPolygon *pPolygon)
 Clip a polygon against the bottom plane, where Y is at least negative W.
void ClipPolygonTopPlane (GbiClipPolygon *pPolygon)
 Clip a polygon against the top plane, where Y is at most W.
void ClipPolygonNearZPlane (GbiClipPolygon *pPolygon)
 Clip a polygon against the near plane, where Z is at least negative W.
void ClipPolygonFarZPlane (GbiClipPolygon *pPolygon)
 Clip a polygon against the far plane, where Z is at most W.
void ScaleVertexTexCoords (GrVertex *pVertex, const GbiVertexSource *pSource)
 Scale the texture coordinates of a vertex as it was loaded into those of both units of the vertex, divided by its w.
void ClipAndSubmitTriangle (GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2)
 Clip a triangle to the planes of the view and submit what remains.
void ClipPolygonAndSubmitFlat (GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2, float fRed, float fGreen, float fBlue)
 Clip and submit a triangle with one colour for all surviving vertices.
void ClipPolygonAndSubmitDepthScaled (GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2, float fRed, float fGreen, float fBlue)
 Clip and submit a triangle with one colour at the fixed far depth.
void ClipAndSubmitTriangleAtFarDepth (GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2)
 Clip a triangle to the planes of the view and submit what remains at the far depth.
void RenderGbiDisplayListFrame (GbiCommand *pDisplayList)
 Draw a frame of the game: set the render states the display lists start from, run the display list and the text over the frame, show the frame, and record its time.
void BindTextureEntry (int nEntry)
 Bind an entry's device texture and stage its addressing, scale and active tile bounds.
GbiCommand * HandleGbiBindTextureEntry (GbiCommand *pCommand)
 Draw the triangles waiting, and bind a texture the game loaded in place of the commands that load it on the console.
GbiCommand * HandleGbiSetPrimColor (GbiCommand *pCommand)
 Set the primitive colour from the RGBA colour of the command.
GbiCommand * HandleGbiSetFogColor (GbiCommand *pCommand)
 Set the colour of the fog of the device from the RGBA colour of the command.
GbiCommand * HandleGbiSetScissor (GbiCommand *pCommand)
 Set the scissor from corners in pixels of the console with two bits of fraction, dropping the fractions, and clip the device to it.
GbiCommand * HandleGbiSetScissorIntCoords (GbiCommand *pCommand)
 Set the scissor from corners in whole pixels of the console, and clip the device to it.
GbiCommand * HandleGbiEndDisplayList (GbiCommand *pCommand)
 Return from a display list to the command after its call.
GbiCommand * HandleGbiMatrix (GbiCommand *pCommand)
 Multiply or load the projection or the model view matrix, and update g_GbiMvpMatrix.
GbiCommand * HandleGbiVertexUnlit (GbiCommand *pCommand)
 Load vertices without lighting.
GbiCommand * HandleGbiTri1Smooth (GbiCommand *pCommand)
 Draw one triangle with smooth shading, after giving the device the dirty render states.
GbiCommand * HandleGbiTri2Smooth (GbiCommand *pCommand)
 Draw two triangles with smooth shading, after giving the device the dirty render states.
GbiCommand * HandleGbiVertexLit (GbiCommand *pCommand)
 Load vertices with lighting.
GbiCommand * HandleGbiVertexLitEnvColorModulated (GbiCommand *pCommand)
 Load vertices with lighting modulated by the environment colour.
GbiCommand * HandleGbiVertexTexGen (GbiCommand *pCommand)
 Load vertices that generate their texture coordinates.
void GenerateGbiVertexTextureCoordinates (const ConvertedModelVertex *pInput, GbiVertexSource *pSource)
 Generate tile-relative texture coordinates from the transformed vertex normal.
void GenerateGbiVertexTextureCoordinatesLinear (const ConvertedModelVertex *pInput, GbiVertexSource *pSource)
 Generate texture coordinates with the linear-mode vertical arcsine mapping.
GbiCommand * HandleGbiVertexTexGenLinear (GbiCommand *pCommand)
 Load vertices that generate their texture coordinates linearly.
GbiCommand * HandleGbiVertexLitNoZBuffer (GbiCommand *pCommand)
 Load vertices with lighting without the depth buffer.
GbiCommand * HandleGbiVertexUnlitNoZBuffer (GbiCommand *pCommand)
 Load vertices without lighting without the depth buffer.
void DrawFlatShadedTriangle (int nVertex0, int nVertex1, int nVertex2)
 Draw a triangle of g_aGbiVertexCache in the colour of its first vertex.
GbiCommand * HandleGbiTri1Flat (GbiCommand *pCommand)
 Draw one triangle with flat shading, after giving the device the dirty render states.
GbiCommand * HandleGbiTri2Flat (GbiCommand *pCommand)
 Draw two triangles with flat shading, after giving the device the dirty render states.
void DrawFlatShadedTriangleDepthScaled (int nVertex0, int nVertex1, int nVertex2)
 Draw a triangle of g_aGbiVertexCache in the colour of its first vertex, without the depth buffer.
GbiCommand * HandleGbiTri1SmoothNoZBuffer (GbiCommand *pCommand)
 Draw one triangle with smooth shading without the depth buffer, after giving the device the dirty render states.
GbiCommand * HandleGbiTri2SmoothNoZBuffer (GbiCommand *pCommand)
 Draw two triangles with smooth shading without the depth buffer, after giving the device the dirty render states.
GbiCommand * HandleGbiTri1FlatNoZBuffer (GbiCommand *pCommand)
 Draw one triangle with flat shading without the depth buffer, after giving the device the dirty render states.
GbiCommand * HandleGbiTri2FlatNoZBuffer (GbiCommand *pCommand)
 Draw two triangles with flat shading without the depth buffer, after giving the device the dirty render states.
void ExecuteGbiDisplayList (GbiCommand *pCommand)
 Run a display list through g_apfnGbiHandlers until a handler returns nullptr.

Variables

float g_fTexRectScaleW
 The scale of the width of a texture rectangle.
float g_fTexRectDepth
 The depth of a texture rectangle.
unsigned g_dwGbiCombineModeHi
 The first word of the combine mode set last.
unsigned g_dwGbiCombineModeLo
 The second word of the combine mode set last.
unsigned g_dwGbiGeometryMode
 The geometry mode.
unsigned g_dwGbiPrevGeometryMode
 The geometry mode before the last change.
int g_dwGbiMatrixStackDepth
 The depth of the stack of matrices.
int g_dwGbiDisplayListStackDepth
 The number of entries of g_apGbiDisplayListReturnStack in use.
GbiCommand * g_apGbiDisplayListReturnStack [GBI_DISPLAY_LIST_STACK_SIZE]
 The commands that follow the calls of display lists, to return to.
unsigned g_dwGbiRenderMode
 The render mode of the console the display lists set last.
unsigned char g_bGbiFillColorR
 The red of the fill colour.
unsigned char g_bGbiFillColorG
 The green of the fill colour.
unsigned char g_bGbiFillColorB
 The blue of the fill colour.
unsigned char g_bGbiFillColorA
 The alpha of the fill colour, 0 or 255.
float g_fGbiEnvColorR
 The red of the environment colour, from 0 to 1.
float g_fGbiEnvColorG
 The green of the environment colour, from 0 to 1.
float g_fGbiEnvColorB
 The blue of the environment colour, from 0 to 1.
float g_fGbiEnvColorA
 The alpha of the environment colour, from 0 to 1.
float g_fGbiPrimColorR
 The red of the primitive colour, from 0 to 1.
float g_fGbiPrimColorG
 The green of the primitive colour, from 0 to 1.
float g_fGbiPrimColorB
 The blue of the primitive colour, from 0 to 1.
float g_fGbiPrimColorA
 The alpha of the primitive colour, from 0 to 1.
float g_fViewportScaleX
 The scale of x of the viewport, in pixels.
float g_fViewportScaleY
 The scale of y of the viewport, in pixels, negative for Direct3D.
float g_fViewportTranslateX
 The translation of x of the viewport, in pixels.
float g_fViewportTranslateY
 The translation of y of the viewport, in pixels, from the bottom of the screen for Glide.
int g_dwGbiNumLights
 The number of lights the display lists set, as their command gives it.
GbiLight g_aGbiLights [GBI_LIGHT_COUNT]
 The lights of the display lists.
int g_bGbiLightsTransformed
 Whether the lights were transformed since they last changed.
float g_GbiMvpMatrix [4][4]
 The matrix that takes a vertex of the display lists to the screen.
float g_GbiProjectionMatrix [4][4]
 The current projection matrix of the display-list interpreter.
float g_aGbiModelViewStack [GBI_MATRIX_STACK_RESET_DEPTH][4][4]
 The stack of model-view matrices used by display-list matrix commands.
const Light * g_pGbiLookAtY
 The second vector of the look-at of the display lists, as a move memory command gives it.
const Light * g_pGbiLookAtX
 The first vector of the look-at of the display lists, as a move memory command gives it.
int g_dwTileSizeUls
 The left edge of the tile, in texels with two bits of fraction.
int g_dwTileSizeUlt
 The top edge of the tile, in texels with two bits of fraction.
int g_dwTileSizeLrs
 The right edge of the tile, in texels with two bits of fraction.
int g_dwTileSizeLrt
 The bottom edge of the tile, in texels with two bits of fraction.
int g_dwTileSizeWidth
 The width of the tile, in whole texels.
int g_dwTileSizeHeight
 The height of the tile, in whole texels.
void(* g_pfnUploadTextureEntryToSurface )(int nEntry, TextureUploadData payload)
 Upload a texture the game loaded to its surface, set by InitializeTextureSubsystem().
float g_fGbiLight0ColorR
 The red channel of the first directional light.
float g_fGbiLight0ColorG
 The green channel of the first directional light.
float g_fGbiLight0ColorB
 The blue channel of the first directional light.
Vec3f g_GbiLight0Direction
 The direction of the first directional light.
float g_fGbiAmbientColorR
 The red channel of the ambient light.
float g_fGbiAmbientColorG
 The green channel of the ambient light.
float g_fGbiAmbientColorB
 The blue channel of the ambient light.
GbiVertexSource g_aClipVertexPool [GBI_CLIP_VERTEX_POOL_SIZE]
 The temporary vertices used while clipping display-list geometry.
GbiVertexSource * g_pVertexFreeList
 The first available clipping vertex in the pool, or NULL when the pool is full.
int g_bRdpBlendStateOverride
 Whether a render mode set the blend of the frame.
GbiVertex g_aGbiVertexCache [GBI_VERTEX_CACHE_SIZE]
 The vertices the display lists loaded.
float g_fTexCoordScaleS
 The scale from the s of a vertex to its u.
float g_fTexCoordScaleT
 The scale from the t of a vertex to its v.
char g_szDebugOverlayText [DEBUG_OVERLAY_TEXT_SIZE]
 The text drawn over each frame.
DWORD g_dwGbiLastFrameTime
 The time the last frame was shown, in milliseconds.
DWORD g_dwGbiFrameDeltaTime
 The time between the last two frames shown, in milliseconds.
void(* g_pfnBindTextureEntry )(int nEntry)
 Bind a texture the game loaded, set by InitializeTextureSubsystem().
int g_nBoundTextureEntry
 The entry whose texture is bound, or -1 after texture initialization.
int g_dwScissorLeft
 The left edge of the scissor, in pixels.
int g_dwScissorTop
 The top edge of the scissor, in pixels from the bottom of the screen.
int g_dwScissorRight
 The right edge of the scissor, in pixels.
int g_dwScissorBottom
 The bottom edge of the scissor, in pixels from the bottom of the screen.
int g_bCombineModeSpecialSubmitter
 Whether the combine mode takes the routine that modulates the lighting by the environment colour.
std::array< GbiHandler, GBI_HANDLER_COUNT > g_apfnGbiHandlers
 The handlers of the commands of the display lists, by the opcode in the high byte of the first word.

Detailed Description

The interpreter of the display lists of the game in the PC port.

Each handler runs one command and returns the command to run next.

Macro Definition Documentation

◆ GBI_DISPLAY_LIST_STACK_SIZE

#define GBI_DISPLAY_LIST_STACK_SIZE   10

The number of entries of g_apGbiDisplayListReturnStack.

◆ GBI_MATRIX_STACK_RESET_DEPTH

#define GBI_MATRIX_STACK_RESET_DEPTH   10

The depth g_dwGbiMatrixStackDepth takes when a pop empties it.

◆ GBI_LIGHT_COUNT

#define GBI_LIGHT_COUNT   8

The number of entries of g_aGbiLights.

◆ GBI_VERTEX_CACHE_SIZE

#define GBI_VERTEX_CACHE_SIZE   128

The number of entries of g_aGbiVertexCache and g_apVertexPool.

◆ GBI_CLIP_VERTEX_POOL_SIZE

#define GBI_CLIP_VERTEX_POOL_SIZE   64

The number of vertices available while clipping display-list geometry.

◆ OVERLAY_DISPLAY_LIST_SIZE

#define OVERLAY_DISPLAY_LIST_SIZE   0x8000

The bytes of the display list of the text drawn over a frame.

◆ OVERLAY_TEXT_SIZE

#define OVERLAY_TEXT_SIZE   20

The size of the text drawn over a frame.

◆ OVERLAY_TEXT_X

#define OVERLAY_TEXT_X   0

The left of the text drawn over a frame.

◆ OVERLAY_TEXT_Y

#define OVERLAY_TEXT_Y   60

The top of the text drawn over a frame.

◆ GBI_END_DISPLAY_LIST_W0

#define GBI_END_DISPLAY_LIST_W0   0xb8000000

The first word of the command that ends a display list.

◆ DEBUG_OVERLAY_TEXT_SIZE

#define DEBUG_OVERLAY_TEXT_SIZE   0x408

The size of g_szDebugOverlayText, the room before the next datum.

◆ GBI_HANDLER_COUNT

#define GBI_HANDLER_COUNT   256

The number of entries of g_apfnGbiHandlers, one for each opcode.

Typedef Documentation

◆ GbiLight

using GbiLight = Light

A light of the display lists, in the shared console format.

◆ GbiVertexSource

typedef struct GbiVertexSource GbiVertexSource

The vertex a command of the display lists loaded, named for C and for both renderers.

◆ GbiHandler

typedef GbiCommand *(* GbiHandler) (GbiCommand *pCommand)

A handler of a command of a display list.

Function Documentation

◆ SelectVertexSubmitterForCombineMode()

void SelectVertexSubmitterForCombineMode ( unsigned dwCombineHi,
unsigned dwCombineLo )

Choose the routine that submits vertices for a combine mode, and the colour of the combine modes that draw in one colour.

One combine mode takes the handler of lit vertices that modulates by the environment colour, and every other gives it up.

Parameters
dwCombineHiThe first word of the combine mode.
dwCombineLoThe second word of the combine mode.
Ghidra address:
BRD3D: 0x1001c820
Ghidra address:
BRGlide: 0x1001e7a0

◆ ApplyGeometryModeChanges()

void ApplyGeometryModeChanges ( void )

Apply the geometry mode after a change: the culling and the comparison of depth of the device when they changed, and the handlers of vertices and triangles in g_apfnGbiHandlers.

Ghidra address:
BRD3D: 0x1001e7c0
Ghidra address:
BRGlide: 0x1001fd70

◆ HandleGbiSetTexRectW()

GbiCommand * HandleGbiSetTexRectW ( GbiCommand * pCommand)

Set the scale of the width of a texture rectangle.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cd60
Ghidra address:
BRGlide: 0x1001eb10

◆ HandleGbiSetTexRectDepth()

GbiCommand * HandleGbiSetTexRectDepth ( GbiCommand * pCommand)

Set the depth of a texture rectangle.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cd80
Ghidra address:
BRGlide: 0x1001eb30

◆ HandleGbiSetCombine()

GbiCommand * HandleGbiSetCombine ( GbiCommand * pCommand)

Set the combine mode and choose the routine that submits vertices for it.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001c7f0
Ghidra address:
BRGlide: 0x1001e770

◆ HandleGbiClearGeometryMode()

GbiCommand * HandleGbiClearGeometryMode ( GbiCommand * pCommand)

Clear bits of the geometry mode.

Parameters
pCommandThe command, the bits in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001e790
Ghidra address:
BRGlide: 0x1001fd40

◆ HandleGbiSetGeometryMode()

GbiCommand * HandleGbiSetGeometryMode ( GbiCommand * pCommand)

Set bits of the geometry mode.

Parameters
pCommandThe command, the bits in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020f20
Ghidra address:
BRGlide: 0x100211e0

◆ HandleGbiPopMatrix()

GbiCommand * HandleGbiPopMatrix ( GbiCommand * pCommand)

Pop the stack of matrices.

A pop that empties it sets its depth to GBI_MATRIX_STACK_RESET_DEPTH.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020ef0
Ghidra address:
BRGlide: 0x100211b0

◆ HandleGbiDisplayList()

GbiCommand * HandleGbiDisplayList ( GbiCommand * pCommand)

Branch to a display list, or call it when bits 16 to 23 of the first word are clear.

A call that fills the last entry of g_apGbiDisplayListReturnStack exits the game.

Parameters
pCommandThe command.
Returns
The first command of the display list.
Ghidra address:
BRD3D: 0x10020d60
Ghidra address:
BRGlide: 0x10021020

◆ HandleGbiNoOp()

GbiCommand * HandleGbiNoOp ( GbiCommand * pCommand)

Skip a command.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x100243d0
Ghidra address:
BRGlide: 0x10021240

◆ ApplyRdpRenderMode()

void ApplyRdpRenderMode ( unsigned dwRenderMode)

Apply the blending, the depth, and the test of alpha of a render mode of the console.

Parameters
dwRenderModeThe render mode.
Ghidra address:
BRD3D: 0x10020fa0
Ghidra address:
BRGlide: 0x10021270

◆ HandleGbiSetRenderMode()

GbiCommand * HandleGbiSetRenderMode ( GbiCommand * pCommand)

Set the render mode.

Parameters
pCommandThe command, the render mode in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020f80
Ghidra address:
BRGlide: 0x10021250

◆ HandleGbiSetOtherModeL()

GbiCommand * HandleGbiSetOtherModeL ( GbiCommand * pCommand)

Set the low word of the other modes.

Only the render mode is applied, and the comparison of alpha and every other mode are skipped.

Parameters
pCommandThe command, the shift of the mode in bits 8 to 15 of its first word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020f50
Ghidra address:
BRGlide: 0x10021210

◆ DrawFillRectangle()

void DrawFillRectangle ( int nLeft,
int nTop,
int nRight,
int nBottom )

Fill a rectangle of the screen with the fill colour.

Parameters
nLeftThe left edge.
nTopThe top edge.
nRightThe right edge.
nBottomThe bottom edge.
Ghidra address:
BRD3D: 0x1001be90
Ghidra address:
BRGlide: 0x1001e380

◆ HandleGbiFillRectangleIntCoords()

GbiCommand * HandleGbiFillRectangleIntCoords ( GbiCommand * pCommand)

Fill a rectangle given in whole pixels of the console, whose rows run up from the bottom of the screen of the PC.

Parameters
pCommandThe command, the lower right corner in its first word and the upper left in its second, as signed fields of 12 bits.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001c7a0
Ghidra address:
BRGlide: 0x1001e720

◆ HandleGbiFillRectangle()

GbiCommand * HandleGbiFillRectangle ( GbiCommand * pCommand)

Fill a rectangle given in pixels of the console with two bits of fraction, whose rows run up from the bottom of the screen of the PC.

The fractions are dropped.

Parameters
pCommandThe command, the lower right corner in its first word and the upper left in its second.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001be30
Ghidra address:
BRGlide: 0x1001e320

◆ HandleGbiSetFillColor()

GbiCommand * HandleGbiSetFillColor ( GbiCommand * pCommand)

Set the fill colour from the RGBA 5551 colour in the low 16 bits of the command.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cc00
Ghidra address:
BRGlide: 0x1001e9f0

◆ HandleGbiSetEnvColor()

GbiCommand * HandleGbiSetEnvColor ( GbiCommand * pCommand)

Set the environment colour from the RGBA colour of the command.

Parameters
pCommandThe command, the colour in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cb40
Ghidra address:
BRGlide: 0x1001e930

◆ DrawTextureRectangle()

void DrawTextureRectangle ( int nUpperLeftX,
int nUpperLeftY,
int nLowerRightX,
int nLowerRightY,
int nTile )

Draw a rectangle of a tile of texture.

Parameters
nUpperLeftXThe left edge.
nUpperLeftYThe top edge.
nLowerRightXThe right edge.
nLowerRightYThe bottom edge.
nTileThe tile.
Ghidra address:
BRD3D: 0x10021560
Ghidra address:
BRGlide: 0x100215c0

◆ HandleGbiTextureRectangle()

GbiCommand * HandleGbiTextureRectangle ( GbiCommand * pCommand)

Draw a texture rectangle of a command of one word pair, its corners in pixels with two bits of fraction, as DrawTextureRectangle() reads them with four.

Parameters
pCommandThe command, the lower right corner in its first word, and the tile and the upper left corner in its second.
Returns
The next command.
Ghidra address:
BRD3D: 0x10021b80
Ghidra address:
BRGlide: 0x100219d0

◆ HandleGbiTextureRectangleNative()

GbiCommand * HandleGbiTextureRectangleNative ( GbiCommand * pCommand)

Draw a texture rectangle of the console, which takes three commands, its corners as the console gives them.

Parameters
pCommandThe first command, the lower right corner in its first word, and the tile and the upper left corner in its second.
Returns
The command after the three.
Ghidra address:
BRD3D: 0x10021510
Ghidra address:
BRGlide: 0x10021570

◆ HandleGbiSetViewport()

GbiCommand * HandleGbiSetViewport ( GbiCommand * pCommand)

Set the viewport.

Direct3D turns its y over through the scale, and Glide through the translation from the height of the screen.

Parameters
pCommandThe command, the viewport in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10024260
Ghidra address:
BRGlide: 0x10023920

◆ HalveGbiTriangleVertexIndices()

void HalveGbiTriangleVertexIndices ( GbiCommand * pCommand)

Convert the packed indices of a single-triangle command from doubled byte offsets to vertices.

Ghidra address:
BRD3D: 0x1002c190
Ghidra address:
BRGlide: 0x10019250

◆ HalveGbiTrianglePairVertexIndices()

void HalveGbiTrianglePairVertexIndices ( GbiCommand * pCommand)

Convert both packed triangle index triples from doubled byte offsets to vertices.

Ghidra address:
BRD3D: 0x1002c1b0
Ghidra address:
BRGlide: 0x10019270

◆ HandleGbiMoveWord()

GbiCommand * HandleGbiMoveWord ( GbiCommand * pCommand)

Set the number of lights or the colour of a light.

Every other word is skipped.

Parameters
pCommandThe command, the index of the word in the low byte of its first word.
Returns
The next command.
Ghidra address:
BRD3D: 0x100242f0
Ghidra address:
BRGlide: 0x100239c0

◆ HandleGbiLoadMatrix()

GbiCommand * HandleGbiLoadMatrix ( GbiCommand * pCommand)

Copy the matrix of the command into g_GbiMvpMatrix.

Parameters
pCommandThe command, the matrix in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10024240
Ghidra address:
BRGlide: 0x10023900

◆ HandleGbiMoveMem()

GbiCommand * HandleGbiMoveMem ( GbiCommand * pCommand)

Set the viewport, a vector of the look-at, a light, or g_GbiMvpMatrix from memory.

Every other index is skipped.

Parameters
pCommandThe command, the index in bits 16 to 23 of its first word and the size of a light in its low 16 bits.
Returns
The next command.
Ghidra address:
BRD3D: 0x10024150
Ghidra address:
BRGlide: 0x10023810

◆ HandleGbiSetTileSize()

GbiCommand * HandleGbiSetTileSize ( GbiCommand * pCommand)

Set the edges of the tile, and its width and height in whole texels.

Parameters
pCommandThe command, the upper left corner in its first word and the lower right in its second, as signed fields of 12 bits.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cf30
Ghidra address:
BRGlide: 0x1001ec30

◆ HandleGbiLoadPreparedTexture()

GbiCommand * HandleGbiLoadPreparedTexture ( GbiCommand * pCommand)

Upload a texture the game loaded to its surface.

Parameters
pCommandThe command, the entry of the texture in the low 24 bits of its first word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001be10
Ghidra address:
BRGlide: 0x1001e300

◆ ComputeVertexDirectionalLight()

void ComputeVertexDirectionalLight ( const ConvertedModelVertex * pVertex,
GbiVertexSource * pDest )

Light a vertex normal with the first directional light and the ambient colour.

Ghidra address:
BRD3D: 0x10022350
Ghidra address:
BRGlide: 0x10022ac0

◆ ComputeVertexClipCodes()

int ComputeVertexClipCodes ( const GbiVertexSource * pVertex)

Mark every homogeneous clip plane outside pVertex, including unordered coordinates.

Returns
A bit mask of the failed plane tests, or zero for a vertex inside the view.
Ghidra address:
BRD3D: 0x10022dc0
Ghidra address:
BRGlide: 0x10022120

◆ TransformVertexToScreen()

void TransformVertexToScreen ( GrVertex * pDest,
const GbiVertexSource * pSource,
float fRed,
float fGreen,
float fBlue )

Take a vertex inside the view to the screen with a colour, its position snapped to a quarter of a pixel.

Parameters
pDestThe vertex on the screen.
pSourceThe vertex as it was loaded.
fRedThe red, from 0 to 255.
fGreenThe green, from 0 to 255.
fBlueThe blue, from 0 to 255.
Ghidra address:
BRGlide: 0x10022070

◆ LerpVertexFromPool()

GbiVertexSource * LerpVertexFromPool ( const GbiVertexSource * pFirst,
const GbiVertexSource * pSecond,
float fFraction )

Take a clipping vertex from the free list and interpolate its attributes.

Ghidra address:
BRD3D: 0x1001d940
Ghidra address:
BRGlide: 0x1001f200

◆ ClipPolygonPositiveWPlane()

void ClipPolygonPositiveWPlane ( GbiClipPolygon * pPolygon)

Clip a polygon to vertices with nonnegative homogeneous W.

Ghidra address:
BRD3D: 0x1001d810
Ghidra address:
BRGlide: 0x1001f0d0

◆ ClipPolygonLeftPlane()

void ClipPolygonLeftPlane ( GbiClipPolygon * pPolygon)

Clip a polygon against the left plane, where X is at least negative W.

Ghidra address:
BRD3D: 0x1001d9f0
Ghidra address:
BRGlide: 0x1001f2b0

◆ ClipPolygonRightPlane()

void ClipPolygonRightPlane ( GbiClipPolygon * pPolygon)

Clip a polygon against the right plane, where X is at most W.

Ghidra address:
BRD3D: 0x1001db30
Ghidra address:
BRGlide: 0x1001f3f0

◆ ClipPolygonBottomPlane()

void ClipPolygonBottomPlane ( GbiClipPolygon * pPolygon)

Clip a polygon against the bottom plane, where Y is at least negative W.

Ghidra address:
BRD3D: 0x1001dc70
Ghidra address:
BRGlide: 0x1001f530

◆ ClipPolygonTopPlane()

void ClipPolygonTopPlane ( GbiClipPolygon * pPolygon)

Clip a polygon against the top plane, where Y is at most W.

Ghidra address:
BRD3D: 0x1001ddb0
Ghidra address:
BRGlide: 0x1001f670

◆ ClipPolygonNearZPlane()

void ClipPolygonNearZPlane ( GbiClipPolygon * pPolygon)

Clip a polygon against the near plane, where Z is at least negative W.

Ghidra address:
BRD3D: 0x1001def0
Ghidra address:
BRGlide: 0x1001f7b0

◆ ClipPolygonFarZPlane()

void ClipPolygonFarZPlane ( GbiClipPolygon * pPolygon)

Clip a polygon against the far plane, where Z is at most W.

Ghidra address:
BRD3D: 0x1001e030
Ghidra address:
BRGlide: 0x1001f8f0

◆ ScaleVertexTexCoords()

void ScaleVertexTexCoords ( GrVertex * pVertex,
const GbiVertexSource * pSource )

Scale the texture coordinates of a vertex as it was loaded into those of both units of the vertex, divided by its w.

Parameters
pVertexThe vertex.
pSourceThe vertex as it was loaded.
Ghidra address:
BRGlide: 0x1001fcf0

◆ ClipAndSubmitTriangle()

void ClipAndSubmitTriangle ( GbiVertex * pVertex0,
GbiVertex * pVertex1,
GbiVertex * pVertex2 )

Clip a triangle to the planes of the view and submit what remains.

Parameters
pVertex0The first vertex.
pVertex1The second vertex.
pVertex2The third vertex.
Ghidra address:
BRD3D: 0x1001d420
Ghidra address:
BRGlide: 0x1001ee70

◆ ClipPolygonAndSubmitFlat()

void ClipPolygonAndSubmitFlat ( GbiVertex * pVertex0,
GbiVertex * pVertex1,
GbiVertex * pVertex2,
float fRed,
float fGreen,
float fBlue )

Clip and submit a triangle with one colour for all surviving vertices.

Parameters
pVertex0The first vertex.
pVertex1The second vertex.
pVertex2The third vertex.
fRedThe red of the triangle.
fGreenThe green of the triangle.
fBlueThe blue of the triangle.
Ghidra address:
BRD3D: 0x1001eeb0
Ghidra address:
BRGlide: 0x10020190

◆ ClipPolygonAndSubmitDepthScaled()

void ClipPolygonAndSubmitDepthScaled ( GbiVertex * pVertex0,
GbiVertex * pVertex1,
GbiVertex * pVertex2,
float fRed,
float fGreen,
float fBlue )

Clip and submit a triangle with one colour at the fixed far depth.

Parameters
pVertex0The first vertex.
pVertex1The second vertex.
pVertex2The third vertex.
fRedThe red of the triangle.
fGreenThe green of the triangle.
fBlueThe blue of the triangle.
Ghidra address:
BRD3D: 0x1001f7e0
Ghidra address:
BRGlide: 0x10020690

◆ ClipAndSubmitTriangleAtFarDepth()

void ClipAndSubmitTriangleAtFarDepth ( GbiVertex * pVertex0,
GbiVertex * pVertex1,
GbiVertex * pVertex2 )

Clip a triangle to the planes of the view and submit what remains at the far depth.

Parameters
pVertex0The first vertex.
pVertex1The second vertex.
pVertex2The third vertex.
Ghidra address:
BRD3D: 0x1001ff90
Ghidra address:
BRGlide: 0x10020a80

◆ RenderGbiDisplayListFrame()

void RenderGbiDisplayListFrame ( GbiCommand * pDisplayList)

Draw a frame of the game: set the render states the display lists start from, run the display list and the text over the frame, show the frame, and record its time.

With Direct3D the frame is drawn in a scene, surfaces lost are restored, and the frame is dropped when the scene cannot start or end.

Parameters
pDisplayListThe display list of the frame.
Ghidra address:
BRD3D: 0x10024550
Ghidra address:
BRGlide: 0x10023b70

◆ BindTextureEntry()

void BindTextureEntry ( int nEntry)

Bind an entry's device texture and stage its addressing, scale and active tile bounds.

Parameters
nEntryThe loaded texture entry.
Ghidra address:
BRD3D: 0x10028ca0
Ghidra address:
BRGlide: 0x100284e0

◆ HandleGbiBindTextureEntry()

GbiCommand * HandleGbiBindTextureEntry ( GbiCommand * pCommand)

Draw the triangles waiting, and bind a texture the game loaded in place of the commands that load it on the console.

Parameters
pCommandThe command, the entry of g_pTextureEntries in the low 24 bits of its first word and the number of commands it replaces in its second.
Returns
The command after those it replaces.
Ghidra address:
BRD3D: 0x1001bd70
Ghidra address:
BRGlide: 0x1001e2e0

◆ HandleGbiSetPrimColor()

GbiCommand * HandleGbiSetPrimColor ( GbiCommand * pCommand)

Set the primitive colour from the RGBA colour of the command.

Parameters
pCommandThe command, the colour in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cca0
Ghidra address:
BRGlide: 0x1001ea80

◆ HandleGbiSetFogColor()

GbiCommand * HandleGbiSetFogColor ( GbiCommand * pCommand)

Set the colour of the fog of the device from the RGBA colour of the command.

Parameters
pCommandThe command, the colour in its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cc70
Ghidra address:
BRGlide: 0x1001ea60

◆ HandleGbiSetScissor()

GbiCommand * HandleGbiSetScissor ( GbiCommand * pCommand)

Set the scissor from corners in pixels of the console with two bits of fraction, dropping the fractions, and clip the device to it.

Parameters
pCommandThe command, the upper left corner in its first word and the lower right in its second.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cda0
Ghidra address:
BRGlide: 0x1001eb50

◆ HandleGbiSetScissorIntCoords()

GbiCommand * HandleGbiSetScissorIntCoords ( GbiCommand * pCommand)

Set the scissor from corners in whole pixels of the console, and clip the device to it.

Parameters
pCommandThe command, the upper left corner in its first word and the lower right in its second.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001ce70
Ghidra address:
BRGlide: 0x1001ebc0

◆ HandleGbiEndDisplayList()

GbiCommand * HandleGbiEndDisplayList ( GbiCommand * pCommand)

Return from a display list to the command after its call.

Parameters
pCommandThe command.
Returns
The command after the call, or nullptr at the end of the display list of the frame.
Ghidra address:
BRD3D: 0x10020da0
Ghidra address:
BRGlide: 0x10021060

◆ HandleGbiMatrix()

GbiCommand * HandleGbiMatrix ( GbiCommand * pCommand)

Multiply or load the projection or the model view matrix, and update g_GbiMvpMatrix.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020dc0
Ghidra address:
BRGlide: 0x10021080

◆ HandleGbiVertexUnlit()

GbiCommand * HandleGbiVertexUnlit ( GbiCommand * pCommand)

Load vertices without lighting.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10021bd0
Ghidra address:
BRGlide: 0x10021a20

◆ HandleGbiTri1Smooth()

GbiCommand * HandleGbiTri1Smooth ( GbiCommand * pCommand)

Draw one triangle with smooth shading, after giving the device the dirty render states.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of the triangle in the low three bytes of its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001cff0
Ghidra address:
BRGlide: 0x1001ecf0

◆ HandleGbiTri2Smooth()

GbiCommand * HandleGbiTri2Smooth ( GbiCommand * pCommand)

Draw two triangles with smooth shading, after giving the device the dirty render states.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of each triangle in the low three bytes of each word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001e170
Ghidra address:
BRGlide: 0x1001fa30

◆ HandleGbiVertexLit()

GbiCommand * HandleGbiVertexLit ( GbiCommand * pCommand)

Load vertices with lighting.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10021e80
Ghidra address:
BRGlide: 0x10021c70

◆ HandleGbiVertexLitEnvColorModulated()

GbiCommand * HandleGbiVertexLitEnvColorModulated ( GbiCommand * pCommand)

Load vertices with lighting modulated by the environment colour.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10022480
Ghidra address:
BRGlide: 0x100221d0

◆ HandleGbiVertexTexGen()

GbiCommand * HandleGbiVertexTexGen ( GbiCommand * pCommand)

Load vertices that generate their texture coordinates.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x100228f0
Ghidra address:
BRGlide: 0x10022600

◆ GenerateGbiVertexTextureCoordinates()

void GenerateGbiVertexTextureCoordinates ( const ConvertedModelVertex * pInput,
GbiVertexSource * pSource )

Generate tile-relative texture coordinates from the transformed vertex normal.

Parameters
pInputThe converted model vertex.
pSourceThe vertex that receives the texture coordinates.
Ghidra address:
BRD3D: 0x10022e70

◆ GenerateGbiVertexTextureCoordinatesLinear()

void GenerateGbiVertexTextureCoordinatesLinear ( const ConvertedModelVertex * pInput,
GbiVertexSource * pSource )

Generate texture coordinates with the linear-mode vertical arcsine mapping.

Parameters
pInputThe converted model vertex.
pSourceThe vertex that receives the texture coordinates.
Ghidra address:
BRD3D: 0x100236a0

◆ HandleGbiVertexTexGenLinear()

GbiCommand * HandleGbiVertexTexGenLinear ( GbiCommand * pCommand)

Load vertices that generate their texture coordinates linearly.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x100231d0
Ghidra address:
BRGlide: 0x10022bf0

◆ HandleGbiVertexLitNoZBuffer()

GbiCommand * HandleGbiVertexLitNoZBuffer ( GbiCommand * pCommand)

Load vertices with lighting without the depth buffer.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10023cc0
Ghidra address:
BRGlide: 0x10023360

◆ HandleGbiVertexUnlitNoZBuffer()

GbiCommand * HandleGbiVertexUnlitNoZBuffer ( GbiCommand * pCommand)

Load vertices without lighting without the depth buffer.

Parameters
pCommandThe command.
Returns
The next command.
Ghidra address:
BRD3D: 0x10023a10
Ghidra address:
BRGlide: 0x10023110

◆ DrawFlatShadedTriangle()

void DrawFlatShadedTriangle ( int nVertex0,
int nVertex1,
int nVertex2 )

Draw a triangle of g_aGbiVertexCache in the colour of its first vertex.

Parameters
nVertex0The entry of the first vertex, whose colour the triangle takes.
nVertex1The entry of the second vertex.
nVertex2The entry of the third vertex.
Ghidra address:
BRD3D: 0x1001ec20
Ghidra address:
BRGlide: 0x1001ff60

◆ HandleGbiTri1Flat()

GbiCommand * HandleGbiTri1Flat ( GbiCommand * pCommand)

Draw one triangle with flat shading, after giving the device the dirty render states.

The top byte of the second word chooses the vertex whose colour the triangle takes.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of the triangle in the low three bytes of its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001e980
Ghidra address:
BRGlide: 0x1001fef0

◆ HandleGbiTri2Flat()

GbiCommand * HandleGbiTri2Flat ( GbiCommand * pCommand)

Draw two triangles with flat shading, after giving the device the dirty render states.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of each triangle in the low three bytes of each word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020380
Ghidra address:
BRGlide: 0x10020cf0

◆ DrawFlatShadedTriangleDepthScaled()

void DrawFlatShadedTriangleDepthScaled ( int nVertex0,
int nVertex1,
int nVertex2 )

Draw a triangle of g_aGbiVertexCache in the colour of its first vertex, without the depth buffer.

Parameters
nVertex0The entry of the first vertex, whose colour the triangle takes.
nVertex1The entry of the second vertex.
nVertex2The entry of the third vertex.
Ghidra address:
BRD3D: 0x1001f550
Ghidra address:
BRGlide: 0x10020460

◆ HandleGbiTri1SmoothNoZBuffer()

GbiCommand * HandleGbiTri1SmoothNoZBuffer ( GbiCommand * pCommand)

Draw one triangle with smooth shading without the depth buffer, after giving the device the dirty render states.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of the triangle in the low three bytes of its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001fbe0
Ghidra address:
BRGlide: 0x10020900

◆ HandleGbiTri2SmoothNoZBuffer()

GbiCommand * HandleGbiTri2SmoothNoZBuffer ( GbiCommand * pCommand)

Draw two triangles with smooth shading without the depth buffer, after giving the device the dirty render states.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of each triangle in the low three bytes of each word.
Returns
The next command.
Ghidra address:
BRD3D: 0x10020860
Ghidra address:
BRGlide: 0x10020d70

◆ HandleGbiTri1FlatNoZBuffer()

GbiCommand * HandleGbiTri1FlatNoZBuffer ( GbiCommand * pCommand)

Draw one triangle with flat shading without the depth buffer, after giving the device the dirty render states.

The top byte of the second word chooses the vertex whose colour the triangle takes.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of the triangle in the low three bytes of its second word.
Returns
The next command.
Ghidra address:
BRD3D: 0x1001f2b0
Ghidra address:
BRGlide: 0x100203f0

◆ HandleGbiTri2FlatNoZBuffer()

GbiCommand * HandleGbiTri2FlatNoZBuffer ( GbiCommand * pCommand)

Draw two triangles with flat shading without the depth buffer, after giving the device the dirty render states.

Parameters
pCommandThe command, the entries of g_aGbiVertexCache of each triangle in the low three bytes of each word.
Returns
The next command.
Ghidra address:
BRD3D: 0x100205f0
Ghidra address:
BRGlide: 0x10020d30

◆ ExecuteGbiDisplayList()

void ExecuteGbiDisplayList ( GbiCommand * pCommand)

Run a display list through g_apfnGbiHandlers until a handler returns nullptr.

Parameters
pCommandThe first command, or nullptr for none.
Ghidra address:
BRD3D: 0x10024a90
Ghidra address:
BRGlide: 0x10023c90

Variable Documentation

◆ g_fTexRectScaleW

float g_fTexRectScaleW
extern

The scale of the width of a texture rectangle.

Ghidra address:
BRD3D: 0x100a79e8
Ghidra address:
BRGlide: 0x100a9a54

◆ g_fTexRectDepth

float g_fTexRectDepth
extern

The depth of a texture rectangle.

Ghidra address:
BRD3D: 0x104c5174
Ghidra address:
BRGlide: 0x105d17c4

◆ g_dwGbiCombineModeHi

unsigned g_dwGbiCombineModeHi
extern

The first word of the combine mode set last.

Ghidra address:
BRD3D: 0x104c5158
Ghidra address:
BRGlide: 0x105d17ac

◆ g_dwGbiCombineModeLo

unsigned g_dwGbiCombineModeLo
extern

The second word of the combine mode set last.

Ghidra address:
BRD3D: 0x104c515c
Ghidra address:
BRGlide: 0x105d17b0

◆ g_dwGbiGeometryMode

unsigned g_dwGbiGeometryMode
extern

The geometry mode.

Ghidra address:
BRD3D: 0x104c5178
Ghidra address:
BRGlide: 0x105d17c8

◆ g_dwGbiPrevGeometryMode

unsigned g_dwGbiPrevGeometryMode
extern

The geometry mode before the last change.

Ghidra address:
BRD3D: 0x104c517c
Ghidra address:
BRGlide: 0x105d17cc

◆ g_dwGbiMatrixStackDepth

int g_dwGbiMatrixStackDepth
extern

The depth of the stack of matrices.

Ghidra address:
BRD3D: 0x100a79dc
Ghidra address:
BRGlide: 0x100a9a50

◆ g_dwGbiDisplayListStackDepth

int g_dwGbiDisplayListStackDepth
extern

The number of entries of g_apGbiDisplayListReturnStack in use.

Ghidra address:
BRD3D: 0x104c01a4
Ghidra address:
BRGlide: 0x105ccfe8

◆ g_apGbiDisplayListReturnStack

GbiCommand* g_apGbiDisplayListReturnStack[GBI_DISPLAY_LIST_STACK_SIZE]
extern

The commands that follow the calls of display lists, to return to.

Ghidra address:
BRD3D: 0x104c16a8
Ghidra address:
BRGlide: 0x105ce2e8

◆ g_dwGbiRenderMode

unsigned g_dwGbiRenderMode
extern

The render mode of the console the display lists set last.

Ghidra address:
BRD3D: 0x104c1694
Ghidra address:
BRGlide: 0x105ce2d4

◆ g_bGbiFillColorR

unsigned char g_bGbiFillColorR
extern

The red of the fill colour.

Ghidra address:
BRD3D: 0x104bbf00
Ghidra address:
BRGlide: 0x105ccd40

◆ g_bGbiFillColorG

unsigned char g_bGbiFillColorG
extern

The green of the fill colour.

Ghidra address:
BRD3D: 0x104bc194
Ghidra address:
BRGlide: 0x105ccfd8

◆ g_bGbiFillColorB

unsigned char g_bGbiFillColorB
extern

The blue of the fill colour.

Ghidra address:
BRD3D: 0x104c5150
Ghidra address:
BRGlide: 0x105d17a0

◆ g_bGbiFillColorA

unsigned char g_bGbiFillColorA
extern

The alpha of the fill colour, 0 or 255.

Ghidra address:
BRD3D: 0x104c15cc
Ghidra address:
BRGlide: 0x105ce208

◆ g_fGbiEnvColorR

float g_fGbiEnvColorR
extern

The red of the environment colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104bbf04
Ghidra address:
BRGlide: 0x105ccd44

◆ g_fGbiEnvColorG

float g_fGbiEnvColorG
extern

The green of the environment colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104c0bac
Ghidra address:
BRGlide: 0x105cd9f4

◆ g_fGbiEnvColorB

float g_fGbiEnvColorB
extern

The blue of the environment colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104bbeb8
Ghidra address:
BRGlide: 0x105cccf8

◆ g_fGbiEnvColorA

float g_fGbiEnvColorA
extern

The alpha of the environment colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104bbe2c
Ghidra address:
BRGlide: 0x105ccc74

◆ g_fGbiPrimColorR

float g_fGbiPrimColorR
extern

The red of the primitive colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104c5154
Ghidra address:
BRGlide: 0x105d17a4

◆ g_fGbiPrimColorG

float g_fGbiPrimColorG
extern

The green of the primitive colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104c5160
Ghidra address:
BRGlide: 0x105d17b4

◆ g_fGbiPrimColorB

float g_fGbiPrimColorB
extern

The blue of the primitive colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104c1690
Ghidra address:
BRGlide: 0x105ce2d0

◆ g_fGbiPrimColorA

float g_fGbiPrimColorA
extern

The alpha of the primitive colour, from 0 to 1.

Ghidra address:
BRD3D: 0x104c0ba8
Ghidra address:
BRGlide: 0x105cd9f0

◆ g_fViewportScaleX

float g_fViewportScaleX
extern

The scale of x of the viewport, in pixels.

Ghidra address:
BRD3D: 0x104bbf08
Ghidra address:
BRGlide: 0x105ccd48

◆ g_fViewportScaleY

float g_fViewportScaleY
extern

The scale of y of the viewport, in pixels, negative for Direct3D.

Ghidra address:
BRD3D: 0x104bc198
Ghidra address:
BRGlide: 0x105ccfdc

◆ g_fViewportTranslateX

float g_fViewportTranslateX
extern

The translation of x of the viewport, in pixels.

Ghidra address:
BRD3D: 0x104c0bb0
Ghidra address:
BRGlide: 0x105cd9f8

◆ g_fViewportTranslateY

float g_fViewportTranslateY
extern

The translation of y of the viewport, in pixels, from the bottom of the screen for Glide.

Ghidra address:
BRD3D: 0x104c0bb8
Ghidra address:
BRGlide: 0x105cd9fc

◆ g_dwGbiNumLights

int g_dwGbiNumLights
extern

The number of lights the display lists set, as their command gives it.

Ghidra address:
BRD3D: 0x104bc190
Ghidra address:
BRGlide: 0x105ccfd0

◆ g_aGbiLights

GbiLight g_aGbiLights[GBI_LIGHT_COUNT]
extern

The lights of the display lists.

Ghidra address:
BRD3D: 0x104bbe38
Ghidra address:
BRGlide: 0x105ccc78

◆ g_bGbiLightsTransformed

int g_bGbiLightsTransformed
extern

Whether the lights were transformed since they last changed.

Ghidra address:
BRD3D: 0x104c5180
Ghidra address:
BRGlide: 0x105d17d0

◆ g_GbiMvpMatrix

float g_GbiMvpMatrix[4][4]
extern

The matrix that takes a vertex of the display lists to the screen.

Ghidra address:
BRD3D: 0x104c4d10
Ghidra address:
BRGlide: 0x105d1760

◆ g_GbiProjectionMatrix

float g_GbiProjectionMatrix[4][4]
extern

The current projection matrix of the display-list interpreter.

Ghidra address:
BRD3D: 0x104bbec0
Ghidra address:
BRGlide: 0x105ccd00

◆ g_aGbiModelViewStack

float g_aGbiModelViewStack[GBI_MATRIX_STACK_RESET_DEPTH][4][4]
extern

The stack of model-view matrices used by display-list matrix commands.

Ghidra address:
BRD3D: 0x104bbf10
Ghidra address:
BRGlide: 0x105ccd50

◆ g_pGbiLookAtY

const Light* g_pGbiLookAtY
extern

The second vector of the look-at of the display lists, as a move memory command gives it.

Ghidra address:
BRD3D: 0x104c1698
Ghidra address:
BRGlide: 0x105ce2d8

◆ g_pGbiLookAtX

const Light* g_pGbiLookAtX
extern

The first vector of the look-at of the display lists, as a move memory command gives it.

Ghidra address:
BRD3D: 0x104c169c
Ghidra address:
BRGlide: 0x105ce2dc

◆ g_dwTileSizeUls

int g_dwTileSizeUls
extern

The left edge of the tile, in texels with two bits of fraction.

Ghidra address:
BRD3D: 0x118aa080
Ghidra address:
BRGlide: 0x118ed198

◆ g_dwTileSizeUlt

int g_dwTileSizeUlt
extern

The top edge of the tile, in texels with two bits of fraction.

Ghidra address:
BRD3D: 0x11829838
Ghidra address:
BRGlide: 0x1186c950

◆ g_dwTileSizeLrs

int g_dwTileSizeLrs
extern

The right edge of the tile, in texels with two bits of fraction.

Ghidra address:
BRD3D: 0x1182983c
Ghidra address:
BRGlide: 0x1186c954

◆ g_dwTileSizeLrt

int g_dwTileSizeLrt
extern

The bottom edge of the tile, in texels with two bits of fraction.

Ghidra address:
BRD3D: 0x118a9870
Ghidra address:
BRGlide: 0x118ec988

◆ g_dwTileSizeWidth

int g_dwTileSizeWidth
extern

The width of the tile, in whole texels.

Ghidra address:
BRD3D: 0x11829840
Ghidra address:
BRGlide: 0x1186c958

◆ g_dwTileSizeHeight

int g_dwTileSizeHeight
extern

The height of the tile, in whole texels.

Ghidra address:
BRD3D: 0x118aa094
Ghidra address:
BRGlide: 0x118ed1ac

◆ g_pfnUploadTextureEntryToSurface

void(* g_pfnUploadTextureEntryToSurface) (int nEntry, TextureUploadData payload) ( int nEntry,
TextureUploadData payload )
extern

Upload a texture the game loaded to its surface, set by InitializeTextureSubsystem().

Ghidra address:
BRD3D: 0x118aa0b8
Ghidra address:
BRGlide: 0x118ed1d0

◆ g_fGbiLight0ColorR

float g_fGbiLight0ColorR
extern

The red channel of the first directional light.

Ghidra address:
BRD3D: 0x104c15d0
Ghidra address:
BRGlide: 0x105ce210

◆ g_fGbiLight0ColorG

float g_fGbiLight0ColorG
extern

The green channel of the first directional light.

Ghidra address:
BRD3D: 0x104c15d4
Ghidra address:
BRGlide: 0x105ce214

◆ g_fGbiLight0ColorB

float g_fGbiLight0ColorB
extern

The blue channel of the first directional light.

Ghidra address:
BRD3D: 0x104c15d8
Ghidra address:
BRGlide: 0x105ce218

◆ g_GbiLight0Direction

Vec3f g_GbiLight0Direction
extern

The direction of the first directional light.

Ghidra address:
BRD3D: 0x104c15dc
Ghidra address:
BRGlide: 0x105ce21c

◆ g_fGbiAmbientColorR

float g_fGbiAmbientColorR
extern

The red channel of the ambient light.

Ghidra address:
BRD3D: 0x104c15e8
Ghidra address:
BRGlide: 0x105ce228

◆ g_fGbiAmbientColorG

float g_fGbiAmbientColorG
extern

The green channel of the ambient light.

Ghidra address:
BRD3D: 0x104c15ec
Ghidra address:
BRGlide: 0x105ce22c

◆ g_fGbiAmbientColorB

float g_fGbiAmbientColorB
extern

The blue channel of the ambient light.

Ghidra address:
BRD3D: 0x104c15f0
Ghidra address:
BRGlide: 0x105ce230

◆ g_aClipVertexPool

GbiVertexSource g_aClipVertexPool[GBI_CLIP_VERTEX_POOL_SIZE]
extern

The temporary vertices used while clipping display-list geometry.

Ghidra address:
BRD3D: 0x104c01a8
Ghidra address:
BRGlide: 0x105ccff0

◆ g_pVertexFreeList

GbiVertexSource* g_pVertexFreeList
extern

The first available clipping vertex in the pool, or NULL when the pool is full.

Ghidra address:
BRD3D: 0x104c0bbc
Ghidra address:
BRGlide: 0x105cda00

◆ g_bRdpBlendStateOverride

int g_bRdpBlendStateOverride
extern

Whether a render mode set the blend of the frame.

The render modes after it do not change the blend.

Ghidra address:
BRD3D: 0x104c5184
Ghidra address:
BRGlide: 0x105d17d4

◆ g_aGbiVertexCache

GbiVertex g_aGbiVertexCache[GBI_VERTEX_CACHE_SIZE]
extern

The vertices the display lists loaded.

Ghidra address:
BRD3D: 0x104c16d0
Ghidra address:
BRGlide: 0x105ce318

◆ g_fTexCoordScaleS

float g_fTexCoordScaleS
extern

The scale from the s of a vertex to its u.

Ghidra address:
BRD3D: 0x118aa08c
Ghidra address:
BRGlide: 0x118ed1a4

◆ g_fTexCoordScaleT

float g_fTexCoordScaleT
extern

The scale from the t of a vertex to its v.

Ghidra address:
BRD3D: 0x118aa090
Ghidra address:
BRGlide: 0x118ed1a8

◆ g_szDebugOverlayText

char g_szDebugOverlayText[DEBUG_OVERLAY_TEXT_SIZE]
extern

The text drawn over each frame.

BRD3D never writes it, and BRGlide appends the errors of its texture memory to it.

Ghidra address:
BRD3D: 0x118ab478
Ghidra address:
BRGlide: 0x118ee590

◆ g_dwGbiLastFrameTime

DWORD g_dwGbiLastFrameTime
extern

The time the last frame was shown, in milliseconds.

Ghidra address:
BRD3D: 0x104c5194
Ghidra address:
BRGlide: 0x105d17dc

◆ g_dwGbiFrameDeltaTime

DWORD g_dwGbiFrameDeltaTime
extern

The time between the last two frames shown, in milliseconds.

Ghidra address:
BRD3D: 0x104c5198
Ghidra address:
BRGlide: 0x105d17e0

◆ g_pfnBindTextureEntry

void(* g_pfnBindTextureEntry) (int nEntry) ( int nEntry)
extern

Bind a texture the game loaded, set by InitializeTextureSubsystem().

Ghidra address:
BRD3D: 0x118aa0b4
Ghidra address:
BRGlide: 0x118ed1cc

◆ g_nBoundTextureEntry

int g_nBoundTextureEntry
extern

The entry whose texture is bound, or -1 after texture initialization.

Ghidra address:
BRD3D: 0x104d51b8
Ghidra address:
BRGlide: 0x105e1808

◆ g_dwScissorLeft

int g_dwScissorLeft
extern

The left edge of the scissor, in pixels.

Ghidra address:
BRD3D: 0x104c516c
Ghidra address:
BRGlide: 0x105d17bc

◆ g_dwScissorTop

int g_dwScissorTop
extern

The top edge of the scissor, in pixels from the bottom of the screen.

Ghidra address:
BRD3D: 0x104c01a0
Ghidra address:
BRGlide: 0x105ccfe0

◆ g_dwScissorRight

int g_dwScissorRight
extern

The right edge of the scissor, in pixels.

Ghidra address:
BRD3D: 0x104c5164
Ghidra address:
BRGlide: 0x105d17b8

◆ g_dwScissorBottom

int g_dwScissorBottom
extern

The bottom edge of the scissor, in pixels from the bottom of the screen.

Ghidra address:
BRD3D: 0x104c5170
Ghidra address:
BRGlide: 0x105d17c0

◆ g_bCombineModeSpecialSubmitter

int g_bCombineModeSpecialSubmitter
extern

Whether the combine mode takes the routine that modulates the lighting by the environment colour.

Ghidra address:
BRD3D: 0x104c0dc0
Ghidra address:
BRGlide: 0x105cda04

◆ g_apfnGbiHandlers

std::array<GbiHandler, GBI_HANDLER_COUNT> g_apfnGbiHandlers
extern

The handlers of the commands of the display lists, by the opcode in the high byte of the first word.

Every opcode without a handler of its own takes HandleGbiNoOp().

Ghidra address:
BRD3D: 0x100a79f0
Ghidra address:
BRGlide: 0x100a9a58