radeonsi: fix si_check_render_feedback

si_check_render_feedback only relied on si_images::enabled_mask and
si_samplers::enabled_mask to determine if a texture was being used
both as input and output.

Given that some samplers/images can be considered active (so accounted
for by enabled_mask) but not used by the current shader this could
lead to false-positive.

This commit fixes this by and-ing the above mask with the information
from shader_info for each active shader.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4227
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8869>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2021-02-09 21:50:07 +01:00
committed by Marge Bot
parent bddc0e023c
commit a67d3e7c9e
2 changed files with 17 additions and 9 deletions

View File

@@ -225,7 +225,7 @@ traces:
- path: supertuxkart/supertuxkart-antediluvian-abyss.rdc
expectations:
- device: gl-radeonsi-stoney
checksum: 499e93c37e33cc6430c7a9f94266f2f7
checksum: f1774fc459aa0734838888dd44db052e
- path: supertuxkart/supertuxkart-menu.rdc
expectations:
- device: gl-radeonsi-stoney
@@ -233,4 +233,4 @@ traces:
- path: supertuxkart/supertuxkart-ravenbridge-mansion.rdc
expectations:
- device: gl-radeonsi-stoney
checksum: 38a9f26c60a0bc4245b97d32da84ef75
checksum: 66b6dee290642bd25dfd817d190f6906

View File

@@ -593,9 +593,10 @@ static void si_check_render_feedback_texture(struct si_context *sctx, struct si_
si_texture_disable_dcc(sctx, tex);
}
static void si_check_render_feedback_textures(struct si_context *sctx, struct si_samplers *textures)
static void si_check_render_feedback_textures(struct si_context *sctx, struct si_samplers *textures,
uint32_t in_use_mask)
{
uint32_t mask = textures->enabled_mask;
uint32_t mask = textures->enabled_mask & in_use_mask;
while (mask) {
const struct pipe_sampler_view *view;
@@ -614,9 +615,10 @@ static void si_check_render_feedback_textures(struct si_context *sctx, struct si
}
}
static void si_check_render_feedback_images(struct si_context *sctx, struct si_images *images)
static void si_check_render_feedback_images(struct si_context *sctx, struct si_images *images,
uint32_t in_use_mask)
{
uint32_t mask = images->enabled_mask;
uint32_t mask = images->enabled_mask & in_use_mask;
while (mask) {
const struct pipe_image_view *view;
@@ -680,9 +682,15 @@ static void si_check_render_feedback(struct si_context *sctx)
if (!si_get_total_colormask(sctx))
return;
for (int i = 0; i < SI_NUM_SHADERS; ++i) {
si_check_render_feedback_images(sctx, &sctx->images[i]);
si_check_render_feedback_textures(sctx, &sctx->samplers[i]);
for (int i = 0; i < SI_NUM_GRAPHICS_SHADERS; ++i) {
if (!sctx->shaders[i].cso)
continue;
struct si_shader_info *info = &sctx->shaders[i].cso->info;
si_check_render_feedback_images(sctx, &sctx->images[i],
u_bit_consecutive(0, info->base.num_images));
si_check_render_feedback_textures(sctx, &sctx->samplers[i],
info->base.textures_used);
}
si_check_render_feedback_resident_images(sctx);