vk: compile w/ -Werror, fix a bunch of bad stuff

This commit is contained in:
Ivan Avdeev 2022-10-16 23:44:13 -07:00
parent cb406f14c5
commit ecac9a1f48
9 changed files with 15 additions and 12 deletions

View File

@ -161,7 +161,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f
float div, length, fraction, factor;
float flMaxWidth, vLast, vStep, brightness;
vec3_t perp1, vLastNormal;
beamseg_t curSeg;
beamseg_t curSeg = {0};
int total_vertices = 0;
int total_indices = 0;
r_geometry_buffer_lock_t buffer;

View File

@ -6,7 +6,7 @@
#include "com_strings.h"
#include "crtlib.h"
#define ASSERT(x) if(!( x )) gEngine.Host_Error( "assert " #x " failed at %s:%i\n", __FILE__, __LINE__ )
#define ASSERT(x) if(!( x )) gEngine.Host_Error( "assert %s failed at %s:%d\n", #x, __FILE__, __LINE__ )
#define Mem_Malloc( pool, size ) gEngine._Mem_Alloc( pool, size, false, __FILE__, __LINE__ )
#define Mem_Calloc( pool, size ) gEngine._Mem_Alloc( pool, size, true, __FILE__, __LINE__ )

View File

@ -779,7 +779,7 @@ void RT_LightAddFlashlight(const struct cl_entity_s *ent, qboolean local_player
vec3_t color;
vec3_t origin;
vec3_t angles;
vk_light_entity_t le;
vk_light_entity_t le = { .type = LightTypeSpot };
float thirdperson_offset = 25;
vec3_t forward, view_ofs;

View File

@ -82,7 +82,7 @@ static unsigned parseEntPropString(const char* value, string *out, unsigned bit)
const int len = Q_strlen(value);
if (len >= sizeof(string))
gEngine.Con_Printf(S_ERROR "Map entity value '%s' is too long, max length is %d\n",
value, sizeof(string));
value, (int)sizeof(string));
Q_strncpy(*out, value, sizeof(*out));
return bit;
}
@ -380,14 +380,15 @@ int findLightEntityWithIndex( int index ) {
static void addPatchEntity( const entity_props_t *props, uint32_t have_fields ) {
for (int i = 0; i < props->_xvk_ent_id.num; ++i) {
const int light_index = findLightEntityWithIndex( props->_xvk_ent_id.values[i] );
const int ent_id = props->_xvk_ent_id.values[i];
const int light_index = findLightEntityWithIndex( ent_id );
if (light_index < 0) {
gEngine.Con_Printf(S_ERROR "Patch light entity with index=%d not found\n", props->_xvk_ent_id);
gEngine.Con_Printf(S_ERROR "Patch light entity with index=%d not found\n", ent_id);
continue;
}
if (have_fields == Field__xvk_ent_id) {
gEngine.Con_Reportf("Deleting light entity (%d of %d) with index=%d\n", light_index, g_map_entities.num_lights, props->_xvk_ent_id);
gEngine.Con_Reportf("Deleting light entity (%d of %d) with index=%d\n", light_index, g_map_entities.num_lights, ent_id);
g_map_entities.num_lights--;
memmove(g_map_entities.lights + light_index, g_map_entities.lights + light_index + 1, sizeof(*g_map_entities.lights) * g_map_entities.num_lights - light_index);
continue;

View File

@ -28,7 +28,7 @@ const void* curReadPtr(cursor_t *cur, int size) {
#define CUR_ERROR(errmsg, ...) \
if (cur.error) { \
gEngine.Con_Printf(S_ERROR "(off=%d left=%d) " errmsg "\n", cur.off, (cur.size - cur.off), #__VA_ARGS__); \
gEngine.Con_Printf(S_ERROR "(off=%d left=%d) " errmsg "\n", cur.off, (cur.size - cur.off), ##__VA_ARGS__); \
goto finalize; \
}

View File

@ -27,7 +27,7 @@ void VK_PipelineShutdown( void )
VkShaderModule R_VkShaderLoadFromMem(const void *ptr, uint32_t size, const char *name) {
if ((size % 4 != 0) || (((uintptr_t)ptr & 3) != 0)) {
gEngine.Con_Printf(S_ERROR "Couldn't load shader %s: size %zu or buf %p is not aligned to 4 bytes as required by SPIR-V/Vulkan spec\n", name, size, ptr);
gEngine.Con_Printf(S_ERROR "Couldn't load shader %s: size %u or buf %p is not aligned to 4 bytes as required by SPIR-V/Vulkan spec\n", name, size, ptr);
return VK_NULL_HANDLE;
}

View File

@ -81,7 +81,7 @@ qboolean createOrUpdateAccelerationStructure(VkCommandBuffer cmdbuf, const as_bu
};
if (buffer_offset == ALO_ALLOC_FAILED) {
gEngine.Con_Printf(S_ERROR "Failed to allocated %u bytes for accel buffer\n", asci.size);
gEngine.Con_Printf(S_ERROR "Failed to allocated %u bytes for accel buffer\n", (uint32_t)asci.size);
return false;
}

View File

@ -39,7 +39,7 @@ typedef struct
cvar_t *r_glowshellfreq;
cvar_t r_shadows = { "r_shadows", "0", 0 };
cvar_t r_shadows = { (char*)"r_shadows", (char*)"0", 0 };
typedef struct sortedmesh_s
{

View File

@ -100,7 +100,7 @@ def build(bld):
if bld.env.DEST_OS == 'win32':
includes.append(bld.env.VULKAN_SDK + '\\Include')
includes.append(bld.env.VULKAN_SDK + '\\Source\SPIRV-Reflect\include') # for spirv.h
includes.append(bld.env.VULKAN_SDK + '\\Source\SPIRV-Reflect\include') # for spirv.h
if bld.env.HAVE_AFTERMATH:
defines.append('USE_AFTERMATH')
@ -112,6 +112,8 @@ def build(bld):
if bld.env.COMPILER_CC == 'msvc':
bld.env.CFLAGS += ['/WX']
else:
bld.env.CFLAGS += ['-Werror'] # TODO , '-Wall']
bld.shlib(
source = source,