From: Mike Blumenkrantz Date: Mon, 23 Jan 2023 19:53:38 +0000 (-0500) Subject: zink: fix implicit feedback loop detection X-Git-Tag: upstream/23.3.3~14138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97740401dc66fb5907f591e0490513c83b5f531c;p=platform%2Fupstream%2Fmesa.git zink: fix implicit feedback loop detection the code here was all expecting the VkPipelineStageFlags bitfield expansions, but u_foreach_bit() gives the actual bit, so implicit feedback loops were never actually being detected instead, convert back to the bitfield at the top of the loop so the value works as expected Fixes: 9ba06579035 ("zink: make implicit feedback loop application stricter") Part-of: --- diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index a26eb98..29b3b13 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -288,10 +288,11 @@ add_implicit_color_feedback_loop(struct zink_context *ctx, struct zink_resource bool is_feedback = false; /* avoid false positives when a texture is bound but not used */ u_foreach_bit(vkstage, res->gfx_barrier) { - if (vkstage < VK_PIPELINE_STAGE_VERTEX_SHADER_BIT || vkstage > VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) + VkPipelineStageFlags vkstagebit = BITFIELD_BIT(vkstage); + if (vkstagebit < VK_PIPELINE_STAGE_VERTEX_SHADER_BIT || vkstagebit > VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) continue; /* in-range VkPipelineStageFlagBits can be converted to VkShaderStageFlags with a bitshift */ - gl_shader_stage stage = vk_to_mesa_shader_stage((VkShaderStageFlagBits)(vkstage >> 3)); + gl_shader_stage stage = vk_to_mesa_shader_stage((VkShaderStageFlagBits)(vkstagebit >> 3)); /* check shader texture usage against resource's sampler binds */ if ((ctx->gfx_stages[stage] && (res->sampler_binds[stage] & ctx->gfx_stages[stage]->nir->info.textures_used[0]))) is_feedback = true;