Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Vulkan PBR: **anisotropic visibility** for direct light; optional **IBL roughness stretch** from the anisotropy map (`r_pbr_iblAnisoStretch`); **clearcoat** base attenuation and **Charlie sheen** with optional fourth `sheenScale` roughness token.

### Removed
- Vulkan renderer: stale compile-time gates `USE_VBO_GRID` and `USE_TESS_NEEDS_*` (always-on or never-enabled); dead non-PBR `#else` in `vk_shader_modules.c` (`USE_VK_PBR` is unconditional).
- No-op OpenGL extension cvars on Vulkan builds: `r_allowExtensions`, `r_ext_compressed_textures`, `r_ext_compiled_vertex_array` (only referenced by dead `R_InitExtensions` behind `#ifndef USE_VULKAN`).
- Legacy `r_vfog*` engine cvars and `vk_vfog.c`/`vk_vfog.h`: volumetric fog is configured only via `r_volumetricFog*` (and map/`r_fog*` as documented). Editor `worldspawn` keys `vfog_*` remain separate map data, not console cvars.

### Security
Expand Down
22 changes: 6 additions & 16 deletions src/renderers/vulkan/tr_animation.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,28 +411,18 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
tempVert[1] += w->boneWeight * ( DotProduct( bone->matrix[1], w->offset ) + bone->matrix[1][3] );
tempVert[2] += w->boneWeight * ( DotProduct( bone->matrix[2], w->offset ) + bone->matrix[2][3] );

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
tempNormal[0] += w->boneWeight * DotProduct( bone->matrix[0], v->normal );
tempNormal[1] += w->boneWeight * DotProduct( bone->matrix[1], v->normal );
tempNormal[2] += w->boneWeight * DotProduct( bone->matrix[2], v->normal );
}
tempNormal[0] += w->boneWeight * DotProduct( bone->matrix[0], v->normal );
tempNormal[1] += w->boneWeight * DotProduct( bone->matrix[1], v->normal );
tempNormal[2] += w->boneWeight * DotProduct( bone->matrix[2], v->normal );
}

tess.xyz[baseVertex + j][0] = tempVert[0];
tess.xyz[baseVertex + j][1] = tempVert[1];
tess.xyz[baseVertex + j][2] = tempVert[2];

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
tess.normal[baseVertex + j][0] = tempNormal[0];
tess.normal[baseVertex + j][1] = tempNormal[1];
tess.normal[baseVertex + j][2] = tempNormal[2];
}
tess.normal[baseVertex + j][0] = tempNormal[0];
tess.normal[baseVertex + j][1] = tempNormal[1];
tess.normal[baseVertex + j][2] = tempNormal[2];

tess.texCoords[0][baseVertex + j][0] = v->texCoords[0];
tess.texCoords[0][baseVertex + j][1] = v->texCoords[1];
Expand Down
3 changes: 0 additions & 3 deletions src/renderers/vulkan/tr_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ extern cvar_t *r_texturebits; // number of desired texture bits

extern cvar_t *r_drawBuffer;

extern cvar_t *r_allowExtensions; // global enable/disable of OpenGL extensions
extern cvar_t *r_ext_compressed_textures; // these control use of specific extensions
extern cvar_t *r_ext_multitexture;
extern cvar_t *r_ext_compiled_vertex_array;
extern cvar_t *r_ext_texture_env_add;

extern cvar_t *r_ext_texture_filter_anisotropic;
Expand Down
10 changes: 0 additions & 10 deletions src/renderers/vulkan/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,7 @@ cvar_t *r_facePlaneCull;
cvar_t *r_showcluster;
cvar_t *r_nocurves;

cvar_t *r_allowExtensions;

cvar_t *r_ext_compressed_textures;
cvar_t *r_ext_multitexture;
cvar_t *r_ext_compiled_vertex_array;
cvar_t *r_ext_texture_env_add;
cvar_t *r_ext_texture_filter_anisotropic;
cvar_t *r_ext_max_anisotropy;
Expand Down Expand Up @@ -3660,14 +3656,8 @@ static void R_Register( void )
//
// latched and archived variables that can only change over a vid_restart
//
r_allowExtensions = ri.Cvar_Get( "r_allowExtensions", "1", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_DEVELOPER );
ri.Cvar_SetDescription( r_allowExtensions, "Use all of the OpenGL extensions your card is capable of." );
r_ext_compressed_textures = ri.Cvar_Get( "r_ext_compressed_textures", "0", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_DEVELOPER );
ri.Cvar_SetDescription( r_ext_compressed_textures, "Enables texture compression." );
r_ext_multitexture = ri.Cvar_Get( "r_ext_multitexture", "1", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_DEVELOPER );
ri.Cvar_SetDescription( r_ext_multitexture, "Enables hardware multi-texturing (0: off, 1: on)." );
r_ext_compiled_vertex_array = ri.Cvar_Get( "r_ext_compiled_vertex_array", "1", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_DEVELOPER );
ri.Cvar_SetDescription( r_ext_compiled_vertex_array, "Enables hardware-compiled vertex array rendering method." );
r_ext_texture_env_add = ri.Cvar_Get( "r_ext_texture_env_add", "1", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_DEVELOPER );
ri.Cvar_SetDescription( r_ext_texture_env_add, "Enables additive blending in multitexturing. Requires \\r_ext_multitexture 1." );

