panvk: cast negative value to unint8_t

The index is a uint8_t but can be assigned a negative 1
value in panvk_pipeline_builder_parse_color_blend()
The comparison to ~0 thus makes sense but clang will complain:

"result of comparison of constant -1 with expression of type
'const uint8_t' (aka 'const unsigned char') is always true
[-Wtautological-constant-out-of-range-compare]"

Fix this by casting to a uint8_t before comparison.

Fixes a warning with clang

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14289>
This commit is contained in:
Thomas H.P. Andersen
2021-12-23 16:15:00 +01:00
parent cea1df7d34
commit 08f7d37fb9

View File

@@ -468,7 +468,7 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
void *bd = rsd.cpu + pan_size(RENDERER_STATE);
for (unsigned i = 0; i < pipeline->blend.state.rt_count; i++) {
if (pipeline->blend.constant[i].index != ~0) {
if (pipeline->blend.constant[i].index != (uint8_t)~0) {
struct mali_blend_packed bd_dyn;
struct mali_blend_packed *bd_templ =
(struct mali_blend_packed *)&pipeline->blend.bd_template[i];