Skip to content

Commit

Permalink
Reorder surface fields (tentative fix for #359)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Nov 16, 2024
1 parent 39151a3 commit 41c2962
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions Quake/gl_shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -1542,13 +1542,13 @@ DRAW_ELEMENTS_INDIRECT_COMMAND
"struct Surface\n"
"{\n"
" vec4 plane;\n"
" vec3 mins;\n"
" uint framecount;\n"
" vec3 maxs;\n"
" uint texnum;\n"
" uint numedges;\n"
" uint firstvert;\n"
" vec3 mins;\n"
" uint _pad0;\n"
" vec3 maxs;\n"
" uint _pad1;\n"
"};\n"
"\n"
Expand All @@ -1560,12 +1560,12 @@ DRAW_ELEMENTS_INDIRECT_COMMAND
"};\n"
"\n"
"#define SURF_PLANE(base) uintBitsToFloat(rawsurfaces[base])\n"
"#define SURF_MINS(base) uintBitsToFloat(rawsurfaces[base + 1].xyz)\n"
"#define SURF_FRAMECOUNT(base) rawsurfaces[base + 1].w\n"
"#define SURF_MAXS(base) uintBitsToFloat(rawsurfaces[base + 2].xyz)\n"
"#define SURF_TEXNUM(base) rawsurfaces[base + 2].w\n"
"#define SURF_NUMEDGES(base) rawsurfaces[base + 3].x\n"
"#define SURF_FIRSTVERT(base) rawsurfaces[base + 3].y\n"
"#define SURF_FRAMECOUNT(base) rawsurfaces[base + 1].x\n"
"#define SURF_TEXNUM(base) rawsurfaces[base + 1].y\n"
"#define SURF_NUMEDGES(base) rawsurfaces[base + 1].z\n"
"#define SURF_FIRSTVERT(base) rawsurfaces[base + 1].w\n"
"#define SURF_MINS(base) uintBitsToFloat(rawsurfaces[base + 2].xyz)\n"
"#define SURF_MAXS(base) uintBitsToFloat(rawsurfaces[base + 3].xyz)\n"
"#define SIZEOF_SURFACE 4 /* uvec4s */\n"
"\n"
"layout(std140, binding=1) uniform FrameCullUBO\n"
Expand Down
7 changes: 4 additions & 3 deletions Quake/glquake.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,14 @@ typedef struct bmodel_gpu_marksurf_s {

typedef struct bmodel_gpu_surf_s {
vec4_t plane;
vec3_t mins;
GLuint framecount;
vec3_t maxs;
GLuint texnum;
GLuint numedges;
GLuint firstvert;
GLuint padding[2];
vec3_t mins;
GLuint padding0;
vec3_t maxs;
GLuint padding1;
} bmodel_gpu_surf_t;

void GL_BuildLightmaps (void);
Expand Down

0 comments on commit 41c2962

Please sign in to comment.