53#define RENDER_BACKEND_MODE_D3D 1
55#define RENDER_BACKEND_MODE_GLIDE 3
59#define RENDER_BACKEND_MODE RENDER_BACKEND_MODE_D3D
61#define RENDER_BACKEND_MODE RENDER_BACKEND_MODE_GLIDE
183int ResetRenderDeviceCallbacks(
void);
190void InitGbiD3DRenderer(
void);
198void ClearRenderTargetOnce(
void);
263int ComputeMipChainByteSize(
int nSmallLod,
int nLargeLod,
int nAspectRatio,
int nPixelFormatId);
298#define VERTEX_CONV_CACHE_SIZE 0x800
374#define TEXTURE_MAP_ENTRY_COUNT 256
406#define TEXTURE_UPLOAD_QUEUE_SIZE 256
556 const unsigned char *,
578 const unsigned char *pPalette,
795 const unsigned char *pSource,
851#define TEXTURE_RESAMPLE_BUFFER_BYTES 0x80000
893 const unsigned char *pImage,
894 const unsigned char *pPalette,
911 unsigned nRowSwapMask);
935 unsigned char *pImage,
936 const unsigned char *pPalette);
983 const unsigned char *pImage,
984 const unsigned char *pPalette,
1009 const unsigned char *pPalette,
The state the renderer shares between the parts of a frame.
The damage textures of the vehicles of the PC release.
The graphics binary interface types the gu routines fill in for the RSP microcode.
The byte swapping and the relocation of the pointers of the data the game loads from files.
#define g_pfnRenderBackendSubmitDisplayList
Submit a terminated display list through the active renderer.
Definition renderbackend.h:302
A model vertex converted into the renderer's working format.
Definition convertedvertex.h:7
A command of a display list of the game.
Definition gbicommand.h:30
A texture of a model and its palette.
Definition render.h:63
A tile recorded by texture scans and loaded texture entries.
Definition texturetile.h:8
Image metadata shared by texture entries and temporary texture conversions.
Definition textureentry.h:21
A texture of the console that a texture of another size replaces, from the texture map.
Definition render.h:366
int nHeight
Definition render.h:370
unsigned dwAddress
Definition render.h:368
int nWidth
Definition render.h:369
unsigned nId
Definition render.h:367
A texture waiting in g_aTextureUploadQueue.
Definition textureupload.h:23
A run of vertices of the console converted to floats.
Definition render.h:291
const Vtx * pSource
Definition render.h:292
int nVertexCount
Definition render.h:293
ConvertedModelVertex * pFloatVerts
Definition render.h:294
The track data a race loads below the program: its triangles and placed models, and the route the veh...
The source or converted vertex data referenced by a display-list command.
Definition gbicommand.h:24
A texture upload receives numeric command data or a pixel buffer.
Definition textureupload.h:7
A vertex for the RSP, with a colour or with a normal.
Definition gbi.h:75
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...
void CreateWeatherShadeTexture(void)
Create a uniform intensity texture for the chosen weather.
void InitGbiGlideRenderer(void)
Start the renderer of the display lists of the game with Glide.
void LoadParticleTexture(void)
Create the texture of the particles, 64 by 64 texels.
void InitializeTextureSubsystem(void)
Start the texture subsystem.
void RelocateGbiVertexCommand(GbiCommand *pCommand)
Relocate a display-list vertex command's source address and cache its converted vertices.
void InitializeRenderSubsystems(int nMode)
Start the renderer of a mode: reset the device, start the texture subsystem and the renderer,...
VertexConvCacheEntry g_aVertexConvCache[VERTEX_CONV_CACHE_SIZE]
The runs of vertices converted.
int g_dwRenderBackendMode
The mode of the renderer, 0 before one is set.
int CloneTextureEntryWithNewImageData(int nEntry, unsigned char *pImage, const unsigned char *pPalette)
Clone texture metadata with replacement image and palette bytes.
int GetMipLevelFromDimension(int nDimension)
Get the exponent of the smallest power of two from 1 to 256 not below a dimension of a texture.
int g_dwTextureLoadCategory
The category of the textures loaded next.
unsigned CreateTextureFromN64ImageAutoLoadSize(const unsigned char *pImage, const unsigned char *pPalette, int nWidth, int nHeight, int nSize, int nFormat, int nOption6, int nOption7, int nOption8, int nOption9, int nOption10, int nOption11, int nOption12, int nOption13)
Calculate the image load size from nWidth and delegate texture creation to the renderer.
decltype(&CloneTextureEntryWithNewImageData) g_pfnCloneTextureEntryWithNewImageData
The backend callback that clones a texture entry with replacement image data.
void CreateDeviceTextureFromImageHeader(ModelTexture *pTexture, int nOption13)
Replace a static model texture's image with its loaded device texture entry.
void SetTextureEntryDamageLevel(int nEntry, int nDamageLevel)
Set the level of damage of a texture the game loaded.
TextureMapEntry g_aTextureMapEntries[TEXTURE_MAP_ENTRY_COUNT]
The entries the texture map file lists.
void ConvertN64VerticesCached(ModelVertexData *pVertices, int nCount)
Reuse converted vertices for a previously seen source array, or convert and cache them.
int g_dwMaxTexWidthHighQuality
The maximum high-quality texture width, in texels.
int GetTexelsPerLoadWord(int nSize)
Get the texels of a word of 8 bytes of the texture memory of the console for a size of texel.
int CalculateTextureAspectRatio(int *pAspectRatio, int nWidth, int nHeight)
Select an aspect ratio code from the truncated ratio of the dimensions.
void ReloadTextureEntryData(int nEntry)
Decode a loaded entry again and upload the resulting pixels.
int g_dwMaxTexHeightHighQuality
The maximum high-quality texture height, in texels.
int g_dwCurrentMaxTextureHeight
The height limit selected for the current texture category.
unsigned char g_abAlphaRampPixelStrip[64]
The alpha ramp converted to device pixel format.
unsigned RegisterTextureEntry(const TextureImageData *pImage, int nTextureId)
Append image metadata and a device texture identifier to the loaded entries.
ConvertedModelVertex * g_pModelDataPoolCursor
The next free entry of g_afModelVertexPool.
int GetTexturePixelSize(int nPixelFormatId)
Get the decoded bytes per texture pixel.
int FindMatchingTextureEntry(const TextureImageData *pImage)
Find an entry with the same image, palette and applicable captured colors.
int(* g_pfnRenderDeviceReset)(void)
Reset the render device, set by SetRenderBackendMode().
void UploadTrackTextureVariants(ModelTexture *pTextures, int nCount)
Create device textures for animated track frames and replace their image offsets with entries.
void ModulateTextureWithIntensityPlane(const TextureImageData *pImage, unsigned char *pPixels)
Modulate decoded RGB by the half-sized intensity plane following its pixels.
unsigned ResizeTextureMipChain(unsigned char *pDest, const unsigned char *pSource, TextureImageData *pImage)
Resize consecutive decoded mip levels and record the decoded source dimensions.
void UploadTextureEntryToSurface(int nEntry, TextureUploadData payload)
Copy a supplied pixel buffer into the device texture of a loaded entry.
void CalculateTextureDimensions(int *pWidth, int *pHeight, int nLod, int nAspectRatio)
Get the size of a texture from the codes of Glide for its level of detail and its aspect ratio.
int CreateTextureFromImage(TextureImageData *pImage, unsigned char *pPixels)
Create a device texture from captured metadata and decoded pixels.
void(* g_pfnReloadTextureEntryData)(int nEntry)
Load the data of a texture the game loaded again, set by InitializeTextureSubsystem().
int g_dwMaxTexHeightLowQuality
The maximum low-quality texture height, in texels.
void ShutdownTextureSubsystem(void)
Stop texture uploads and release texture surfaces and owned paint buffers.
int ChooseTexturePixelFormat(int nSize, int nFormat, int bColorCombine)
Select a device pixel format from N64 texture size, format and combine state.
void ResizeTextureImage(unsigned char *pDest, int width, int height, const unsigned char *pSource, int sourceWidth, int sourceHeight, int nPixelFormatId)
Resize a decoded texture with bilinear sampling at pixel centers.
void RefreshScreenDimensions(void)
Refresh screen dimensions from the configured framebuffer size.
unsigned char g_abAlphaRampRgba[16][4]
The 16 white RGBA colours of the alpha ramp, with alpha increasing by 17.
#define TEXTURE_RESAMPLE_BUFFER_BYTES
The bytes of g_abTextureResampleBuffer.
Definition render.h:851
#define TEXTURE_UPLOAD_QUEUE_SIZE
The number of entries of g_aTextureUploadQueue.
Definition render.h:406
#define VERTEX_CONV_CACHE_SIZE
The number of entries of g_aVertexConvCache.
Definition render.h:298
void ResetRenderSubsystems(int nMode, int nWidth, int nHeight, int nBitDepth, int nExtra)
Shut the renderer down when one runs, and start the renderer of a mode in a display mode.
void DecodeTexturePixels(unsigned char *pDest, int nSize, int nTexelSize, const unsigned char *pImage, const unsigned char *pPalette, int nFormat, int bMirrorS, int bMirrorT, int nTileIndex, int nTileLimit, const TexScanTile *pTiles, unsigned flags, int bColorCombine, unsigned envR, unsigned envG, unsigned envB, unsigned envA, unsigned primR, unsigned primG, unsigned primB, unsigned primA, unsigned nRowSwapMask)
Decode captured N64 texture tiles into four-byte pixels.
void EnqueueTextureUploadEntry(int nEntry, TextureUploadData payload)
Queue a texture to upload, under the mutex of the queue.
void InitializeTextureUploadQueue(void)
Empty the queue of textures to upload and create its mutex.
TextureUploadRequest g_aTextureUploadQueue[TEXTURE_UPLOAD_QUEUE_SIZE]
The textures to upload, a ring from g_dwTextureUploadQueueTail to g_dwTextureUploadQueueHead.
void LoadHudOverlayTexture(void)
Load the texture of the overlay of the display of the race.
const char g_szTidFromTextureAppendAmid[]
Allocation label for the device texture table.
int g_dwCopyTextureDataOnRelocate
Whether the data of a texture is copied when its pointers are relocated.
bool LookupTextureMapEntry(unsigned dwAddress, int *pnWidth, int *pnHeight)
Get the size of the replacement of a texture of the console, searching the texture map from its last ...
int CalculateTextureLodFromDimensions(int *pLod, int width, int height)
Derive a texture level of detail from its larger dimension.
void LoadHudGlyphTextureSets(void)
Load the textures of the sets of glyphs of the display of the race.
void(* g_pfnPresentFrame)(void)
Show the frame drawn, set by the reset of the render device.
decltype(&CreateDeviceTextureFromImageHeader) g_pfnCreateDeviceTextureFromImageHeader
The backend callback that creates a device texture from a model texture header.
void LoadTireTrailTexture(void)
Create the texture of the trails of the tyres, 32 by 64 texels.
unsigned g_dwWeatherShadeTextureId
The device texture identifier of the current weather shade.
void SetRenderBackendMode(int nMode)
Record the mode of the renderer.
void SelectTextureQualityFromVideoMemory(void)
Select texture quality and maximum dimensions from available graphics memory.
unsigned char * GetTextureEntryPixelsWithPaint(int nEntry, unsigned *pSize)
Decode texture pixels, applying the selected paint damage image when needed.
int g_dwTextureMapEntryCount
The entries of g_aTextureMapEntries in use.
HANDLE g_hTextureUploadQueueMutex
The mutex of the queue of textures to upload.
int g_dwTextureUploadQueueHead
The entry of g_aTextureUploadQueue the next texture to queue takes.
int DecodeN64TextureToPixelBuffer(void *pDest, const unsigned char *pImage, const unsigned char *pPalette, int nWidth, int nHeight, int nLineBytes, int nSize, int nFormat)
Decode an N64 image into the pixel format selected for its texel size and format.
void LoadVehicleEnvMapTexture(void)
Create the map of the environment of the vehicles, 64 by 64 texels.
unsigned char g_abWeatherShadeTexture[16]
The 4-by-4 intensity pixels of the current weather shade.
int SetDisplayModeWithFallback(int nWidth, int nHeight, int nBitDepth, int nExtra)
Set the size of the frame buffer.
void CreateAlphaRampTextures(void)
Create the textures of the ramps of alpha and of precipitation.
int g_dwTextureUploadQueueTail
The entry of g_aTextureUploadQueue of the next texture to upload.
unsigned g_dwHiResTextureMemoryThreshold
The available texture-memory threshold for high-resolution textures, in bytes.
unsigned g_dwTexturePixelByteCount
The byte count produced by the last decoded texture operation.
ConvertedModelVertex * ConvertVerticesToFloat(const Vtx *pVertices, int nCount)
Convert Nintendo 64 vertex positions and texture coordinates to floats in the model data pool.
decltype(&UploadTrackTextureVariants) g_pfnUploadTrackTextureVariants
The backend callback that uploads the texture variants of a track.
int g_dwMaxTexWidthLowQuality
The maximum low-quality texture width, in texels.
int g_dwVertexConvCacheCount
The number of entries of g_aVertexConvCache in use.
unsigned QueryAvailableTextureMemory(void)
Query the free video memory available for textures on the active DirectDraw device.
void DestroyTextureUploadQueue(void)
Empty the queue of textures to upload and close its mutex.
unsigned char g_abTextureResampleBuffer[TEXTURE_RESAMPLE_BUFFER_BYTES]
The pixels of a texture after resizing, or an intensity plane while it is applied.
unsigned DuplicateTextureEntryHalfScale(unsigned nTexture)
Duplicate a texture entry with both texture-coordinate scales halved.
int GetRenderBackendMode(void)
The renderer the game was set to use.
unsigned(* g_pfnCreateTextureFromN64ImageAutoLoadSize)(const unsigned char *, const unsigned char *, int, int, int, int, int, int, int, int, int, int, int, int)
The backend callback that creates an N64 image texture after calculating its load size.
void SetTextureLoadCategory(int nCategory)
Set the category of the textures loaded next.
void CopyConfigFramebufferSize(void)
Make the size of the frame the size of the framebuffer of the configuration.
unsigned char * GetTextureImagePixels(TextureImageData *pImage)
Decode an image descriptor into the texture pixel work buffers.
void AddVertexConversionCacheEntry(const Vtx *pSource, int nVertexCount, ConvertedModelVertex *pFloatVerts)
Add a run of vertices converted to g_aVertexConvCache while it has room.
void(* g_pfnRenderDeviceShutdown)(void)
Release the render device, if one is set.
void CreateFallbackEnvironmentTexture(void)
Create the texture of the environment used when none is loaded.
void ProcessTextureUploadQueueEntry(void)
Upload the next texture of the queue of textures to upload.
int g_dwCurrentMaxTextureWidth
The width limit selected for the current texture category.
int PreparePaintTexture(int *pWidth, int *pHeight, TextureImageData *pImage)
Prepare paint texture metadata and adjust device dimensions.
int InitGlideRenderDevice(void)
Start the Glide device: set the routines that show a frame and shut the device down,...
unsigned CreateTextureFromN64Image(const unsigned char *pImage, const unsigned char *pPalette, int nWidth, int nHeight, int nLineBytes, int nSize, int nFormat, int nOption7, int nOption8, int nOption9, int nOption10, int nOption11, int nOption12, int nOption13, int nOption14)
Create a device texture from an N64 image and its load options.
void ByteSwapVertexArray(Vtx *pVertices, int nCount)
Byte-swap the positions, flags, and texture coordinates of loaded Nintendo 64 vertices.
#define TEXTURE_MAP_ENTRY_COUNT
The number of entries of g_aTextureMapEntries.
Definition render.h:374