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

The texture memory of the texture mapping units of the Glide renderer, and the textures the game downloads into it. More...

#include <glide.h>
#include <windows.h>
Include dependency graph for texturecache.h:

Go to the source code of this file.

Classes

struct  GlideTextureSlot
 A texture in the memory of a texture mapping unit. More...
struct  GlideTmuMemory
 The texture memory of a texture mapping unit that the textures have not taken. More...

Macros

#define GLIDE_TEXTURE_SLOT_COUNT   1024
 The number of entries of g_aGlideTextureSlots.
#define GLIDE_TMU_COUNT   2
 The number of entries of g_aGlideTmuMemory.
#define GLIDE_TMU_UPPER_REGION_ADDRESS   0x200000
 The address of texture memory where the upper region of a texture mapping unit begins.

Typedefs

typedef struct GlideTextureSlot GlideTextureSlot
 A texture in the memory of a texture mapping unit.
typedef struct GlideTmuMemory GlideTmuMemory
 The texture memory of a texture mapping unit that the textures have not taken.

Functions

void ResetGlideTmuTextureAllocator (void)
 Empty the texture memory of every texture mapping unit.
int AllocateGlideTmuTexture (int nTmu, unsigned char nEvenOdd, int nWidth, int nHeight, int nFormat, int nMipMapMode, int nSmallLod, int nLargeLod, int nAspectRatio, int nClampS, int nClampT, int nMinifyFilter, int nMagnifyFilter, float fLodBias, int nLodBlend)
 Take the texture memory for a texture and record how it is sampled.
void DownloadGlideTextureMipMap (unsigned nSlot, const void *pData, int nUnused)
 Download the texels of a texture into the memory of its texture mapping unit.
void BindGlideTextureSource (unsigned nSlot)
 Make a texture the source of its texture mapping unit, with its clamping, filters, level of detail bias, and mipmapping.
void AppendUniqueGlideErrorMessage (const char *pszMessage)
 Append a message and a space to g_szDebugOverlayText, unless the text already has the message.
int CreateGlideTextureFromRawImage (unsigned char *pPixels, int nWidth, int nHeight, int nFormat)
 Create a texture from texels already in a format of Glide.
int ConvertRgba32ToArgb1555 (unsigned char *pDest, const unsigned char *pSource, int nBytes)
 Convert pixels of eight bits a channel to ARGB1555, with the high bit of alpha.

Variables

GlideTmuMemory g_aGlideTmuMemory [GLIDE_TMU_COUNT]
 The texture memory of each texture mapping unit not yet taken.
GlideTextureSlot g_aGlideTextureSlots [GLIDE_TEXTURE_SLOT_COUNT]
 The textures in the memory of the texture mapping units.
unsigned g_dwGlideTextureSlotCount
 The number of entries of g_aGlideTextureSlots in use.
int g_nBoundTextureTmu
 The texture mapping unit the texture combine was set for last, or -1 for none.

Detailed Description

The texture memory of the texture mapping units of the Glide renderer, and the textures the game downloads into it.

Macro Definition Documentation

◆ GLIDE_TEXTURE_SLOT_COUNT

#define GLIDE_TEXTURE_SLOT_COUNT   1024

The number of entries of g_aGlideTextureSlots.

◆ GLIDE_TMU_COUNT

#define GLIDE_TMU_COUNT   2

The number of entries of g_aGlideTmuMemory.

◆ GLIDE_TMU_UPPER_REGION_ADDRESS

#define GLIDE_TMU_UPPER_REGION_ADDRESS   0x200000

The address of texture memory where the upper region of a texture mapping unit begins.

Typedef Documentation

◆ GlideTextureSlot

typedef struct GlideTextureSlot GlideTextureSlot

A texture in the memory of a texture mapping unit.

◆ GlideTmuMemory

typedef struct GlideTmuMemory GlideTmuMemory

The texture memory of a texture mapping unit that the textures have not taken.

Function Documentation

◆ ResetGlideTmuTextureAllocator()

void ResetGlideTmuTextureAllocator ( void )

Empty the texture memory of every texture mapping unit.

Ghidra address:
BRGlide: 0x100281c0

◆ AllocateGlideTmuTexture()

