summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_state_draw.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-08-02 11:51:21 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-08-03 17:46:46 +0200
commitc15a9dec298940c918403353c6830f4f71115592 (patch)
tree07a3698288fe4c8b7db203f4e8d8d0728a4958dc /src/gallium/drivers/radeonsi/si_state_draw.c
parentc2a0e991694f1fa84f24aacd2c2d47eecbd4da0f (diff)
downloadexternal_mesa3d-c15a9dec298940c918403353c6830f4f71115592.zip
external_mesa3d-c15a9dec298940c918403353c6830f4f71115592.tar.gz
external_mesa3d-c15a9dec298940c918403353c6830f4f71115592.tar.bz2
radeonsi: skip unnecessary si_update_shaders calls
Small decrease in draw call overhead. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_draw.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 24fa682..30b644e 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -867,7 +867,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
struct si_context *sctx = (struct si_context *)ctx;
struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
struct pipe_index_buffer ib = {};
- unsigned mask, dirty_fb_counter, dirty_tex_counter;
+ unsigned mask, dirty_fb_counter, dirty_tex_counter, rast_prim;
if (!info->count && !info->indirect &&
(info->indexed || !info->count_from_stream_output))
@@ -911,15 +911,21 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
* draw_vbo recursively, and before si_update_shaders, which uses
* current_rast_prim for this draw_vbo call. */
if (sctx->gs_shader.cso)
- sctx->current_rast_prim = sctx->gs_shader.cso->gs_output_prim;
+ rast_prim = sctx->gs_shader.cso->gs_output_prim;
else if (sctx->tes_shader.cso)
- sctx->current_rast_prim =
- sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
+ rast_prim = sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
else
- sctx->current_rast_prim = info->mode;
+ rast_prim = info->mode;
- if (!si_update_shaders(sctx) ||
- !si_upload_graphics_shader_descriptors(sctx))
+ if (rast_prim != sctx->current_rast_prim) {
+ sctx->current_rast_prim = rast_prim;
+ sctx->do_update_shaders = true;
+ }
+
+ if (sctx->do_update_shaders && !si_update_shaders(sctx))
+ return;
+
+ if (!si_upload_graphics_shader_descriptors(sctx))
return;
if (info->indexed) {