Skip to content

Commit

Permalink
just make compiler happy
Browse files Browse the repository at this point in the history
  • Loading branch information
briancullinan2 committed Aug 7, 2024
1 parent 5c53a2b commit e94b87a
Show file tree
Hide file tree
Showing 22 changed files with 407 additions and 41 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ Q3RENDVOBJ = \
$(B)/rendv/tr_marks.o \
$(B)/rendv/tr_mesh.o \
$(B)/rendv/tr_model.o \
$(B)/rendv/tr_manipulation.o \
$(B)/rendv/tr_model_iqm.o \
$(B)/rendv/tr_noise.o \
$(B)/rendv/tr_scene.o \
Expand Down
2 changes: 1 addition & 1 deletion code/libvorbis/lib/vorbisfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,

long channels=ov_info(vf,-1)->channels;
long bytespersample=word * channels;
//vorbis_fpu_control fpu;
vorbis_fpu_control fpu;

if(channels<1||channels>255)return(OV_EINVAL);
if(samples>length/bytespersample)samples=length/bytespersample;
Expand Down
3 changes: 1 addition & 2 deletions code/qcommon/qcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,7 @@ void Sys_SetClipboardBitmap( const byte *bitmap, int length );
void Sys_Print( const char *msg );

// dedicated console status, win32-only at the moment
//void QDECL Sys_SetStatus( const char *format, ...) __attribute__ ((format (printf, 1, 2)));
#define Sys_SetStatus Com_Printf
void QDECL Sys_SetStatus( const char *format, ...) __attribute__ ((format (printf, 1, 2)));

#ifdef USE_AFFINITY_MASK
uint64_t Sys_GetAffinityMask( void );
Expand Down
5 changes: 2 additions & 3 deletions code/renderer/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,6 @@ static void R_Register( void )
r_mapGreyScale = ri.Cvar_Get( "r_mapGreyScale", "0", CVAR_ARCHIVE_ND | CVAR_LATCH );
ri.Cvar_CheckRange( r_mapGreyScale, "-1", "1", CV_FLOAT );
ri.Cvar_SetDescription(r_mapGreyScale, "Desaturate world map textures only, works independently from \\r_greyscale, negative values only desaturate lightmaps.");
r_paletteMode = ri.Cvar_Get("r_paletteMode", "0", CVAR_ARCHIVE);

r_subdivisions = ri.Cvar_Get( "r_subdivisions", "4", CVAR_ARCHIVE_ND | CVAR_LATCH );
ri.Cvar_SetDescription(r_subdivisions, "Distance to subdivide bezier curved surfaces. Higher values mean less subdivision and less geometric complexity.");
Expand Down Expand Up @@ -1694,8 +1693,8 @@ static void R_Register( void )
ri.Cvar_SetDescription( r_greyscale, "Desaturate rendered frame, requires \\r_fbo 1." );
ri.Cvar_SetGroup( r_greyscale, CVG_RENDERER );

r_paletteMode = ri.Cvar_Get("r_paletteMode", "0", CVAR_ARCHIVE | CVAR_LATCH);

r_paletteMode = ri.Cvar_Get("r_paletteMode", "0", CVAR_ARCHIVE_ND);
ri.Cvar_SetGroup( r_paletteMode, CVG_RENDERER );
r_edgy = ri.Cvar_Get( "r_edgy", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetGroup( r_edgy, CVG_RENDERER );
r_invert = ri.Cvar_Get( "r_invert", "0", CVAR_ARCHIVE_ND );
Expand Down
13 changes: 6 additions & 7 deletions code/renderer/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -3829,13 +3829,12 @@ static void ScanAndLoadShaderFiles( void )
}


// const char *shaderText = FindShaderInShaderText("palettes/default");
// if ( !shaderText ) {
// ri.Printf(PRINT_WARNING, "Error: parsing default palette\n");
// } else {
// ParseShader( &shaderText );
// }

const char *shaderText = FindShaderInShaderText("palettes/default");
if ( !shaderText ) {
ri.Printf(PRINT_WARNING, "Error: parsing default palette\n");
} else {
ParseShader( &shaderText );
}
}


Expand Down
2 changes: 1 addition & 1 deletion code/renderer2/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ static void R_Register( void )
r_maxpolybuffers = ri.Cvar_Get( "r_maxpolybuffers", va("%i", MAX_POLYBUFFERS), CVAR_LATCH);

r_paletteMode = ri.Cvar_Get("r_paletteMode", "0", CVAR_ARCHIVE);

ri.Cvar_SetGroup( r_paletteMode, CVG_RENDERER );
r_edgy = ri.Cvar_Get( "r_edgy", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetGroup( r_edgy, CVG_RENDERER );
r_invert = ri.Cvar_Get( "r_invert", "0", CVAR_ARCHIVE_ND );
Expand Down
7 changes: 7 additions & 0 deletions code/renderer2/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -4361,6 +4361,12 @@ static void ScanAndLoadShaderFiles( void )
SkipBracedSection(&p, 0);
}

