diff --git a/src/gallium/drivers/vc4/kernel/vc4_packet.h b/src/gallium/drivers/vc4/kernel/vc4_packet.h index c2e3a5128f0..05adfa105d4 100644 --- a/src/gallium/drivers/vc4/kernel/vc4_packet.h +++ b/src/gallium/drivers/vc4/kernel/vc4_packet.h @@ -126,7 +126,7 @@ enum vc4_packet { /* Size of a full resolution color or Z tile buffer load/store. */ #define VC4_TILE_BUFFER_SIZE (64 * 64 * 4) -#define VC4_MASK(high, low) (((1 << ((high) - (low) + 1)) - 1) << (low)) +#define VC4_MASK(high, low) (((1u << ((high) - (low) + 1)) - 1) << (low)) /* Using the GNU statement expression extension */ #define VC4_SET_FIELD(value, field) \ ({ \ diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index 4c599542c39..7f6454d424d 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -130,7 +130,7 @@ static nir_def * vc4_nir_set_packed_chan(nir_builder *b, nir_def *src0, nir_def *src1, int chan) { - unsigned chan_mask = 0xff << (chan * 8); + unsigned chan_mask = 0xffu << (chan * 8); return nir_ior(b, nir_iand_imm(b, src0, ~chan_mask), nir_iand_imm(b, src1, chan_mask)); @@ -492,7 +492,7 @@ vc4_nir_blend_pipeline(struct vc4_compile *c, nir_builder *b, nir_def *src, for (int i = 0; i < 4; i++) { if (format_swiz[i] < 4 && !(c->fs_key->blend.colormask & (1 << format_swiz[i]))) { - colormask &= ~(0xff << (i * 8)); + colormask &= ~(0xffu << (i * 8)); } } diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c index a09ac515abc..3e9038dcf7f 100644 --- a/src/gallium/drivers/vc4/vc4_state.c +++ b/src/gallium/drivers/vc4/vc4_state.c @@ -260,12 +260,12 @@ vc4_create_depth_stencil_alpha_state(struct pipe_context *pctx, back_writemask_bits = tlb_stencil_setup_writemask(back->writemask); - so->stencil_uniforms[0] |= (1 << 30); + so->stencil_uniforms[0] |= (UINT32_C(1) << 30); so->stencil_uniforms[1] = tlb_stencil_setup_bits(back, back_writemask_bits); - so->stencil_uniforms[1] |= (2 << 30); + so->stencil_uniforms[1] |= (UINT32_C(2) << 30); } else { - so->stencil_uniforms[0] |= (3 << 30); + so->stencil_uniforms[0] |= (UINT32_C(3) << 30); } if (front_writemask_bits == 0xff || diff --git a/src/gallium/drivers/vc4/vc4_tiling_lt.c b/src/gallium/drivers/vc4/vc4_tiling_lt.c index 867bff15ae7..9dd029729cc 100644 --- a/src/gallium/drivers/vc4/vc4_tiling_lt.c +++ b/src/gallium/drivers/vc4/vc4_tiling_lt.c @@ -72,20 +72,20 @@ swizzle_lt_x(int x, int cpp) switch (cpp) { case 1: /* 8x8 inside of 4x4 */ - return ((x & 0x7) << (0 - 0) | - (x & ~0x7) << (6 - 3)); + return (((uint32_t)x & 0x7) << (0 - 0) | + ((uint32_t)x & ~0x7) << (6 - 3)); case 2: /* 8x4 inside of 4x4 */ - return ((x & 0x7) << (1 - 0) | - (x & ~0x7) << (6 - 3)); + return (((uint32_t)x & 0x7) << (1 - 0) | + ((uint32_t)x & ~0x7) << (6 - 3)); case 4: /* 4x4 inside of 4x4 */ - return ((x & 0x3) << (2 - 0) | - (x & ~0x3) << (6 - 2)); + return (((uint32_t)x & 0x3) << (2 - 0) | + ((uint32_t)x & ~0x3) << (6 - 2)); case 8: /* 2x4 inside of 4x4 */ - return ((x & 0x1) << (3 - 0) | - (x & ~0x1) << (6 - 1)); + return (((uint32_t)x & 0x1) << (3 - 0) | + ((uint32_t)x & ~0x1) << (6 - 1)); default: unreachable("bad cpp"); } diff --git a/src/gallium/drivers/vc4/vc4_uniforms.c b/src/gallium/drivers/vc4/vc4_uniforms.c index 045feb216ef..c22adcbdd25 100644 --- a/src/gallium/drivers/vc4/vc4_uniforms.c +++ b/src/gallium/drivers/vc4/vc4_uniforms.c @@ -316,7 +316,7 @@ vc4_write_uniforms(struct vc4_context *vc4, struct vc4_compiled_shader *shader, if (format_swiz[i] >= 4) continue; - color |= (vc4->blend_color.ub[format_swiz[i]] << + color |= ((uint32_t)vc4->blend_color.ub[format_swiz[i]] << (i * 8)); } cl_aligned_u32(&uniforms, color); @@ -324,7 +324,7 @@ vc4_write_uniforms(struct vc4_context *vc4, struct vc4_compiled_shader *shader, } case QUNIFORM_BLEND_CONST_COLOR_AAAA: { - uint8_t a = vc4->blend_color.ub[3]; + uint32_t a = vc4->blend_color.ub[3]; cl_aligned_u32(&uniforms, ((a) | (a << 8) | (a << 16) |