virgl: Fix ubsan warnings:

virgl_screen.c:313:55: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
virgl_screen.c:682:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
virgl_encode.c:481:7: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18231>
This commit is contained in:
Gert Wollny 2022-08-24 15:23:12 +02:00 committed by Marge Bot
parent 086ba33218
commit be012932d0
3 changed files with 3 additions and 3 deletions

View file

@ -679,7 +679,7 @@ virgl_format_check_bitmask(enum pipe_format format,
enum virgl_formats vformat = pipe_to_virgl_format(format);
int big = vformat / 32;
int small = vformat % 32;
if ((bitmask[big] & (1 << small)))
if ((bitmask[big] & (1u << small)))
return true;
/* On GLES hosts we don't advertise BGRx_SRGB, but we may be able

View file

@ -434,7 +434,7 @@ enum virgl_formats {
#define VIRGL_CAP_APP_TWEAK_SUPPORT (1 << 28)
#define VIRGL_CAP_BGRA_SRGB_IS_EMULATED (1 << 29)
#define VIRGL_CAP_CLEAR_TEXTURE (1 << 30)
#define VIRGL_CAP_ARB_BUFFER_STORAGE (1 << 31)
#define VIRGL_CAP_ARB_BUFFER_STORAGE (1u << 31)
/* These are used by the capability_bits_v2 field in virgl_caps_v2. */
#define VIRGL_CAP_V2_BLEND_EQUATION (1 << 0)

View file

@ -238,7 +238,7 @@ enum virgl_shader_stage {
#define VIRGL_OBJ_RS_S0_LINE_LAST_PIXEL(x) (((x) & 0x1) << 28)
#define VIRGL_OBJ_RS_S0_HALF_PIXEL_CENTER(x) (((x) & 0x1) << 29)
#define VIRGL_OBJ_RS_S0_BOTTOM_EDGE_RULE(x) (((x) & 0x1) << 30)
#define VIRGL_OBJ_RS_S0_FORCE_PERSAMPLE_INTERP(x) (((x) & 0x1) << 31)
#define VIRGL_OBJ_RS_S0_FORCE_PERSAMPLE_INTERP(x) (((x) & 0x1u) << 31)
#define VIRGL_OBJ_RS_POINT_SIZE 3
#define VIRGL_OBJ_RS_SPRITE_COORD_ENABLE 4