Skip to content

Commit

Permalink
Vulkan: Replace PATCH_STITCHING preprocessor define with r_patchStitc…
Browse files Browse the repository at this point in the history
…hing cvar

Cherrypicked: (JACoders@540edeb)
Pull request:   (JACoders#1199)

Co-Authored-By: razor <844370+razish@users.noreply.github.com>
  • Loading branch information
JKSunny and Razish committed Apr 15, 2024
1 parent 4eee7ab commit 7aca568
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
12 changes: 6 additions & 6 deletions codemp/rd-vulkan/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
11 changes: 0 additions & 11 deletions codemp/rd-vulkan/tr_curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions codemp/rd-vulkan/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, "" );

Expand Down
2 changes: 1 addition & 1 deletion codemp/rd-vulkan/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,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;
Expand Down Expand Up @@ -1900,7 +1901,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 );
Expand Down

0 comments on commit 7aca568

Please sign in to comment.