OSDN Git Service

intel/batch_decoder: Print blend states properly
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 24 Aug 2018 21:05:08 +0000 (16:05 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 25 Aug 2018 12:50:45 +0000 (07:50 -0500)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/common/gen_batch_decoder.c

index a57bd93..6884a99 100644 (file)
@@ -641,7 +641,6 @@ decode_dynamic_state_pointers(struct gen_batch_decode_ctx *ctx,
                               int count)
 {
    struct gen_group *inst = gen_spec_find_instruction(ctx->spec, p);
-   struct gen_group *state = gen_spec_find_struct(ctx->spec, struct_type);
 
    uint32_t state_offset = 0;
 
@@ -663,6 +662,22 @@ decode_dynamic_state_pointers(struct gen_batch_decode_ctx *ctx,
       return;
    }
 
+   struct gen_group *state = gen_spec_find_struct(ctx->spec, struct_type);
+   if (strcmp(struct_type, "BLEND_STATE") == 0) {
+      /* Blend states are different from the others because they have a header
+       * struct called BLEND_STATE which is followed by a variable number of
+       * BLEND_STATE_ENTRY structs.
+       */
+      fprintf(ctx->fp, "%s\n", struct_type);
+      ctx_print_group(ctx, state, state_addr, state_map);
+
+      state_addr += state->dw_length * 4;
+      state_map += state->dw_length * 4;
+
+      struct_type = "BLEND_STATE_ENTRY";
+      state = gen_spec_find_struct(ctx->spec, struct_type);
+   }
+
    for (int i = 0; i < count; i++) {
       fprintf(ctx->fp, "%s %d\n", struct_type, i);
       ctx_print_group(ctx, state, state_addr, state_map);