diff --git a/codemp/rd-vulkan/tr_bsp.cpp b/codemp/rd-vulkan/tr_bsp.cpp index 06ab965214..bf40644a3a 100644 --- a/codemp/rd-vulkan/tr_bsp.cpp +++ b/codemp/rd-vulkan/tr_bsp.cpp @@ -1632,15 +1632,15 @@ static void R_LoadSurfaces( const lump_t *surfs, const lump_t *verts, const lump } } -#ifdef PATCH_STITCHING - R_StitchAllPatches(worldData); -#endif + if ( r_patchStitching->integer ) { + R_StitchAllPatches( worldData ); + } R_FixSharedVertexLodError(worldData); -#ifdef PATCH_STITCHING - R_MovePatchSurfacesToHunk(worldData); -#endif + if ( r_patchStitching->integer ) { + R_MovePatchSurfacesToHunk( worldData ); + } vk_debug("...loaded %d faces, %i meshes, %i trisurfs, %i flares\n", numFaces, numMeshes, numTriSurfs, numFlares ); } diff --git a/codemp/rd-vulkan/tr_curve.cpp b/codemp/rd-vulkan/tr_curve.cpp index 8da1b0872d..1027212b59 100644 --- a/codemp/rd-vulkan/tr_curve.cpp +++ b/codemp/rd-vulkan/tr_curve.cpp @@ -305,7 +305,6 @@ static srfGridMesh_t *R_CreateSurfaceGridMesh( int width, int height, // copy the results out to a grid size = (width * height - 1) * sizeof( drawVert_t ) + sizeof( *grid ); -#ifdef PATCH_STITCHING grid = (struct srfGridMesh_s *)/*Hunk_Alloc*/ Z_Malloc( size, TAG_GRIDMESH, qfalse ); memset(grid, 0, size); @@ -314,16 +313,6 @@ static srfGridMesh_t *R_CreateSurfaceGridMesh( int width, int height, grid->heightLodError = (float *)/*Hunk_Alloc*/ Z_Malloc( height * 4, TAG_GRIDMESH, qfalse ); memcpy( grid->heightLodError, errorTable[1], height * 4 ); -#else - grid = Hunk_Alloc( size ); - memset(grid, 0, size); - - grid->widthLodError = Hunk_Alloc( width * 4 ); - memcpy( grid->widthLodError, errorTable[0], width * 4 ); - - grid->heightLodError = Hunk_Alloc( height * 4 ); - memcpy( grid->heightLodError, errorTable[1], height * 4 ); -#endif grid->width = width; grid->height = height; diff --git a/codemp/rd-vulkan/tr_init.cpp b/codemp/rd-vulkan/tr_init.cpp index e2909601a6..77d680e782 100644 --- a/codemp/rd-vulkan/tr_init.cpp +++ b/codemp/rd-vulkan/tr_init.cpp @@ -178,6 +178,7 @@ cvar_t *r_marksOnTriangleMeshes; cvar_t *r_aspectCorrectFonts; cvar_t *cl_ratioFix; +cvar_t *r_patchStitching; // Vulkan cvar_t *r_defaultImage; @@ -898,6 +899,7 @@ void R_Register( void ) r_marksOnTriangleMeshes = ri.Cvar_Get( "r_marksOnTriangleMeshes", "0", CVAR_ARCHIVE_ND, "" ); r_aspectCorrectFonts = ri.Cvar_Get( "r_aspectCorrectFonts", "0", CVAR_ARCHIVE, "" ); cl_ratioFix = ri.Cvar_Get( "cl_ratioFix", "1", CVAR_ARCHIVE, "" ); + r_patchStitching = ri.Cvar_Get( "r_patchStitching", "1", CVAR_ARCHIVE, "Enable stitching of neighbouring patch surfaces" ); r_maxpolys = ri.Cvar_Get( "r_maxpolys", XSTRING( DEFAULT_MAX_POLYS ), CVAR_NONE, "" ); r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", XSTRING( DEFAULT_MAX_POLYVERTS ), CVAR_NONE, "" ); diff --git a/codemp/rd-vulkan/tr_local.h b/codemp/rd-vulkan/tr_local.h index 57fc110236..1d1604b3d3 100644 --- a/codemp/rd-vulkan/tr_local.h +++ b/codemp/rd-vulkan/tr_local.h @@ -1756,6 +1756,7 @@ extern cvar_t *r_marksOnTriangleMeshes; extern cvar_t *r_aspectCorrectFonts; extern cvar_t *cl_ratioFix; +extern cvar_t *r_patchStitching; // Vulkan extern cvar_t *r_defaultImage; @@ -2071,7 +2072,6 @@ CURVE TESSELATION ============================================================ */ -#define PATCH_STITCHING srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, drawVert_t points[MAX_PATCH_SIZE * MAX_PATCH_SIZE] ); srfGridMesh_t *R_GridInsertColumn( srfGridMesh_t *grid, int column, int row, vec3_t point, float loderror );