From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeonsi/si_cp_dma.c     | 3 +++
 src/gallium/drivers/radeonsi/si_hw_context.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c 
b/src/gallium/drivers/radeonsi/si_cp_dma.c
index 91a6aff..1aa1ef2 100644
--- a/src/gallium/drivers/radeonsi/si_cp_dma.c
+++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
@@ -443,20 +443,23 @@ static void cik_prefetch_shader_async(struct si_context 
*sctx,
                                      struct si_pm4_state *state)
 {
        struct pipe_resource *bo = &state->bo[0]->b.b;
        assert(state->nbo == 1);
 
        cik_prefetch_TC_L2_async(sctx, bo, 0, bo->width0);
 }
 
 static void cik_prefetch_VBO_descriptors(struct si_context *sctx)
 {
+       if (!sctx->vertex_elements)
+               return;
+
        cik_prefetch_TC_L2_async(sctx, &sctx->vertex_buffers.buffer->b.b,
                                 sctx->vertex_buffers.buffer_offset,
                                 sctx->vertex_elements->desc_list_byte_size);
 }
 
 void cik_emit_prefetch_L2(struct si_context *sctx)
 {
        /* Prefetch shaders and VBO descriptors to TC L2. */
        if (sctx->b.chip_class >= GFX9) {
                /* Choose the right spot for the VBO prefetch. */
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 46e6073..d9170c3 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -221,21 +221,21 @@ void si_begin_new_cs(struct si_context *ctx)
        if (ctx->queued.named.hs)
                ctx->prefetch_L2_mask |= SI_PREFETCH_HS;
        if (ctx->queued.named.es)
                ctx->prefetch_L2_mask |= SI_PREFETCH_ES;
        if (ctx->queued.named.gs)
                ctx->prefetch_L2_mask |= SI_PREFETCH_GS;
        if (ctx->queued.named.vs)
                ctx->prefetch_L2_mask |= SI_PREFETCH_VS;
        if (ctx->queued.named.ps)
                ctx->prefetch_L2_mask |= SI_PREFETCH_PS;
-       if (ctx->vertex_buffers.buffer)
+       if (ctx->vertex_buffers.buffer && ctx->vertex_elements)
                ctx->prefetch_L2_mask |= SI_PREFETCH_VBO_DESCRIPTORS;
 
        /* CLEAR_STATE disables all colorbuffers, so only enable bound ones. */
        bool has_clear_state = ctx->screen->has_clear_state;
        if (has_clear_state) {
                ctx->framebuffer.dirty_cbufs =
                         u_bit_consecutive(0, ctx->framebuffer.state.nr_cbufs);
                /* CLEAR_STATE disables the zbuffer, so only enable it if it's 
bound. */
                ctx->framebuffer.dirty_zsbuf = ctx->framebuffer.state.zsbuf != 
NULL;
        } else {
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to