const char *xml_path,
struct gen_batch_decode_bo (*get_bo)(void *,
uint64_t),
+ unsigned (*get_state_size)(void *, uint32_t),
void *user_data)
{
memset(ctx, 0, sizeof(*ctx));
ctx->get_bo = get_bo;
+ ctx->get_state_size = get_state_size;
ctx->user_data = user_data;
ctx->fp = fp;
ctx->flags = flags;
return bo;
}
+static int
+update_count(struct gen_batch_decode_ctx *ctx,
+ uint32_t offset_from_dsba,
+ unsigned element_dwords,
+ unsigned guess)
+{
+ unsigned size = 0;
+
+ if (ctx->get_state_size)
+ size = ctx->get_state_size(ctx->user_data, offset_from_dsba);
+
+ if (size > 0)
+ return size / (sizeof(uint32_t) * element_dwords);
+
+ /* In the absence of any information, just guess arbitrarily. */
+ return guess;
+}
+
static void
ctx_disassemble_program(struct gen_batch_decode_ctx *ctx,
uint32_t ksp, const char *type)
return;
}
- /* If we don't know the actual count, guess. */
if (count < 0)
- count = 8;
+ count = update_count(ctx, offset, 1, 8);
if (ctx->surface_base.map == NULL) {
fprintf(ctx->fp, " binding table unavailable\n");
{
struct gen_group *strct = gen_spec_find_struct(ctx->spec, "SAMPLER_STATE");
- /* If we don't know the actual count, guess. */
if (count < 0)
- count = 4;
+ count = update_count(ctx, offset, strct->dw_length, 4);
if (ctx->dynamic_base.map == NULL) {
fprintf(ctx->fp, " samplers unavailable\n");
struct gen_batch_decode_ctx {
struct gen_batch_decode_bo (*get_bo)(void *user_data,
uint64_t base_address);
+ unsigned (*get_state_size)(void *user_data,
+ uint32_t offset_from_dynamic_state_base_addr);
void *user_data;
FILE *fp;
const char *xml_path,
struct gen_batch_decode_bo (*get_bo)(void *,
uint64_t),
+
+ unsigned (*get_state_size)(void *, uint32_t),
void *user_data);
void gen_batch_decode_ctx_finish(struct gen_batch_decode_ctx *ctx);
batch_flags |= GEN_BATCH_DECODE_FLOATS;
gen_batch_decode_ctx_init(&batch_ctx, &devinfo, outfile, batch_flags,
- xml_path, get_gen_batch_bo, NULL);
+ xml_path, get_gen_batch_bo, NULL, NULL);
char *color = GREEN_HEADER, *reset_color = NORMAL;
if (option_color == COLOR_NEVER)
struct gen_batch_decode_ctx batch_ctx;
gen_batch_decode_ctx_init(&batch_ctx, &devinfo, stdout, batch_flags,
- xml_path, get_gen_batch_bo, NULL);
+ xml_path, get_gen_batch_bo, NULL, NULL);
for (int s = 0; s < sect_num; s++) {