int AllocateGlideTmuTexture ( int nTmu,
unsigned char nEvenOdd,
int nWidth,
int nHeight,
int nFormat,
int nMipMapMode,
int nSmallLod,
int nLargeLod,
int nAspectRatio,
int nClampS,
int nClampT,
int nMinifyFilter,
int nMagnifyFilter,
float fLodBias,
int nLodBlend )

Take the texture memory for a texture and record how it is sampled.

Parameters
nTmuThe texture mapping unit.
nEvenOddThe levels of detail present, a GR_MIPMAPLEVELMASK_* value.
nWidthThe width of the texture, in texels.
nHeightThe height of the texture, in texels.
nFormatThe format of the texels, a GrTextureFormat_t.
nMipMapModeThe mipmapping mode, a GrMipMapMode_t.
nSmallLodThe smallest level of detail, a GrLOD_t.
nLargeLodThe largest level of detail, a GrLOD_t.
nAspectRatioThe aspect ratio, a GrAspectRatio_t.
nClampSThe clamping of s, a GrTextureClampMode_t.
nClampTThe clamping of t, a GrTextureClampMode_t.
nMinifyFilterThe minification filter, a GrTextureFilterMode_t.
nMagnifyFilterThe magnification filter, a GrTextureFilterMode_t.
fLodBiasThe level of detail bias.
nLodBlendWhether the levels of detail blend, an FxBool.
Returns
The entry of g_aGlideTextureSlots, or -1 when the slots or the memory run out.
Ghidra address:
BRGlide: 0x10028200

◆ DownloadGlideTextureMipMap()

void DownloadGlideTextureMipMap ( unsigned nSlot,
const void * pData,
int nUnused )

Download the texels of a texture into the memory of its texture mapping unit.

Parameters
nSlotThe entry of g_aGlideTextureSlots.
pDataThe texels.
nUnusedNot read.
Ghidra address:
BRGlide: 0x100283c0

◆ BindGlideTextureSource()

void BindGlideTextureSource ( unsigned nSlot)

Make a texture the source of its texture mapping unit, with its clamping, filters, level of detail bias, and mipmapping.

Parameters
nSlotThe entry of g_aGlideTextureSlots.
Ghidra address:
BRGlide: 0x10028420

◆ AppendUniqueGlideErrorMessage()

void AppendUniqueGlideErrorMessage ( const char * pszMessage)

Append a message and a space to g_szDebugOverlayText, unless the text already has the message.

Parameters
pszMessageThe message.
Ghidra address:
BRGlide: 0x1006ff50

◆ CreateGlideTextureFromRawImage()

int CreateGlideTextureFromRawImage ( unsigned char * pPixels,
int nWidth,
int nHeight,
int nFormat )

Create a texture from texels already in a format of Glide.

Parameters
pPixelsThe texels.
nWidthThe width, in texels.
nHeightThe height, in texels.
nFormatThe format of the texels, a GrTextureFormat_t.
Returns
The entry of g_pTextureEntries.
Ghidra address:
BRGlide: 0x10027fb0

◆ ConvertRgba32ToArgb1555()

int ConvertRgba32ToArgb1555 ( unsigned char * pDest,
const unsigned char * pSource,
int nBytes )

Convert pixels of eight bits a channel to ARGB1555, with the high bit of alpha.

Parameters
pDestReceives the converted pixels.
pSourceThe pixels to convert.
nBytesThe bytes of the pixels to convert.
Returns
The bytes written.
Ghidra address:
BRGlide: 0x10023cb0

Variable Documentation

◆ g_aGlideTmuMemory

GlideTmuMemory g_aGlideTmuMemory[GLIDE_TMU_COUNT]
extern

The texture memory of each texture mapping unit not yet taken.

Ghidra address:
BRGlide: 0x10661830

◆ g_aGlideTextureSlots

GlideTextureSlot g_aGlideTextureSlots[GLIDE_TEXTURE_SLOT_COUNT]
extern

The textures in the memory of the texture mapping units.

Ghidra address:
BRGlide: 0x10661840

◆ g_dwGlideTextureSlotCount

unsigned g_dwGlideTextureSlotCount
extern

The number of entries of g_aGlideTextureSlots in use.

Ghidra address:
BRGlide: 0x105d17ec

◆ g_nBoundTextureTmu

int g_nBoundTextureTmu
extern

The texture mapping unit the texture combine was set for last, or -1 for none.

Ghidra address:
BRGlide: 0x105e1820