ref_vk: Add support for 32k+ marksurfaces in map(659d8e15)

This commit is contained in:
Denis Pauk 2020-01-18 12:49:16 +02:00 committed by Yamagi
parent b558407423
commit 63f6cdf698
6 changed files with 37 additions and 30 deletions

View file

@ -211,7 +211,7 @@ void Draw_Fill (int x, int y, int w, int h, int c)
R_EndWorldRenderpass();
if ((unsigned)c > 255)
ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color");
ri.Sys_Error(ERR_FATAL, "%s: bad color", __func__);
color.c = d_8to24table[c];

View file

@ -1161,7 +1161,7 @@ uint32_t Vk_Upload32 (unsigned *data, int width, int height, qboolean mipmap)
upload_height = scaled_height;
if (scaled_width * scaled_height > sizeof(scaled) / 4)
ri.Sys_Error(ERR_DROP, "Vk_Upload32: too big");
ri.Sys_Error(ERR_DROP, "%s: too big", __func__);
if (scaled_width == width && scaled_height == height)
{
@ -1216,7 +1216,7 @@ uint32_t Vk_Upload8 (byte *data, int width, int height, qboolean mipmap, qboole
s = width * height;
if (s > sizeof(trans) / 4)
ri.Sys_Error(ERR_DROP, "Vk_Upload8: too large");
ri.Sys_Error(ERR_DROP, "%s: too large", __func__);
for (i = 0; i < s; i++)
{
@ -1269,13 +1269,13 @@ image_t *Vk_LoadPic (char *name, byte *pic, int width, int height, imagetype_t t
if (i == numvktextures)
{
if (numvktextures == MAX_VKTEXTURES)
ri.Sys_Error(ERR_DROP, "MAX_VKTEXTURES");
ri.Sys_Error(ERR_DROP, "%s: MAX_VKTEXTURES", __func__);
numvktextures++;
}
image = &vktextures[i];
if (strlen(name) >= sizeof(image->name))
ri.Sys_Error(ERR_DROP, "Draw_LoadPic: \"%s\" is too long", name);
ri.Sys_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
strcpy(image->name, name);
image->registration_sequence = registration_sequence;
// zero-clear Vulkan texture handle

View file

@ -212,7 +212,7 @@ model_t *Mod_ForName (char *name, qboolean crash)
break;
case IDBSPHEADER:
loadmodel->extradata = Hunk_Begin (0x1000000);
loadmodel->extradata = Hunk_Begin (0x2000000);
Mod_LoadBrushModel (mod, buf);
break;
@ -295,7 +295,7 @@ void Mod_LoadVertexes (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));
@ -342,7 +342,7 @@ void Mod_LoadSubmodels (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));
@ -377,7 +377,7 @@ void Mod_LoadEdges (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( (count + 1) * sizeof(*out));
@ -519,7 +519,7 @@ void Mod_LoadFaces (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name);
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc(count * sizeof(*out));
@ -546,7 +546,7 @@ void Mod_LoadFaces (lump_t *l)
ti = LittleShort(in->texinfo);
if (ti < 0 || ti >= loadmodel->numtexinfo)
ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: bad texinfo number");
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number", __func__);
out->texinfo = loadmodel->texinfo + ti;
CalcSurfaceExtents(out);
@ -614,7 +614,7 @@ void Mod_LoadNodes (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));
@ -659,11 +659,10 @@ void Mod_LoadLeafs (lump_t *l)
dleaf_t *in;
mleaf_t *out;
int i, j, count, p;
// glpoly_t *poly;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));
@ -672,6 +671,8 @@ void Mod_LoadLeafs (lump_t *l)
for ( i=0 ; i<count ; i++, in++, out++)
{
unsigned firstleafface;
for (j=0 ; j<3 ; j++)
{
out->minmaxs[j] = LittleShort (in->mins[j]);
@ -684,9 +685,15 @@ void Mod_LoadLeafs (lump_t *l)
out->cluster = LittleShort(in->cluster);
out->area = LittleShort(in->area);
out->firstmarksurface = loadmodel->marksurfaces +
LittleShort(in->firstleafface);
out->nummarksurfaces = LittleShort(in->numleaffaces);
// make unsigned long from signed short
firstleafface = LittleShort(in->firstleafface) & 0xFFFF;
out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF;
out->firstmarksurface = loadmodel->marksurfaces + firstleafface;
if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces)
{
ri.Sys_Error (ERR_DROP, "%s: wrong marksurfaces position in %s", __func__, loadmodel->name);
}
// gl underwater warp
#if 0
@ -716,7 +723,7 @@ void Mod_LoadMarksurfaces (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));
@ -744,11 +751,11 @@ void Mod_LoadSurfedges (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
if (count < 1 || count >= MAX_MAP_SURFEDGES)
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: bad surfedges count in %s: %i",
loadmodel->name, count);
ri.Sys_Error (ERR_DROP, "%s: bad surfedges count in %s: %i",
__func__, loadmodel->name, count);
out = Hunk_Alloc ( count*sizeof(*out));
@ -775,7 +782,7 @@ void Mod_LoadPlanes (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*2*sizeof(*out));
@ -817,7 +824,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
i = LittleLong (header->version);
if (i != BSPVERSION)
ri.Sys_Error (ERR_DROP, "Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION);
ri.Sys_Error (ERR_DROP, "%s: %s has wrong version number (%i should be %i)", __func__, mod->name, i, BSPVERSION);
// swap all the lumps
mod_base = (byte *)header;

View file

@ -348,7 +348,7 @@ void R_DrawEntitiesOnList (void)
R_DrawSpriteModel(currententity);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
ri.Sys_Error(ERR_DROP, "%s, Bad modeltype", __func__);
break;
}
}
@ -387,7 +387,7 @@ void R_DrawEntitiesOnList (void)
R_DrawSpriteModel(currententity);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
ri.Sys_Error(ERR_DROP, "%s, Bad modeltype", __func__);
break;
}
}
@ -880,7 +880,7 @@ void R_RenderView (refdef_t *fd)
r_newrefdef = *fd;
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
ri.Sys_Error(ERR_DROP, "R_RenderView: NULL worldmodel");
ri.Sys_Error(ERR_DROP, "%s: NULL worldmodel", __func__);
if (r_speeds->value)
{

View file

@ -1089,7 +1089,7 @@ static void LM_UploadBlock( qboolean dynamic )
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].allocInfo.deviceMemory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: dynamic lightmap #%d", texture));
}
if ( ++vk_lms.current_lightmap_texture == MAX_LIGHTMAPS )
ri.Sys_Error( ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" );
ri.Sys_Error( ERR_DROP, "%s() - MAX_LIGHTMAPS exceeded\n", __func__);
}
}
@ -1226,7 +1226,7 @@ void Vk_CreateSurfaceLightmap (msurface_t *surf)
LM_InitBlock();
if ( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ) )
{
ri.Sys_Error( ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed\n", smax, tmax );
ri.Sys_Error( ERR_FATAL, "%s: Consecutive calls to LM_AllocBlock(%d,%d) failed\n", __func__, smax, tmax );
}
}

View file

@ -66,7 +66,7 @@ void SubdividePolygon (int numverts, float *verts)
float total_s, total_t;
if (numverts > 60)
ri.Sys_Error (ERR_DROP, "numverts = %i", numverts);
ri.Sys_Error (ERR_DROP, "%s: numverts = %i", __func__, numverts);
BoundPoly (numverts, verts, mins, maxs);
@ -409,7 +409,7 @@ void ClipSkyPolygon (int nump, vec3_t vecs, int stage)
int i, j;
if (nump > MAX_CLIP_VERTS-2)
ri.Sys_Error (ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS");
ri.Sys_Error (ERR_DROP, "%s: MAX_CLIP_VERTS", __func__);
if (stage == 6)
{ // fully clipped, so draw it
DrawSkyPolygon (nump, vecs);