const char *shaderText = FindShaderInShaderText("palettes/default");
if ( !shaderText ) {
ri.Printf(PRINT_WARNING, "Error: parsing default palette\n");
} else {
ParseShader( &shaderText );
}
}


Expand All @@ -4370,6 +4376,7 @@ CreateInternalShaders
====================
*/
static void CreateInternalShaders( void ) {
tr.numShaders = 0;

// init the default shader
InitShader( "<default>", LIGHTMAP_NONE );
Expand Down
2 changes: 1 addition & 1 deletion code/renderercommon/tr_manipulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void R_AddPalette(const char *name, int a, int r, int g, int b) {
}
}

palette = ri.Malloc( sizeof( *palette ) + namelen + 1 );
palette = ri.Hunk_Alloc( sizeof( *palette ) + namelen + 1, h_low );
palette->imgName = (char *)( palette + 1 );
strcpy( palette->imgName, normalName );
palette->a = a;
Expand Down
42 changes: 41 additions & 1 deletion code/renderervk/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ void RE_LoadWorldMap( const char *name );
*/

#ifdef USE_MULTIVM_RENDERER
static world_t s_worldDatas[MAX_NUM_WORLDS];
int rwi = 0; // render world, should match number of loaded clip maps,
// since they are reusable
int rwi_ref = 0;
#define s_worldData s_worldDatas[rwi]
#else
static world_t s_worldData;
#endif

static byte *fileBase;

