From aa64342661a7886fa939eb178665d46fb55f2969 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Apr 2021 12:04:31 -0700 Subject: [PATCH] iris: Silence warnings about implicit enum type conversions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/gallium/drivers/iris/iris_state.c: In function ‘iris_create_blend_state’: src/gallium/drivers/iris/iris_state.c:1284:41: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1284 | be.SourceBlendFactor = src_rgb; | ^ src/gallium/drivers/iris/iris_state.c:1285:41: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1285 | be.SourceAlphaBlendFactor = src_alpha; | ^ src/gallium/drivers/iris/iris_state.c:1286:41: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1286 | be.DestinationBlendFactor = dst_rgb; | ^ src/gallium/drivers/iris/iris_state.c:1287:41: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1287 | be.DestinationAlphaBlendFactor = dst_alpha; | ^ src/gallium/drivers/iris/iris_state.c:1308:28: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1308 | pb.SourceBlendFactor = | ^ src/gallium/drivers/iris/iris_state.c:1310:33: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1310 | pb.SourceAlphaBlendFactor = | ^ src/gallium/drivers/iris/iris_state.c:1312:33: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1312 | pb.DestinationBlendFactor = | ^ src/gallium/drivers/iris/iris_state.c:1314:38: warning: implicit conversion from ‘enum pipe_blendfactor’ to ‘enum GFX125_3D_Color_Buffer_Blend_Factor’ [-Wenum-conversion] 1314 | pb.DestinationAlphaBlendFactor = | ^ Reviewed-by: Emma Anholt Part-of: --- src/gallium/drivers/iris/iris_state.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 7ea661586e5..b3a6c19a070 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1281,10 +1281,12 @@ iris_create_blend_state(struct pipe_context *ctx, be.ColorBlendFunction = rt->rgb_func; be.AlphaBlendFunction = rt->alpha_func; - be.SourceBlendFactor = src_rgb; - be.SourceAlphaBlendFactor = src_alpha; - be.DestinationBlendFactor = dst_rgb; - be.DestinationAlphaBlendFactor = dst_alpha; + + /* The casts prevent warnings about implicit enum type conversions. */ + be.SourceBlendFactor = (int) src_rgb; + be.SourceAlphaBlendFactor = (int) src_alpha; + be.DestinationBlendFactor = (int) dst_rgb; + be.DestinationAlphaBlendFactor = (int) dst_alpha; be.WriteDisableRed = !(rt->colormask & PIPE_MASK_R); be.WriteDisableGreen = !(rt->colormask & PIPE_MASK_G); @@ -1305,14 +1307,15 @@ iris_create_blend_state(struct pipe_context *ctx, pb.AlphaToCoverageEnable = state->alpha_to_coverage; pb.IndependentAlphaBlendEnable = indep_alpha_blend; + /* The casts prevent warnings about implicit enum type conversions. */ pb.SourceBlendFactor = - fix_blendfactor(state->rt[0].rgb_src_factor, state->alpha_to_one); + (int) fix_blendfactor(state->rt[0].rgb_src_factor, state->alpha_to_one); pb.SourceAlphaBlendFactor = - fix_blendfactor(state->rt[0].alpha_src_factor, state->alpha_to_one); + (int) fix_blendfactor(state->rt[0].alpha_src_factor, state->alpha_to_one); pb.DestinationBlendFactor = - fix_blendfactor(state->rt[0].rgb_dst_factor, state->alpha_to_one); + (int) fix_blendfactor(state->rt[0].rgb_dst_factor, state->alpha_to_one); pb.DestinationAlphaBlendFactor = - fix_blendfactor(state->rt[0].alpha_dst_factor, state->alpha_to_one); + (int) fix_blendfactor(state->rt[0].alpha_dst_factor, state->alpha_to_one); } iris_pack_state(GENX(BLEND_STATE), cso->blend_state, bs) {