Files
SRB2Kart-Saturn/src/hardware/hw_data.h
T
Alug 87923973e3 test: replace gl colormap mipmap linked list with unordered map for faster lookup
so far this seems to cut the time searching for an existing colormipmap in half, needs some testing as this is finicky code that may leak badly if not handled correctly

models currently broken, for reasons above
2025-12-10 19:19:50 +01:00

82 lines
2.2 KiB
C

// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief defines structures and exports for the standard GPU driver
#ifndef _HWR_DATA_
#define _HWR_DATA_
#include "../doomdef.h"
#include "../screen.h"
// ==========================================================================
// TEXTURE INFO
// ==========================================================================
typedef enum GLTextureFormat_e
{
GL_TEXFMT_P_8 = 0x01, /* 8-bit palette */
GL_TEXFMT_AP_88 = 0x02, /* 8-bit alpha, 8-bit palette */
GL_TEXFMT_RGBA = 0x10, /* 32 bit RGBA! */
GL_TEXFMT_ALPHA_8 = 0x20, /* (0..0xFF) alpha */
GL_TEXFMT_INTENSITY_8 = 0x21, /* (0..0xFF) intensity */
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
} GLTextureFormat_t;
// Colormap structure for mipmaps.
struct GLColormap_s
{
const UINT8 *source;
UINT8 data[256];
};
typedef struct GLColormap_s GLColormap_t;
// Texture information (misleadingly named "mipmap" all over the code.)
// The *data pointer holds the address of the graphics data cached in heap memory.
// NULL if the texture is not in SRB2's heap cache.
struct GLMipmap_s
{
// for UpdateTexture
GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 width, height;
UINT32 downloaded; // The GPU has this texture.
struct ColorMipMap *nextcolormap;
struct GLColormap_s *colormap;
};
typedef struct GLMipmap_s GLMipmap_t;
//
// Level textures, as cached for hardware rendering.
//
struct GLMapTexture_s
{
GLMipmap_t mipmap;
float scaleX; // used for scaling textures on walls
float scaleY;
};
typedef struct GLMapTexture_s GLMapTexture_t;
// Patch information for the hardware renderer.
struct GLPatch_s
{
GLMipmap_t *mipmap;
float max_s, max_t;
};
typedef struct GLPatch_s GLPatch_t;
#endif //_HWR_DATA_