st/mesa: add ST_DEBUG=xfb printing xfb info

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32175>
This commit is contained in:
Marek Olšák
2024-11-13 16:24:44 -05:00
committed by Marge Bot
parent 89dad5618d
commit 3179c65a5a
3 changed files with 38 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ static const struct debug_named_value st_debug_flags[] = {
{ "wf", DEBUG_WIREFRAME, NULL },
{ "gremedy", DEBUG_GREMEDY, "Enable GREMEDY debug extensions" },
{ "noreadpixcache", DEBUG_NOREADPIXCACHE, NULL },
{ "xfb", DEBUG_PRINT_XFB, NULL },
DEBUG_NAMED_VALUE_END
};

View File

@@ -41,6 +41,7 @@ struct st_context;
#define DEBUG_WIREFRAME BITFIELD_BIT(4)
#define DEBUG_GREMEDY BITFIELD_BIT(5)
#define DEBUG_NOREADPIXCACHE BITFIELD_BIT(6)
#define DEBUG_PRINT_XFB BITFIELD_BIT(7)
extern int ST_DEBUG;

View File

@@ -36,6 +36,7 @@
#include "main/hash.h"
#include "main/mtypes.h"
#include "nir/nir_xfb_info.h"
#include "nir/pipe_nir.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
@@ -52,6 +53,7 @@
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "util/u_dump.h"
#include "util/u_memory.h"
#include "st_debug.h"
@@ -515,6 +517,40 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state)
nir_print_shader(nir, stderr);
}
if (ST_DEBUG & DEBUG_PRINT_XFB) {
if (nir->info.io_lowered) {
if (nir->xfb_info && nir->xfb_info->output_count) {
fprintf(stderr, "XFB info before handing off to driver:\n");
fprintf(stderr, "stride = {%u, %u, %u, %u}\n",
nir->info.xfb_stride[0], nir->info.xfb_stride[1],
nir->info.xfb_stride[2], nir->info.xfb_stride[3]);
nir_print_xfb_info(nir->xfb_info, stderr);
}
} else {
struct pipe_stream_output_info *so = &state->stream_output;
if (so->num_outputs) {
fprintf(stderr, "XFB info before handing off to driver:\n");
fprintf(stderr, "stride = {%u, %u, %u, %u}\n",
so->stride[0], so->stride[1], so->stride[2],
so->stride[3]);
for (unsigned i = 0; i < so->num_outputs; i++) {
fprintf(stderr, "output%u: buffer=%u offset=%u, location=%u, "
"component_offset=%u, component_mask=0x%x, "
"stream=%u\n",
i, so->output[i].output_buffer,
so->output[i].dst_offset * 4,
so->output[i].register_index,
so->output[i].start_component,
BITFIELD_RANGE(so->output[i].start_component,
so->output[i].num_components),
so->output[i].stream);
}
}
}
}
void *shader;
switch (stage) {
case MESA_SHADER_VERTEX: