mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
radeonsi: resolve a tricky C++ failure with goto jumping over initializations
C++ doesn't allow jumping over variable initializations, so we have to use a macro. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7807>
This commit is contained in:
parent
fe839baf6a
commit
639b1366d0
1 changed files with 18 additions and 9 deletions
|
|
@ -1882,6 +1882,11 @@ static ALWAYS_INLINE bool pd_msg(const char *s)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DRAW_CLEANUP do { \
|
||||||
|
if (index_size && indexbuf != info->index.resource) \
|
||||||
|
pipe_resource_reference(&indexbuf, NULL); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
static void si_draw_vbo(struct pipe_context *ctx,
|
static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
const struct pipe_draw_info *info,
|
const struct pipe_draw_info *info,
|
||||||
const struct pipe_draw_indirect_info *indirect,
|
const struct pipe_draw_indirect_info *indirect,
|
||||||
|
|
@ -2159,9 +2164,11 @@ static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
break;
|
break;
|
||||||
case SI_PRIM_DISCARD_DRAW_SPLIT:
|
case SI_PRIM_DISCARD_DRAW_SPLIT:
|
||||||
sctx->compute_num_verts_rejected -= total_direct_count;
|
sctx->compute_num_verts_rejected -= total_direct_count;
|
||||||
goto return_cleanup;
|
FALLTHROUGH;
|
||||||
case SI_PRIM_DISCARD_MULTI_DRAW_SPLIT:
|
case SI_PRIM_DISCARD_MULTI_DRAW_SPLIT:
|
||||||
goto return_cleanup;
|
/* The multi draw was split into multiple ones and executed. Return. */
|
||||||
|
DRAW_CLEANUP;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2234,8 +2241,10 @@ static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(sctx->do_update_shaders)) {
|
if (unlikely(sctx->do_update_shaders)) {
|
||||||
if (unlikely(!si_update_shaders(sctx)))
|
if (unlikely(!si_update_shaders(sctx))) {
|
||||||
goto return_cleanup;
|
DRAW_CLEANUP;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Insert a VGT_FLUSH when enabling fast launch changes to prevent hangs.
|
/* Insert a VGT_FLUSH when enabling fast launch changes to prevent hangs.
|
||||||
* See issues #2418, #2426, #2434
|
* See issues #2418, #2426, #2434
|
||||||
|
|
@ -2282,8 +2291,10 @@ static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
if (unlikely(!si_upload_graphics_shader_descriptors(sctx) ||
|
if (unlikely(!si_upload_graphics_shader_descriptors(sctx) ||
|
||||||
(sctx->vertex_buffers_dirty &&
|
(sctx->vertex_buffers_dirty &&
|
||||||
sctx->num_vertex_elements &&
|
sctx->num_vertex_elements &&
|
||||||
!si_upload_vertex_buffer_descriptors(sctx))))
|
!si_upload_vertex_buffer_descriptors(sctx)))) {
|
||||||
goto return_cleanup;
|
DRAW_CLEANUP;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Vega10/Raven scissor bug workaround. When any context register is
|
/* Vega10/Raven scissor bug workaround. When any context register is
|
||||||
* written (i.e. the GPU rolls the context), PA_SC_VPORT_SCISSOR
|
* written (i.e. the GPU rolls the context), PA_SC_VPORT_SCISSOR
|
||||||
|
|
@ -2399,9 +2410,7 @@ static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
sctx->num_spill_draw_calls++;
|
sctx->num_spill_draw_calls++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_cleanup:
|
DRAW_CLEANUP;
|
||||||
if (index_size && indexbuf != info->index.resource)
|
|
||||||
pipe_resource_reference(&indexbuf, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_draw_rectangle(struct blitter_context *blitter, void *vertex_elements_cso,
|
static void si_draw_rectangle(struct blitter_context *blitter, void *vertex_elements_cso,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue