turnip: fixup consts
authorJonathan Marek <jonathan@marek.ca>
Mon, 7 Oct 2019 01:07:57 +0000 (21:07 -0400)
committerJonathan Marek <jonathan@marek.ca>
Tue, 15 Oct 2019 11:56:20 +0000 (07:56 -0400)
Fix some mistakes in previous series.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_pipeline.c

index e1b4589451bdccf38230153dcd68f377f0724992..d701ae5fba7ee0506f5884a53d5753e9307547ec 100644 (file)
@@ -2209,16 +2209,13 @@ tu6_emit_user_consts(struct tu_cs *cs, const struct tu_pipeline *pipeline,
          debug_assert((size % 16) == 0);
          debug_assert((offset % 16) == 0);
 
-         uint64_t addr = (uint64_t) ptr[1] << 32 | ptr[0];
-         addr += state->range[i].offset;
-
          tu_cs_emit_pkt7(cs, tu6_stage2opcode(type), 3);
          tu_cs_emit(cs, CP_LOAD_STATE6_0_DST_OFF(state->range[i].offset / 16) |
                CP_LOAD_STATE6_0_STATE_TYPE(ST6_CONSTANTS) |
                CP_LOAD_STATE6_0_STATE_SRC(SS6_INDIRECT) |
                CP_LOAD_STATE6_0_STATE_BLOCK(tu6_stage2shadersb(type)) |
                CP_LOAD_STATE6_0_NUM_UNIT(size / 16));
-         tu_cs_emit_qw(cs, addr);
+         tu_cs_emit_qw(cs, ((uint64_t) ptr[1] << 32 | ptr[0]) + offset);
       }
    }
 }
index 54239280daa4f4df18820ff8b6ea20c5d825b17b..667c106b6ac786cf045a0f35fd356c44cb7033e4 100644 (file)
@@ -904,6 +904,10 @@ static void
 tu6_emit_immediates(struct tu_cs *cs, const struct ir3_shader_variant *v,
                     uint32_t opcode, enum a6xx_state_block block)
 {
+   /* dummy variant */
+   if (!v->shader)
+      return;
+
    const struct ir3_const_state *const_state = &v->shader->const_state;
    uint32_t base = const_state->offsets.immediate;
    int size = const_state->immediates_count;
@@ -920,7 +924,7 @@ tu6_emit_immediates(struct tu_cs *cs, const struct ir3_shader_variant *v,
    tu_cs_emit(cs, CP_LOAD_STATE6_0_DST_OFF(base) |
                   CP_LOAD_STATE6_0_STATE_TYPE(ST6_CONSTANTS) |
                   CP_LOAD_STATE6_0_STATE_SRC(SS6_DIRECT) |
-                  CP_LOAD_STATE6_0_STATE_BLOCK(SB6_FS_SHADER) |
+                  CP_LOAD_STATE6_0_STATE_BLOCK(block) |
                   CP_LOAD_STATE6_0_NUM_UNIT(size));
    tu_cs_emit(cs, CP_LOAD_STATE6_1_EXT_SRC_ADDR(0));
    tu_cs_emit(cs, CP_LOAD_STATE6_2_EXT_SRC_ADDR_HI(0));