summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-28 13:59:18 +0800
committerChia-I Wu <[email protected]>2013-06-28 15:01:00 +0800
commit2c9b6a2164281f29217e75c3ab3a018dcd22ae11 (patch)
tree763913c39c50d6aec6835ec0688e6f81b988a61e /src/gallium
parent7ea3ed81c80ec5941beacace4c6869c870b55478 (diff)
ilo: remove ilo_cbuf_state::count
We can derive it from enabled_mask.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c24
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c2
-rw-r--r--src/gallium/drivers/ilo/ilo_gpe.h1
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c2
4 files changed, 12 insertions, 17 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
index 7afe6af3b3b..cd67f85e689 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
@@ -1003,10 +1003,9 @@ gen6_pipeline_state_surfaces_const(struct ilo_3d_pipeline *p,
int shader_type,
struct gen6_pipeline_session *session)
{
- const struct ilo_cbuf_cso *buffers = ilo->cbuf[shader_type].cso;
- const int num_buffers = ilo->cbuf[shader_type].count;
+ const struct ilo_cbuf_state *cbuf = &ilo->cbuf[shader_type];
uint32_t *surface_state;
- int offset, i;
+ int offset, count, i;
bool skip = false;
/* SURFACE_STATEs for constant buffers */
@@ -1041,22 +1040,21 @@ gen6_pipeline_state_surfaces_const(struct ilo_3d_pipeline *p,
if (skip)
return;
- for (i = 0; i < num_buffers; i++) {
- if (buffers[i].resource) {
- const struct ilo_view_surface *surf = &buffers[i].surface;
-
- surface_state[i] =
- p->gen6_SURFACE_STATE(p->dev, surf, false, p->cp);
+ count = util_last_bit(cbuf->enabled_mask);
+ for (i = 0; i < count; i++) {
+ if (cbuf->cso[i].resource) {
+ surface_state[i] = p->gen6_SURFACE_STATE(p->dev,
+ &cbuf->cso[i].surface, false, p->cp);
}
else {
surface_state[i] = 0;
}
}
- memset(&surface_state[i], 0, (ILO_MAX_CONST_BUFFERS - i) * 4);
+ memset(&surface_state[count], 0, (ILO_MAX_CONST_BUFFERS - count) * 4);
- if (i && session->num_surfaces[shader_type] < offset + i)
- session->num_surfaces[shader_type] = offset + i;
+ if (count && session->num_surfaces[shader_type] < offset + count)
+ session->num_surfaces[shader_type] = offset + count;
}
static void
@@ -1542,7 +1540,7 @@ gen6_pipeline_estimate_states(const struct ilo_3d_pipeline *p,
for (shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
count += ilo->view[shader_type].count;
- count += ilo->cbuf[shader_type].count;
+ count += util_bitcount(ilo->cbuf[shader_type].enabled_mask);
}
if (count) {
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
index 19c101c38c6..fc16f80a54a 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
@@ -712,7 +712,7 @@ gen7_pipeline_estimate_states(const struct ilo_3d_pipeline *p,
count = ilo->fb.state.nr_cbufs;
for (shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
count += ilo->view[shader_type].count;
- count += ilo->cbuf[shader_type].count;
+ count += util_bitcount(ilo->cbuf[shader_type].enabled_mask);
}
if (count) {
diff --git a/src/gallium/drivers/ilo/ilo_gpe.h b/src/gallium/drivers/ilo/ilo_gpe.h
index 1f5f47cacaa..67674768e35 100644
--- a/src/gallium/drivers/ilo/ilo_gpe.h
+++ b/src/gallium/drivers/ilo/ilo_gpe.h
@@ -222,7 +222,6 @@ struct ilo_cbuf_cso {
struct ilo_cbuf_state {
struct ilo_cbuf_cso cso[ILO_MAX_CONST_BUFFERS];
uint32_t enabled_mask;
- unsigned count;
};
struct ilo_resource_state {
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 87b4e2992a4..c6790045c36 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -122,8 +122,6 @@ finalize_constant_buffers(struct ilo_context *ilo)
cbuf->user_buffer_size = 0;
}
}
-
- ilo->cbuf[sh].count = util_last_bit(ilo->cbuf[sh].enabled_mask);
}
}