From 0f8a86682f311615e5a74ddd7d480fa0c7ac6f7d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 13 Aug 2013 16:11:27 +0800 Subject: [PATCH] ilo: no binding table change when constants are pushed When constants can be pushed, and nothing else requires new SURFACE_STATEs, there is no need to emit BINDING_TABLE_STATE. --- .../drivers/ilo/ilo_3d_pipeline_gen6.c | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c index dca49311ab3..245efa20c43 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c @@ -1005,40 +1005,34 @@ gen6_pipeline_state_surfaces_const(struct ilo_3d_pipeline *p, { const struct ilo_cbuf_state *cbuf = &ilo->cbuf[shader_type]; uint32_t *surface_state; + bool *binding_table_changed; int offset, count, i; - bool skip = false; + + if (!DIRTY(CBUF)) + return; /* SURFACE_STATEs for constant buffers */ switch (shader_type) { case PIPE_SHADER_VERTEX: - if (DIRTY(CBUF)) { - offset = ILO_VS_CONST_SURFACE(0); - surface_state = &p->state.vs.SURFACE_STATE[offset]; - - session->binding_table_vs_changed = true; - } - else { - skip = true; - } + offset = ILO_VS_CONST_SURFACE(0); + surface_state = &p->state.vs.SURFACE_STATE[offset]; + binding_table_changed = &session->binding_table_vs_changed; break; case PIPE_SHADER_FRAGMENT: - if (DIRTY(CBUF)) { - offset = ILO_WM_CONST_SURFACE(0); - surface_state = &p->state.wm.SURFACE_STATE[offset]; - - session->binding_table_fs_changed = true; - } - else { - skip = true; - } + offset = ILO_WM_CONST_SURFACE(0); + surface_state = &p->state.wm.SURFACE_STATE[offset]; + binding_table_changed = &session->binding_table_fs_changed; break; default: - skip = true; + return; break; } - if (skip) + /* constants are pushed via PCB */ + if (cbuf->enabled_mask == 0x1 && !cbuf->cso[0].resource) { + memset(surface_state, 0, ILO_MAX_CONST_BUFFERS * 4); return; + } count = util_last_bit(cbuf->enabled_mask); for (i = 0; i < count; i++) { @@ -1055,6 +1049,8 @@ gen6_pipeline_state_surfaces_const(struct ilo_3d_pipeline *p, if (count && session->num_surfaces[shader_type] < offset + count) session->num_surfaces[shader_type] = offset + count; + + *binding_table_changed = true; } static void -- 2.30.2