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
3 changes: 1 addition & 2 deletions examples/demo_game/mod/demo_features.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ set r_fontConsoleAlign 1

// Optional SDF (pre-generated BMFont + distance atlas in pk3): set r_sdfEnable 1; set r_sdfFont "fonts/demo_console_sdf"; tune r_sdfSmoothing

// --- Renderer backend (user often sets on command line) ---
// +set cl_renderer vulkan or opengl
// --- Renderer backend (Vulkan only; SDL video driver via r_vid_driver / vid_restart) ---

// --- PBR / materials (Vulkan path) ---
set r_pbr 1
Expand Down
8 changes: 8 additions & 0 deletions scripts/q3_openarena_compat_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ else
fail "r_vdbFog default not 0"
fi

if grep -q '#ifdef USE_OPENGL_API' "$PROJECT_ROOT/src/client/cl_main.c" && \
awk '/CL_InitGLimp_Cvars/,/^}/ { if ($0 ~ /r_allowSoftwareGL = Cvar_Get/ && prev !~ /USE_OPENGL_API/) bad=1 } { prev=$0 } END { exit bad ? 1 : 0 }' \
"$PROJECT_ROOT/src/client/cl_main.c"; then
pass "r_allowSoftwareGL registration gated behind USE_OPENGL_API"
else
fail "r_allowSoftwareGL must be registered only when USE_OPENGL_API is defined"
fi

if grep -qE 'cs_autoInit[[:space:]]*=[[:space:]]*Cvar_Get\([[:space:]]*"cs_autoInit"[[:space:]]*,[[:space:]]*"0"' \
"$PROJECT_ROOT/src/qcommon/csharp_debug.c"; then
pass "cs_autoInit defaults to 0 (C# runtime manual until cs_reload)"
Expand Down
14 changes: 9 additions & 5 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;

cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims software
cvar_t *r_swapInterval;
#ifdef USE_OPENGL_API
cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims software
cvar_t *r_glDriver;
#endif
cvar_t *r_displayRefresh;
cvar_t *r_fullscreen;
cvar_t *r_mode;
Expand Down Expand Up @@ -4000,13 +4002,15 @@ static void CL_ToggleImgui_f( void )

static void CL_InitGLimp_Cvars( void )
{
// shared with GLimp
r_allowSoftwareGL = Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
Cvar_SetDescription( r_allowSoftwareGL, "Legacy cvar (ignored). OpenGL renderer removed; Vulkan only." );
// shared with GLimp / VKimp
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." );
#ifdef USE_OPENGL_API
r_allowSoftwareGL = Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
Cvar_SetDescription( r_allowSoftwareGL, "Toggle the use of the default software OpenGL driver supplied by the Operating System." );
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." );
Cvar_SetDescription( r_glDriver, "Specifies the OpenGL driver to use, will revert back to default if driver name set is invalid." );
#endif

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;

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

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

#ifdef USE_VULKAN_API
#if defined(USE_OPENGL_API)
# ifdef USE_VULKAN_API
if ( !vulkan )
#endif
# endif
{

#ifdef __sgi /* Fix for SGIs grabbing too many bits of color */
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,7 +694,9 @@ 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." );

#ifdef USE_OPENGL_API
r_allowSoftwareGL = Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
#endif

r_swapInterval = Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_stereoEnabled = Cvar_Get( "r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH );
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
31 changes: 5 additions & 26 deletions src/renderers/vulkan/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define TR_LOCAL_H

#define USE_VK_PBR
#ifdef USE_VK_PBR
#define VK_PBR_BRDFLUT // for inspecting codebase, does not toggle brdflut.
#define VK_CUBEMAP

#ifdef VK_CUBEMAP
#define REF_CUBEMAP_IRRADIANCE_SIZE 64
#define REF_CUBEMAP_SIZE 256
#endif
#endif
#define VK_PBR_BRDFLUT // for inspecting codebase, does not toggle brdflut.
#define VK_CUBEMAP
#define REF_CUBEMAP_IRRADIANCE_SIZE 64
#define REF_CUBEMAP_SIZE 256

#define USE_VBO // store static world geometry in VBO
#define USE_FOG_COLLAPSE // not compatible with legacy dlights
Expand All @@ -42,13 +37,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 +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 @@ -2115,13 +2101,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
Loading
Loading