Fix various warnings

This commit is contained in:
Tim Angus committed 2025-09-07 17:03:20 +01:00
1 parent 549b686e22
commit f976711fb4
58 files changed
+384 -425

No files matched your search

+30 -30
View File
@@ -454,7 +454,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
backEnd.pc.c_surfaces += numDrawSurfs;
for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) {
if ( drawSurf->sort == oldSort && drawSurf->cubemapIndex == oldCubemapIndex) {
if ( drawSurf->sort == (unsigned)oldSort && drawSurf->cubemapIndex == oldCubemapIndex) {
if (backEnd.depthFill && shader && (shader->sort != SS_OPAQUE && shader->sort != SS_PORTAL))
continue;
@@ -462,7 +462,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );
continue;
}
oldSort = drawSurf->sort;
oldSort = (int)drawSurf->sort;
R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlighted, &pshadowed );
cubemapIndex = drawSurf->cubemapIndex;
@@ -1147,7 +1147,7 @@ const void *RB_DrawSurfs( const void *data ) {
if (r_drawSun->integer)
{
RB_DrawSun(0.1, tr.sunShader);
RB_DrawSun(0.1f, tr.sunShader);
}
if (glRefConfig.framebufferObject && r_drawSunRays->integer)
@@ -1164,7 +1164,7 @@ const void *RB_DrawSurfs( const void *data ) {
qglBeginQuery(glRefConfig.occlusionQueryTarget, tr.sunFlareQuery[tr.sunFlareQueryIndex]);
}
RB_DrawSun(0.3, tr.sunFlareShader);
RB_DrawSun(0.3f, tr.sunFlareShader);
if (glRefConfig.occlusionQuery)
{
@@ -1622,44 +1622,44 @@ const void *RB_PostProcess(const void *data)
if (0 && r_sunlightMode->integer)
{
ivec4_t dstBox;
VectorSet4(dstBox, 0, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 128, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[1], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 256, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[2], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 384, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
ivec4_t dstBox2;
VectorSet4(dstBox2, 0, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 128, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[1], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 256, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[2], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 384, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
}
if (0 && r_shadows->integer == 4)
{
ivec4_t dstBox;
VectorSet4(dstBox, 512 + 0, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 512 + 128, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 512 + 256, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 512 + 384, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
ivec4_t dstBox2;
VectorSet4(dstBox2, 512 + 0, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 512 + 128, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 512 + 256, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 512 + 384, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
}
if (0)
{
ivec4_t dstBox;
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
ivec4_t dstBox2;
VectorSet4(dstBox2, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
VectorSet4(dstBox2, 512, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
}
if (0)
{
ivec4_t dstBox;
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
ivec4_t dstBox2;
VectorSet4(dstBox2, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0);
}
#if 0
+22 -25
View File
@@ -208,7 +208,6 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
int i, j, numLightmaps, textureInternalFormat = 0;
int numLightmapsPerPage = 16;
float maxIntensity = 0;
double sumIntensity = 0;
len = l->filelen;
if ( !len ) {
@@ -442,8 +441,6 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
image[j*4+1] = out[1] * 255;
image[j*4+2] = out[2] * 255;
image[j*4+3] = 255;
sumIntensity += intensity;
}
else
{
@@ -2795,7 +2792,7 @@ void RE_LoadWorldMap( const char *name ) {
world_t *w;
uint8_t *primaryLightGrid, *data;
int lightGridSize;
int i;
int j;
w = &s_worldData;
@@ -2805,7 +2802,7 @@ void RE_LoadWorldMap( const char *name ) {
memset(primaryLightGrid, 0, lightGridSize * sizeof(*primaryLightGrid));
data = w->lightGridData;
for (i = 0; i < lightGridSize; i++, data += 8)
for (j = 0; j < lightGridSize; j++, data += 8)
{
int lat, lng;
vec3_t gridLightDir, gridLightCol;
@@ -2835,39 +2832,39 @@ void RE_LoadWorldMap( const char *name ) {
// FIXME: magic number for determining if light direction is close enough to sunlight
if (DotProduct(gridLightDir, tr.sunDirection) > 0.75f)
{
primaryLightGrid[i] = 1;
primaryLightGrid[j] = 1;
}
else
{
primaryLightGrid[i] = 255;
primaryLightGrid[j] = 255;
}
}
if (0)
{
int i;
byte *buffer = ri.Malloc(w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18);
int k;
byte *buf = ri.Malloc(w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18);
byte *out;
uint8_t *in;
char fileName[MAX_QPATH];
Com_Memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = w->lightGridBounds[0] & 255;
buffer[13] = w->lightGridBounds[0] >> 8;
buffer[14] = w->lightGridBounds[1] & 255;
buffer[15] = w->lightGridBounds[1] >> 8;
buffer[16] = 24; // pixel size
Com_Memset (buf, 0, 18);
buf[2] = 2; // uncompressed type
buf[12] = w->lightGridBounds[0] & 255;
buf[13] = w->lightGridBounds[0] >> 8;
buf[14] = w->lightGridBounds[1] & 255;
buf[15] = w->lightGridBounds[1] >> 8;
buf[16] = 24; // pixel size
in = primaryLightGrid;
for (i = 0; i < w->lightGridBounds[2]; i++)
for (k = 0; k < w->lightGridBounds[2]; k++)
{
int j;
int l;
sprintf(fileName, "primarylg%d.tga", i);
sprintf(fileName, "primarylg%d.tga", l);
out = buffer + 18;
for (j = 0; j < w->lightGridBounds[0] * w->lightGridBounds[1]; j++)
out = buf + 18;
for (l = 0; l < w->lightGridBounds[0] * w->lightGridBounds[1]; l++)
{
if (*in == 1)
{
@@ -2890,15 +2887,15 @@ void RE_LoadWorldMap( const char *name ) {
in++;
}
ri.FS_WriteFile(fileName, buffer, w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18);
ri.FS_WriteFile(fileName, buf, w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18);
}
ri.Free(buffer);
ri.Free(buf);
}
for (i = 0; i < w->numWorldSurfaces; i++)
for (j = 0; j < w->numWorldSurfaces; j++)
{
msurface_t *surf = w->surfaces + i;
msurface_t *surf = w->surfaces + j;
cullinfo_t *ci = &surf->cullinfo;
if(ci->type & CULLINFO_PLANE)
+2 -2
View File
@@ -239,9 +239,9 @@ void RE_SetColor( const float *rgba ) {
}
cmd->commandId = RC_SET_COLOR;
if ( !rgba ) {
static float colorWhite[4] = { 1, 1, 1, 1 };
static float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
rgba = colorWhite;
rgba = white;
}
cmd->color[0] = rgba[0];
+5 -8
View File
@@ -113,7 +113,6 @@ static void MakeMeshNormals( int width, int height, srfVert_t ctrl[MAX_GRID_SIZE
int i, j, k, dist;
vec3_t normal;
vec3_t sum;
int count = 0;
vec3_t base;
vec3_t delta;
int x, y;
@@ -153,7 +152,6 @@ static int neighbors[8][2] = {
for ( i = 0 ; i < width ; i++ ) {
for ( j = 0 ; j < height ; j++ ) {
count = 0;
dv = &ctrl[j][i];
VectorCopy( dv->xyz, base );
for ( k = 0 ; k < 8 ; k++ ) {
@@ -202,7 +200,6 @@ static int neighbors[8][2] = {
continue;
}
VectorAdd( normal, sum, sum );
count++;
}
//if ( count == 0 ) {
// printf("bad normal\n");
@@ -482,7 +479,7 @@ void R_SubdividePatchToGrid( srfBspSurface_t *grid, int width, int height,
for ( i = 0 ; i < height ; i++ ) {
vec3_t midxyz;
vec3_t midxyz2;
vec3_t dir;
vec3_t dirVector;
vec3_t projected;
float d;
@@ -497,11 +494,11 @@ void R_SubdividePatchToGrid( srfBspSurface_t *grid, int width, int height,
// texture warping, but it gives a lot less polygons than
// dist-from-midpoint
VectorSubtract( midxyz, ctrl[i][j].xyz, midxyz );
VectorSubtract( ctrl[i][j+2].xyz, ctrl[i][j].xyz, dir );
VectorNormalize( dir );
VectorSubtract( ctrl[i][j+2].xyz, ctrl[i][j].xyz, dirVector );
VectorNormalize( dirVector );
d = DotProduct( midxyz, dir );
VectorScale( dir, d, projected );
d = DotProduct( midxyz, dirVector );
VectorScale( dirVector, d, projected );
VectorSubtract( midxyz, projected, midxyz2);
len = VectorLengthSquared( midxyz2 ); // we will do the sqrt later
if ( len > maxLen ) {
+4 -4
View File
@@ -1582,9 +1582,9 @@ static qboolean RawImage_ScaleToPower2( byte **data, int *inout_width, int *inou
int height = *inout_height;
int scaled_width;
int scaled_height;
qboolean picmip = flags & IMGFLAG_PICMIP;
qboolean mipmap = flags & IMGFLAG_MIPMAP;
qboolean clampToEdge = flags & IMGFLAG_CLAMPTOEDGE;
qboolean picmip = !!(flags & IMGFLAG_PICMIP);
qboolean mipmap = !!(flags & IMGFLAG_MIPMAP);
qboolean clampToEdge = !!(flags & IMGFLAG_CLAMPTOEDGE);
qboolean scaled;
//
@@ -1744,7 +1744,7 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm
{
int samples = 3;
GLenum internalFormat = GL_RGB;
qboolean forceNoCompression = (flags & IMGFLAG_NO_COMPRESSION);
qboolean forceNoCompression = !!(flags & IMGFLAG_NO_COMPRESSION);
qboolean normalmap = (type == IMGTYPE_NORMAL || type == IMGTYPE_NORMALHEIGHT);
if (picFormat != GL_RGBA8)
+2 -4
View File
@@ -72,7 +72,7 @@ qboolean R_CompareVert(srfVert_t * v1, srfVert_t * v2, qboolean checkST)
=============
R_CalcTexDirs
Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html
Lengyel, Eric. �Computing Tangent Space Basis Vectors for an Arbitrary Mesh�. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html
=============
*/
void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2,
@@ -104,7 +104,7 @@ void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2,
=============
R_CalcTangentSpace
Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html
Lengyel, Eric. �Computing Tangent Space Basis Vectors for an Arbitrary Mesh�. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html
=============
*/
vec_t R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, const vec3_t normal, const vec3_t sdir, const vec3_t tdir)
@@ -1206,7 +1206,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
int pshadowed;
vec4_t clip, eye;
int i;
unsigned int pointOr = 0;
unsigned int pointAnd = (unsigned int)~0;
R_RotateForViewer();
@@ -1236,7 +1235,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
}
}
pointAnd &= pointFlags;
pointOr |= pointFlags;
}
// trivially reject
+1 -1
View File
@@ -974,7 +974,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
for (i = 0; i < iqmData->num_surfaces; i++, vaoSurf++, surf++)
{
uint32_t offset_xyz, offset_st, offset_normal, offset_tangent;
uint32_t offset_blendindexes, offset_blendweights, stride;
uint32_t offset_blendindexes = 0, offset_blendweights = 0, stride;
uint32_t dataSize, dataOfs;
uint8_t *data;
glIndex_t indexes[SHADER_MAX_INDEXES];
+13 -13
View File
@@ -2686,7 +2686,7 @@ static void FixRenderCommandList( int newShader ) {
{
int i;
drawSurf_t *drawSurf;
shader_t *shader;
shader_t *pShader;
int fogNum;
int entityNum;
int dlightMap;
@@ -2695,7 +2695,7 @@ static void FixRenderCommandList( int newShader ) {
const drawSurfsCommand_t *ds_cmd = (const drawSurfsCommand_t *)curCmd;
for( i = 0, drawSurf = ds_cmd->drawSurfs; i < ds_cmd->numDrawSurfs; i++, drawSurf++ ) {
R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlightMap, &pshadowMap );
R_DecomposeSort( drawSurf->sort, &entityNum, &pShader, &fogNum, &dlightMap, &pshadowMap );
sortedIndex = (( drawSurf->sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1));
if( sortedIndex >= newShader ) {
sortedIndex++;
@@ -3730,43 +3730,43 @@ A second parameter will cause it to print in sorted order
void R_ShaderList_f (void) {
int i;
int count;
shader_t *shader;
shader_t *pShader;
ri.Printf (PRINT_ALL, "-----------------------\n");
count = 0;
for ( i = 0 ; i < tr.numShaders ; i++ ) {
if ( ri.Cmd_Argc() > 1 ) {
shader = tr.sortedShaders[i];
pShader = tr.sortedShaders[i];
} else {
shader = tr.shaders[i];
pShader = tr.shaders[i];
}
ri.Printf( PRINT_ALL, "%i ", shader->numUnfoggedPasses );
ri.Printf( PRINT_ALL, "%i ", pShader->numUnfoggedPasses );
if (shader->lightmapIndex >= 0 ) {
if (pShader->lightmapIndex >= 0 ) {
ri.Printf (PRINT_ALL, "L ");
} else {
ri.Printf (PRINT_ALL, " ");
}
if ( shader->explicitlyDefined ) {
if ( pShader->explicitlyDefined ) {
ri.Printf( PRINT_ALL, "E " );
} else {
ri.Printf( PRINT_ALL, " " );
}
if ( shader->optimalStageIteratorFunc == RB_StageIteratorGeneric ) {
if ( pShader->optimalStageIteratorFunc == RB_StageIteratorGeneric ) {
ri.Printf( PRINT_ALL, "gen " );
} else if ( shader->optimalStageIteratorFunc == RB_StageIteratorSky ) {
} else if ( pShader->optimalStageIteratorFunc == RB_StageIteratorSky ) {
ri.Printf( PRINT_ALL, "sky " );
} else {
ri.Printf( PRINT_ALL, " " );
}
if ( shader->defaultShader ) {
ri.Printf (PRINT_ALL, ": %s (DEFAULTED)\n", shader->name);
if ( pShader->defaultShader ) {
ri.Printf (PRINT_ALL, ": %s (DEFAULTED)\n", pShader->name);
} else {
ri.Printf (PRINT_ALL, ": %s\n", shader->name);
ri.Printf (PRINT_ALL, ": %s\n", pShader->name);
}
count++;
}