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
- Stale Vulkan compile-time gates: **USE_VBO_GRID** (always on with **USE_VBO**), dead **USE_TESS_NEEDS_NORMAL** / **USE_TESS_NEEDS_ST2** tess branches, write-only **shader.needsNormal** / **shader.needsST2** + **DetectNeeds()**, and the non-PBR **vk_create_shader_modules** init path behind **USE_VK_PBR** (always defined).
- Legacy **r_allowSoftwareGL** / **r_glDriver** cvar registration on Vulkan-only builds (gated behind **USE_OPENGL_API**).
- 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
12 changes: 8 additions & 4 deletions src/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,11 @@ cvar_t *vid_xpos; // X coordinate of window position
cvar_t *vid_ypos; // Y coordinate of window position
cvar_t *r_noborder;

#ifdef USE_OPENGL_API
cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims software
cvar_t *r_swapInterval;
cvar_t *r_glDriver;
#endif
cvar_t *r_swapInterval;
cvar_t *r_displayRefresh;
cvar_t *r_fullscreen;
cvar_t *r_mode;
Expand Down Expand Up @@ -4001,12 +4003,14 @@ static void CL_ToggleImgui_f( void )
static void CL_InitGLimp_Cvars( void )
{
// shared with GLimp
#ifdef USE_OPENGL_API
r_allowSoftwareGL = Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
Cvar_SetDescription( r_allowSoftwareGL, "Legacy cvar (ignored). OpenGL renderer removed; Vulkan only." );
Cvar_SetDescription( r_allowSoftwareGL, "Allow software OpenGL rendering if hardware acceleration is unavailable." );
r_glDriver = Cvar_Get( "r_glDriver", OPENGL_DRIVER_NAME, CVAR_ARCHIVE_ND | CVAR_LATCH );
Cvar_SetDescription( r_glDriver, "OpenGL driver library name (platform-specific)." );
#endif
r_swapInterval = Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE_ND );
Cvar_SetDescription( r_swapInterval, "V-blanks to wait before swapping buffers.\n 0: No V-Sync\n 1: Synced to the monitor's refresh rate." );
r_glDriver = Cvar_Get( "r_glDriver", OPENGL_DRIVER_NAME, CVAR_ARCHIVE_ND | CVAR_LATCH );
Cvar_SetDescription( r_glDriver, "Legacy cvar (ignored). OpenGL renderer removed; Vulkan only." );

r_displayRefresh = Cvar_Get( "r_displayRefresh", "0", CVAR_LATCH );
Cvar_CheckRange( r_displayRefresh, "0", "500", CV_INTEGER );
Expand Down
4 changes: 3 additions & 1 deletion src/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,11 @@ extern cvar_t *vid_xpos;
extern cvar_t *vid_ypos;
extern cvar_t *r_noborder;

#ifdef USE_OPENGL_API
extern cvar_t *r_allowSoftwareGL;
extern cvar_t *r_swapInterval;
extern cvar_t *r_glDriver;
#endif
extern cvar_t *r_swapInterval;

extern cvar_t *r_displayRefresh;
extern cvar_t *r_fullscreen;
Expand Down
4 changes: 2 additions & 2 deletions src/platform/sdl/sdl_glimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ static int GLW_SetMode( int mode, const char *modeFS, qboolean fullscreen, qbool
else
perChannelColorBits = 4;

#ifdef USE_OPENGL_API
#ifdef USE_VULKAN_API
if ( !vulkan )
#endif
Expand Down Expand Up @@ -450,6 +451,7 @@ static int GLW_SetMode( int mode, const char *modeFS, qboolean fullscreen, qbool
if ( !r_allowSoftwareGL->integer )
SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 );
}
#endif /* USE_OPENGL_API */

if ( ( SDL_window = SDL_CreateWindow( cl_title, x, y, config->vidWidth, config->vidHeight, flags ) ) == NULL )
{
Expand Down Expand Up @@ -692,8 +694,6 @@ void GLimp_Init( glconfig_t *config )
in_nograb = Cvar_Get( "in_nograb", "0", 0 );
Cvar_SetDescription( in_nograb, "Do not capture mouse in game, may be useful during online streaming." );

r_allowSoftwareGL = Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );

r_swapInterval = Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_stereoEnabled = Cvar_Get( "r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH );
Cvar_SetDescription( r_stereoEnabled, "Enable stereo rendering for techniques like shutter glasses." );
Expand Down
6 changes: 0 additions & 6 deletions src/renderers/vulkan/tr_animation.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ 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 );
Expand All @@ -425,9 +422,6 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
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];
Expand Down
24 changes: 1 addition & 23 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 @@ -546,11 +539,6 @@ typedef struct shader_s {

fogPass_t fogPass; // draw a blended pass, possibly with depth test equals

qboolean needsNormal; // not all shaders will need all data to be gathered
//qboolean needsST1;
qboolean needsST2;
//qboolean needsColor;

int numDeforms;
deformStage_t deforms[MAX_SHADER_DEFORMS];

Expand Down Expand Up @@ -2047,9 +2035,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 @@ -2114,14 +2100,6 @@ typedef struct shaderCommands_s
#endif
#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
68 changes: 0 additions & 68 deletions src/renderers/vulkan/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -3888,64 +3888,6 @@ static void InitShader( const char *name, int lightmapIndex ) {
}


static void DetectNeeds( void )
{
int i, n;

for ( i = 0; i < MAX_SHADER_STAGES; i++ )
{
if ( !stages[i].active )
break;

for ( n = 0; n < NUM_TEXTURE_BUNDLES; n++ ) {
const texCoordGen_t t = stages[i].bundle[n].tcGen;
if ( t == TCGEN_LIGHTMAP )
{
shader.needsST2 = qtrue;
}
if ( t == TCGEN_ENVIRONMENT_MAPPED || t == TCGEN_ENVIRONMENT_MAPPED_FP )
{
shader.needsNormal = qtrue;
}
if ( stages[i].bundle[n].alphaGen == AGEN_LIGHTING_SPECULAR || stages[i].bundle[n].rgbGen == CGEN_LIGHTING_DIFFUSE )
{
shader.needsNormal = qtrue;
}
}
#if 0
t1 = stages[i].bundle[0].tcGen;
t2 = stages[i].bundle[1].tcGen;

if ( t1 == TCGEN_LIGHTMAP || t2 == TCGEN_LIGHTMAP )
{
shader.needsST2 = qtrue;
}
if ( t1 == TCGEN_ENVIRONMENT_MAPPED || t1 == TCGEN_ENVIRONMENT_MAPPED_FP )
{
shader.needsNormal = qtrue;
}
if ( t2 == TCGEN_ENVIRONMENT_MAPPED || t2 == TCGEN_ENVIRONMENT_MAPPED_FP )
{
shader.needsNormal = qtrue;
}
if ( stages[i].bundle[0].alphaGen == AGEN_LIGHTING_SPECULAR || stages[i].bundle[0].rgbGen == CGEN_LIGHTING_DIFFUSE )
{
shader.needsNormal = qtrue;
}
#endif
}
for ( i = 0; i < shader.numDeforms; i++ )
{
if ( shader.deforms[i].deformation == DEFORM_WAVE || shader.deforms[i].deformation == DEFORM_NORMALS || shader.deforms[i].deformation == DEFORM_BULGE ) {
shader.needsNormal = qtrue;
}
if ( shader.deforms[i].deformation >= DEFORM_TEXT0 && shader.deforms[i].deformation <= DEFORM_TEXT7 ) {
shader.needsNormal = qtrue;
}
}
}


/*
=========================
FinishShader
Expand Down Expand Up @@ -4104,8 +4046,6 @@ static shader_t *FinishShader( void ) {
}
}

DetectNeeds();

// fix alphaGen flags to avoid redundant comparisons in R_ComputeColors()
for ( i = 0; i < MAX_SHADER_STAGES; i++ ) {
shaderStage_t *pStage = &stages[ i ];
Expand Down Expand Up @@ -4844,10 +4784,6 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag

InitShader( strippedName, lightmapIndex );

/* needsNormal etc. could be set based on stage requirements. */
//shader.needsST1 = qtrue;
//shader.needsST2 = qtrue;
//shader.needsColor = qtrue;

//
// attempt to define shader from an explicit parameter file
Expand Down Expand Up @@ -4933,10 +4869,6 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_

InitShader( name, lightmapIndex );

/* needsNormal etc. could be set based on stage requirements. */
//shader.needsST1 = qtrue;
//shader.needsST2 = qtrue;
//shader.needsColor = qtrue;

//
// create the default shading commands
Expand Down
Loading
Loading