From 41c2962ae69a83678cf9bc0c0a13c32d509c7019 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sat, 16 Nov 2024 02:15:07 +0100 Subject: [PATCH] Reorder surface fields (tentative fix for #359) --- Quake/gl_shaders.h | 16 ++++++++-------- Quake/glquake.h | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Quake/gl_shaders.h b/Quake/gl_shaders.h index 9b5b5b337..5be093577 100644 --- a/Quake/gl_shaders.h +++ b/Quake/gl_shaders.h @@ -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" @@ -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" diff --git a/Quake/glquake.h b/Quake/glquake.h index 236ad9c82..d7c011630 100644 --- a/Quake/glquake.h +++ b/Quake/glquake.h @@ -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);