From: Nicolai Hähnle <[email protected]>

This allows a meaningful dump with info == NULL (for compute shaders).
---
 src/gallium/drivers/radeonsi/si_debug.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 6e310bb..d39b303 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -457,35 +457,41 @@ static void si_dump_descriptors(struct si_context *sctx,
                &sctx->descriptors[SI_DESCS_FIRST_SHADER +
                                   processor * SI_NUM_SHADER_DESCS];
        static const char *shader_name[] = {"VS", "PS", "GS", "TCS", "TES", 
"CS"};
 
        static const char *elem_name[] = {
                " - Constant buffer",
                " - Shader buffer",
                " - Sampler",
                " - Image",
        };
-       unsigned num_elements[] = {
-               util_last_bit(info->const_buffers_declared),
-               util_last_bit(info->shader_buffers_declared),
-               util_last_bit(info->samplers_declared),
-               util_last_bit(info->images_declared),
+       unsigned enabled_slots[] = {
+               sctx->const_buffers[processor].enabled_mask,
+               sctx->shader_buffers[processor].enabled_mask,
+               sctx->samplers[processor].views.enabled_mask,
+               sctx->images[processor].enabled_mask,
+       };
+       unsigned required_slots[] = {
+               info ? info->const_buffers_declared : 0,
+               info ? info->shader_buffers_declared : 0,
+               info ? info->samplers_declared : 0,
+               info ? info->images_declared : 0,
        };
 
        if (processor == PIPE_SHADER_VERTEX) {
                si_dump_descriptor_list(&sctx->vertex_buffers, 
shader_name[processor],
                                        " - Vertex buffer", info->num_inputs, 
f);
        }
 
        for (unsigned i = 0; i < SI_NUM_SHADER_DESCS; ++i, ++descs)
                si_dump_descriptor_list(descs, shader_name[processor], 
elem_name[i],
-                                       num_elements[i], f);
+                                       util_last_bit(enabled_slots[i] | 
required_slots[i]), f);
 }
 
 static void si_dump_gfx_descriptors(struct si_context *sctx,
                                    const struct si_shader_ctx_state *state,
                                    FILE *f)
 {
        if (!state->cso || !state->current)
                return;
 
        si_dump_descriptors(sctx, state->cso->type, &state->cso->info, f);
-- 
2.9.3

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to