From 71715cc4345d58abfbebd9003e121e8bc7dde5e2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 29 Sep 2023 16:51:52 +1000 Subject: [PATCH] vkd3d-shader: Fix compiler warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vkd3d-shader/tpf.c:3810:39: warning: passing argument 2 of ‘sm4_register_from_node’ from incompatible pointer type [-Wincompatible-pointer-types] vkd3d-shader/tpf.c:4750:59: warning: passing argument 3 of ‘sm4_register_from_deref’ from incompatible pointer type [-Wincompatible-pointer-types] Change to use uint32_t as requested. --- gitlab/build-mingw | 2 +- libs/vkd3d-shader/tpf.c | 17 ++++++++++------- libs/vkd3d-shader/vkd3d_shader_private.h | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gitlab/build-mingw b/gitlab/build-mingw index 383f9c4b..1334a18a 100755 --- a/gitlab/build-mingw +++ b/gitlab/build-mingw @@ -13,7 +13,7 @@ mkdir build cd build mkdir vulkan-headers cp -r /usr/include/vulkan /usr/include/vk_video /usr/include/spirv vulkan-headers -../configure --enable-demos --disable-doxygen-doc --without-ncurses --host=$HOST SONAME_LIBVULKAN="vulkan-1.dll" CPPFLAGS="-I$PWD/vulkan-headers" CFLAGS="-g -O2 -Wno-format -Wno-array-bounds -Wno-incompatible-pointer-types -Werror" LDFLAGS="-static-libgcc" && \ +../configure --enable-demos --disable-doxygen-doc --without-ncurses --host=$HOST SONAME_LIBVULKAN="vulkan-1.dll" CPPFLAGS="-I$PWD/vulkan-headers" CFLAGS="-g -O2 -Wno-format -Wno-array-bounds -Werror" LDFLAGS="-static-libgcc" && \ make -j$(nproc) && \ make -j$(nproc) install DESTDIR="$PWD/destdir" || \ touch ../pipeline_failed diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index d6902f8b..fbd84583 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3645,7 +3645,7 @@ struct sm4_instruction }; static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct vkd3d_shader_register *reg, - unsigned int *writemask, const struct hlsl_deref *deref) + uint32_t *writemask, const struct hlsl_deref *deref) { const struct hlsl_type *data_type = hlsl_deref_get_type(ctx, deref); const struct hlsl_ir_var *var = deref->var; @@ -3774,7 +3774,8 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct vkd3d_shader_re static void sm4_src_from_deref(const struct tpf_writer *tpf, struct vkd3d_shader_src_param *src, const struct hlsl_deref *deref, unsigned int map_writemask) { - unsigned int writemask, hlsl_swizzle; + unsigned int hlsl_swizzle; + uint32_t writemask; sm4_register_from_deref(tpf->ctx, &src->reg, &writemask, deref); if (vkd3d_sm4_get_default_swizzle_type(&tpf->lookup, src->reg.type) == VKD3D_SM4_SWIZZLE_VEC4) @@ -3784,7 +3785,7 @@ static void sm4_src_from_deref(const struct tpf_writer *tpf, struct vkd3d_shader } } -static void sm4_register_from_node(struct vkd3d_shader_register *reg, unsigned int *writemask, +static void sm4_register_from_node(struct vkd3d_shader_register *reg, uint32_t *writemask, const struct hlsl_ir_node *instr) { assert(instr->reg.allocated); @@ -3826,9 +3827,10 @@ static void sm4_src_from_constant_value(struct vkd3d_shader_src_param *src, } static void sm4_src_from_node(const struct tpf_writer *tpf, struct vkd3d_shader_src_param *src, - const struct hlsl_ir_node *instr, unsigned int map_writemask) + const struct hlsl_ir_node *instr, uint32_t map_writemask) { - unsigned int writemask, hlsl_swizzle; + unsigned int hlsl_swizzle; + uint32_t writemask; if (instr->type == HLSL_IR_CONSTANT) { @@ -5470,7 +5472,7 @@ static void write_sm4_store(const struct tpf_writer *tpf, const struct hlsl_ir_s { const struct hlsl_ir_node *rhs = store->rhs.node; struct sm4_instruction instr; - unsigned int writemask; + uint32_t writemask; memset(&instr, 0, sizeof(instr)); instr.opcode = VKD3D_SM4_OP_MOV; @@ -5487,8 +5489,9 @@ static void write_sm4_store(const struct tpf_writer *tpf, const struct hlsl_ir_s static void write_sm4_swizzle(const struct tpf_writer *tpf, const struct hlsl_ir_swizzle *swizzle) { - unsigned int writemask, hlsl_swizzle; + unsigned int hlsl_swizzle; struct sm4_instruction instr; + uint32_t writemask; memset(&instr, 0, sizeof(instr)); instr.opcode = VKD3D_SM4_OP_MOV; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index af75ef3b..f006d2db 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -758,7 +758,7 @@ void vsir_register_init(struct vkd3d_shader_register *reg, enum vkd3d_shader_reg struct vkd3d_shader_dst_param { struct vkd3d_shader_register reg; - DWORD write_mask; + uint32_t write_mask; DWORD modifiers; DWORD shift; };