static int c_gridVerts;
Expand Down Expand Up @@ -2249,7 +2258,12 @@ RE_LoadWorldMap
Called directly from cgame
=================
*/
void RE_LoadWorldMap( const char *name ) {
#ifdef USE_MULTIVM_RENDERER
int RE_LoadWorldMap( const char *name )
#else
void RE_LoadWorldMap( const char *name )
#endif
{
int i;
int32_t size;
dheader_t *header;
Expand All @@ -2259,10 +2273,36 @@ void RE_LoadWorldMap( const char *name ) {
} buffer;
byte *startMarker;

RE_ClearScene();

#ifdef USE_MULTIVM_RENDERER
int j, empty = -1;
for(j = 0; j < MAX_NUM_WORLDS; j++) {
if ( !Q_stricmp( s_worldDatas[j].name, name ) ) {
// TODO: PRINT_DEVELOPER
rwi = 0;
ri.Printf( PRINT_ALL, "RE_LoadWorldMap (%i): Already loaded %s\n", j, name );
return j;
} else if (s_worldDatas[j].name[0] == '\0' && empty == -1) {
// load additional world in to next slot
empty = j;
}
}
rwi = empty;
// TODO: if (empty == -1) FreeOldestClipmap

#else

if ( tr.worldMapLoaded ) {
#if defined(USE_MULTIVM_RENDERER) || defined(USE_LAZY_MEMORY)
ri.Printf( PRINT_WARNING, "ERROR: attempted to redundantly load world map\n" );
#else
ri.Error( ERR_DROP, "ERROR: attempted to redundantly load world map" );
#endif
}

#endif

// set default sun direction to be used if it isn't
// overridden by a shader
tr.sunDirection[0] = 0.45f;
Expand Down
7 changes: 7 additions & 0 deletions code/renderervk/tr_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,17 @@ void RE_StretchPic( float x, float y, float w, float h,
}
cmd->commandId = RC_STRETCH_PIC;
cmd->shader = R_GetShaderByHandle( hShader );
#ifdef USE_MULTIVM_RENDERER
cmd->x = x * dvrXScale + (dvrXOffset * glConfig.vidWidth);
cmd->y = y * dvrYScale + (dvrYOffset * glConfig.vidHeight);
cmd->w = w * dvrXScale;
cmd->h = h * dvrYScale;
#else
cmd->x = x;
cmd->y = y;
cmd->w = w;
cmd->h = h;
#endif
cmd->s1 = s1;
cmd->t1 = t1;
cmd->s2 = s2;
Expand Down
26 changes: 25 additions & 1 deletion code/renderervk/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,12 @@ void R_InitFogTable( void ) {

tr.fogTable[i] = d;
}

#ifdef USE_MULTIVM_RENDERER
for(i = 1; i < MAX_NUM_WORLDS; i++) {
memcpy(trWorlds[i].fogTable, tr.fogTable, sizeof(tr.fogTable));
}
#endif
}


Expand Down Expand Up @@ -1726,7 +1732,6 @@ R_InitImages
===============
*/
void R_InitImages( void ) {

#ifdef USE_VULKAN
// initialize linear gamma table before setting color mappings for the first time
int i;
Expand All @@ -1743,6 +1748,17 @@ void R_InitImages( void ) {
// create default texture and white texture
R_CreateBuiltinImages();

#ifdef USE_MULTIVM_RENDERER
for(i = 1; i < MAX_NUM_WORLDS; i++) {
trWorlds[i].whiteImage = tr.whiteImage;
trWorlds[i].defaultImage = tr.defaultImage;
trWorlds[i].identityLightImage = tr.identityLightImage;
trWorlds[i].dlightImage = tr.dlightImage;
trWorlds[i].fogImage = tr.fogImage;
trWorlds[i].numImages = 5;
}
#endif

#ifdef USE_VULKAN
vk_update_post_process_pipelines();
#endif
Expand Down Expand Up @@ -2045,6 +2061,14 @@ void R_InitSkins( void ) {
skin->numSurfaces = 1;
skin->surfaces = ri.Hunk_Alloc( sizeof( skinSurface_t ), h_low );
skin->surfaces[0].shader = tr.defaultShader;

#ifdef USE_MULTIVM_RENDERER
int i;
for(i = 1; i < MAX_NUM_WORLDS; i++) {
trWorlds[i].skins[0] = skin;
trWorlds[i].numSkins = 3;
}
#endif
}


Expand Down
54 changes: 53 additions & 1 deletion code/renderervk/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,29 @@ cvar_t *r_aviMotionJpegQuality;
cvar_t *r_screenshotJpegQuality;

static cvar_t *r_maxpolys;
static cvar_t* r_maxpolyverts;
static cvar_t *r_maxpolyverts;
static cvar_t *r_maxpolybuffers;
int max_polys;
int max_polyverts;
int max_polybuffers;

#ifdef USE_MULTIVM_RENDERER
float dvrXScale = 1;
float dvrYScale = 1;
float dvrXOffset = 0;
float dvrYOffset = 0;
#endif

cvar_t *r_paletteMode;
cvar_t *r_edgy;
cvar_t *r_invert;
cvar_t *r_rainbow;
cvar_t *r_berserk;
cvar_t *r_showverts;

#ifdef USE_AUTO_TERRAIN
cvar_t *r_autoTerrain;
#endif

#ifdef USE_VULKAN

Expand Down Expand Up @@ -1537,7 +1557,11 @@ static void R_Register( void )
r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE_ND | CVAR_LATCH );
ri.Cvar_SetDescription( r_texturebits, "Number of texture bits per texture." );

#if defined(USE_MULTIVM_SERVER) || defined(USE_MULTIVM_RENDERER)
r_mergeLightmaps = ri.Cvar_Get( "r_mergeLightmaps", "0", CVAR_ROM );
#else
r_mergeLightmaps = ri.Cvar_Get( "r_mergeLightmaps", "1", CVAR_ARCHIVE_ND | CVAR_LATCH );
#endif
ri.Cvar_SetDescription( r_mergeLightmaps, "Merge built-in small lightmaps into bigger lightmaps (atlases)." );
#if defined (USE_VULKAN) && defined (USE_VBO)
r_vbo = ri.Cvar_Get( "r_vbo", "1", CVAR_ARCHIVE | CVAR_LATCH );
Expand Down Expand Up @@ -1834,10 +1858,17 @@ void R_Init( void ) {
ri.Printf( PRINT_ALL, "----- R_Init -----\n" );

// clear all our internal state
#ifdef USE_MULTIVM_RENDERER
Com_Memset( &trWorlds, 0, sizeof( trWorlds ) );
Com_Memset( &backEnd, 0, sizeof( backEnd ) );
Com_Memset( &tess, 0, sizeof( tess ) );
Com_Memset( &glState, 0, sizeof( glState ) );
#else
Com_Memset( &tr, 0, sizeof( tr ) );
Com_Memset( &backEnd, 0, sizeof( backEnd ) );
Com_Memset( &tess, 0, sizeof( tess ) );
Com_Memset( &glState, 0, sizeof( glState ) );
#endif

if (sizeof(glconfig_t) != 11332)
ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 11332", (unsigned int) sizeof(glconfig_t));
Expand Down Expand Up @@ -2018,6 +2049,19 @@ static void RE_EndRegistration( void ) {
}


#ifdef USE_LAZY_MEMORY
#ifdef USE_MULTIVM_RENDERER
void RE_SetDvrFrame(float x, float y, float width, float height) {
dvrXScale = width;
dvrYScale = height;
dvrXOffset = x;
dvrYOffset = y;
}
#endif
#endif



/*
@@@@@@@@@@@@@@@@@@@@@
GetRefAPI
Expand Down Expand Up @@ -2091,5 +2135,13 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
re.VertexLighting = RE_VertexLighting;
re.SyncRender = RE_SyncRender;

#if defined(USE_MULTIVM_RENDERER) || defined(USE_MULTIVM_SERVER)
re.InitShaders = R_InitShaders;
#endif

#ifdef USE_MULTIVM_RENDERER
re.SetDvrFrame = RE_SetDvrFrame;
#endif

return &re;
}
4 changes: 4 additions & 0 deletions code/renderervk/tr_light.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
R_LightForPoint
=================
*/
#ifdef USE_MULTIVM_RENDERER
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir, int world )
#else
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir )
#endif
{
trRefEntity_t ent;

Expand Down
Loading

0 comments on commit e94b87a

Please sign in to comment.