mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
[model] Rearrange msurface_t for better efficiency
It's down to 128 bytes from 184, which fits nicely in two cache lines. This made a nice difference to glsl, unknown to vulkan (it crashed after about 31/51 timedemo loops), and was a was for sw and gl.
This commit is contained in:
parent
0f7e6734f7
commit
7ed452027c
1 changed files with 25 additions and 14 deletions
|
@ -139,36 +139,47 @@ typedef struct glpoly_s {
|
|||
typedef struct msurface_s {
|
||||
int visframe; // should be drawn when node is crossed
|
||||
|
||||
plane_t *plane;
|
||||
int flags;
|
||||
plane_t *plane;
|
||||
|
||||
int firstedge; // look up in model->surfedges[], negative numbers
|
||||
int numedges; // are backwards edges
|
||||
|
||||
struct surfcache_s *cachespots[MIPLEVELS];
|
||||
union {
|
||||
// sw-only
|
||||
struct surfcache_s *cachespots[MIPLEVELS];
|
||||
// gl/glsl/vulkan
|
||||
struct {
|
||||
glpoly_t *polys; // multiple if warped
|
||||
instsurf_t *instsurf;///< null if not part of world model/sub-model
|
||||
union {
|
||||
struct {
|
||||
struct subpic_s *lightpic;///< light map texture ref (glsl)
|
||||
byte *base;
|
||||
};
|
||||
struct {
|
||||
int light_s;
|
||||
int light_t;
|
||||
int lightmaptexturenum;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mtexinfo_t *texinfo;
|
||||
short texturemins[2];
|
||||
unsigned short extents[2];
|
||||
|
||||
int light_s, light_t; // gl lightmap coordinates
|
||||
|
||||
glpoly_t *polys; // multiple if warped
|
||||
instsurf_t *instsurf; ///< null if not part of world model/sub-model
|
||||
|
||||
mtexinfo_t *texinfo;
|
||||
int model_index; ///< < 0: instance, 0 main, > 0: sub
|
||||
byte *base;
|
||||
|
||||
// lighting info
|
||||
struct subpic_s *lightpic; ///< light map texture ref (glsl)
|
||||
byte *samples; // [numstyles*surfsize]
|
||||
int dlightframe;
|
||||
uint32_t dlightbits[(MAX_DLIGHTS + 31) >> 5];
|
||||
|
||||
int lightmaptexturenum;
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
|
||||
qboolean cached_dlight; // true if dynamic light in cache
|
||||
byte *samples; // [numstyles*surfsize]
|
||||
|
||||
int model_index; ///< < 0: instance, 0 main, > 0: sub
|
||||
} msurface_t;
|
||||
|
||||
typedef struct mnode_s {
|
||||
|
|
Loading…
Reference in a new issue