Expand Down
18 changes: 1 addition & 17 deletions src/renderers/vulkan/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#define MAX_TEXTURE_SIZE 32768

#ifdef USE_VBO
#define USE_VBO_GRID /* put SF_GRID to VBO */
#endif

//#define USE_TESS_NEEDS_NORMAL
//#define USE_TESS_NEEDS_ST2

#define SH_COEFF_COUNT 9

#include "../../qcommon/q_shared.h"
Expand Down Expand Up @@ -2047,9 +2040,7 @@ image_t *vk_create_pbr_albedo_srgb( const char *albedoMapName, imgFlags_t flags
//
// tr_surface.c
//
#ifdef USE_VBO_GRID
void RB_SurfaceGridEstimate( srfGridMesh_t *cv, int *numVertexes, int *numIndexes );
#endif
void RB_SurfaceGridEstimate( srfGridMesh_t *cv, int *numVertexes, int *numIndexes );

/*
====================================================================
Expand Down Expand Up @@ -2115,13 +2106,6 @@ typedef struct shaderCommands_s
#endif

// info extracted from current shader
#ifdef USE_TESS_NEEDS_NORMAL
int needsNormal;
#endif
#ifdef USE_TESS_NEEDS_ST2
int needsST2;
#endif

int numPasses;
shaderStage_t **xstages;

Expand Down
3 changes: 0 additions & 3 deletions src/renderers/vulkan/tr_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, qboolean *isMirror
RB_BeginSurface( shader, fogNum );
#ifdef USE_VBO
tess.allowVBO = qfalse;
#endif
#ifdef USE_TESS_NEEDS_NORMAL
tess.needsNormal = qtrue;
#endif
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );

Expand Down
11 changes: 0 additions & 11 deletions src/renderers/vulkan/tr_shade.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,6 @@ void RB_BeginSurface( shader_t *shader, int fogNum ) {
tess.dlightUpdateParams = qtrue;
}

#ifdef USE_TESS_NEEDS_NORMAL
tess.needsNormal = state->needsNormal || tess.dlightPass || r_shownormals->integer ||
( backEnd.currentEntity == &tr.worldEntity &&
( ( r_shDebugView && r_shDebugView->integer ) ||
( r_shWorldLighting && r_shWorldLighting->integer && r_shLighting && r_shLighting->integer ) ) );
#endif

#ifdef USE_TESS_NEEDS_ST2
tess.needsST2 = state->needsST2;
#endif

tess.numIndexes = 0;
tess.numVertexes = 0;
tess.sdfUiEdge = -1.0f;
Expand Down
95 changes: 24 additions & 71 deletions src/renderers/vulkan/tr_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,9 @@ static void RB_SurfaceTriangles( const srfTriangles_t *srf ) {
xyz[1] = dv->xyz[1];
xyz[2] = dv->xyz[2];

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
normal[0] = dv->normal[0];
normal[1] = dv->normal[1];
normal[2] = dv->normal[2];
}
normal[0] = dv->normal[0];
normal[1] = dv->normal[1];
normal[2] = dv->normal[2];

#ifdef USE_VK_PBR
if( vk.pbrActive ) {
Expand All @@ -433,14 +428,9 @@ static void RB_SurfaceTriangles( const srfTriangles_t *srf ) {
texCoords0[0] = dv->st[0];
texCoords0[1] = dv->st[1];

#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
texCoords1[0] = dv->lightmap[0];
texCoords1[1] = dv->lightmap[1];
texCoords1 += 2;
}
texCoords1[0] = dv->lightmap[0];
texCoords1[1] = dv->lightmap[1];
texCoords1 += 2;

*color = dv->color.u32;
}
Expand Down Expand Up @@ -988,18 +978,13 @@ static void RB_SurfaceFace( const srfSurfaceFace_t *surf ) {

numPoints = surf->numPoints;

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
if ( surf->normals ) {
// per-vertex normals for non-coplanar faces
memcpy( &tess.normal[ tess.numVertexes ], surf->normals, numPoints * sizeof( vec4_t ) );
} else {
normal = surf->plane.normal;
for ( i = 0, ndx = tess.numVertexes; i < numPoints; i++, ndx++ ) {
VectorCopy( normal, tess.normal[ndx] );
}
if ( surf->normals ) {
// per-vertex normals for non-coplanar faces
memcpy( &tess.normal[ tess.numVertexes ], surf->normals, numPoints * sizeof( vec4_t ) );
} else {
normal = surf->plane.normal;
for ( i = 0, ndx = tess.numVertexes; i < numPoints; i++, ndx++ ) {
VectorCopy( normal, tess.normal[ndx] );
}
}

Expand All @@ -1017,13 +1002,8 @@ static void RB_SurfaceFace( const srfSurfaceFace_t *surf ) {
#ifdef USE_VK_PBR
tess.texCoords[0][ndx][0] = v[6];
tess.texCoords[0][ndx][1] = v[7];
#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
tess.texCoords[1][ndx][0] = v[8];
tess.texCoords[1][ndx][1] = v[9];
}
tess.texCoords[1][ndx][0] = v[8];
tess.texCoords[1][ndx][1] = v[9];
{
uint32_t color;
Com_Memcpy( &color, &v[10], sizeof( color ) );
Expand All @@ -1032,13 +1012,8 @@ static void RB_SurfaceFace( const srfSurfaceFace_t *surf ) {
#else
tess.texCoords[0][ndx][0] = v[3];
tess.texCoords[0][ndx][1] = v[4];
#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
tess.texCoords[1][ndx][0] = v[5];
tess.texCoords[1][ndx][1] = v[6];
}
tess.texCoords[1][ndx][0] = v[5];
tess.texCoords[1][ndx][1] = v[6];
{
uint32_t color;
Com_Memcpy( &color, &v[7], sizeof( color ) );
Expand Down Expand Up @@ -1083,7 +1058,6 @@ static float LodErrorForVolume( vec3_t local, float radius ) {
return r_lodCurveError->value / d;
}

#ifdef USE_VBO_GRID
void RB_SurfaceGridEstimate( srfGridMesh_t *cv, int *numVertexes, int *numIndexes )
{
int lodWidth, lodHeight;
Expand Down Expand Up @@ -1147,7 +1121,6 @@ void RB_SurfaceGridEstimate( srfGridMesh_t *cv, int *numVertexes, int *numIndexe
tess.numVertexes = 0;
tess.numIndexes = 0;
}
#endif // USE_VBO_GRID

/*
=============
Expand Down Expand Up @@ -1178,7 +1151,6 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
int dlightBits;
int *vDlightBits;

#ifdef USE_VBO_GRID
if ( tess.allowVBO && cv->vboItemIndex && !cv->dlightBits ) {
// transition to vbo render list
if ( tess.vboIndex == 0 ) {
Expand All @@ -1196,23 +1168,16 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
}

VBO_Flush();
#else
#ifdef USE_VBO
VBO_Flush();
#endif
#endif

dlightBits = cv->dlightBits;
tess.dlightBits |= dlightBits;

#ifdef USE_VBO_GRID
tess.surfType = SF_GRID;

// determine the allowable discrepance
if ( cv->vboItemIndex && ( tr.mapLoading || ( tess.dlightPass && tess.shader->isStaticShader ) ) )
lodError = r_lodCurveError->value; // fixed quality for VBO
else
#endif // USE_VBO_GRID
lodError = LodErrorForVolume( cv->lodOrigin, cv->lodRadius );

// determine which rows and columns of the subdivision
Expand Down Expand Up @@ -1253,13 +1218,11 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
if ( vrows < 2 || irows < 1 ) {
if ( tr.mapLoading ) {
// estimate and flush
#ifdef USE_VBO_GRID
if ( cv->vboItemIndex ) {
VBO_PushData( cv->vboItemIndex, &tess );
tess.numIndexes = 0;
tess.numVertexes = 0;
} else
#endif // USE_VBO_GRID
ri.Error( ERR_DROP, "Unexpected grid flush during map loading!\n" );
} else {
RB_EndSurface();
Expand Down Expand Up @@ -1300,23 +1263,13 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
xyz[2] = dv->xyz[2];
texCoords0[0] = dv->st[0];
texCoords0[1] = dv->st[1];
#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
texCoords1[0] = dv->lightmap[0];
texCoords1[1] = dv->lightmap[1];
texCoords1 += 2;
}
#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
normal[0] = dv->normal[0];
normal[1] = dv->normal[1];
normal[2] = dv->normal[2];
normal += 4;
}
texCoords1[0] = dv->lightmap[0];
texCoords1[1] = dv->lightmap[1];
texCoords1 += 2;
normal[0] = dv->normal[0];
normal[1] = dv->normal[1];
normal[2] = dv->normal[2];
normal += 4;

#ifdef USE_VK_PBR
if( vk.pbrActive ) {
Expand Down
Loading
Loading