aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-10-30 15:45:05 +0800
committerChia-I Wu <[email protected]>2014-11-06 10:43:31 +0800
commit207eccc5bf43a8b63b68e29c9d5e02744d115f56 (patch)
tree72f63f7617a71c472b9c680bcc77ba42f609ea25 /src
parent9feb637cd0ea77f1ef232153daf9d9fd30bccd3d (diff)
ilo: add ilo_finalize_compute_states()
It updates the handles of the global bindings. Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c34
-rw-r--r--src/gallium/drivers/ilo/ilo_state.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 217d22c614b..c68062adb03 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -262,6 +262,40 @@ ilo_finalize_3d_states(struct ilo_context *ilo,
u_upload_unmap(ilo->uploader);
}
+static void
+finalize_global_binding(struct ilo_state_vector *vec)
+{
+ struct ilo_shader_state *cs = vec->cs;
+ int base, count, shift;
+ int i;
+
+ count = ilo_shader_get_kernel_param(cs,
+ ILO_KERNEL_CS_SURFACE_GLOBAL_COUNT);
+ if (!count)
+ return;
+
+ base = ilo_shader_get_kernel_param(cs, ILO_KERNEL_CS_SURFACE_GLOBAL_BASE);
+ shift = 32 - util_last_bit(base + count - 1);
+
+ if (count > vec->global_binding.count)
+ count = vec->global_binding.count;
+
+ for (i = 0; i < count; i++) {
+ struct ilo_global_binding_cso *cso =
+ util_dynarray_element(&vec->global_binding.bindings,
+ struct ilo_global_binding_cso, i);
+ const uint32_t offset = *cso->handle & ((1 << shift) - 1);
+
+ *cso->handle = ((base + i) << shift) | offset;
+ }
+}
+
+void
+ilo_finalize_compute_states(struct ilo_context *ilo)
+{
+ finalize_global_binding(&ilo->state_vector);
+}
+
static void *
ilo_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *state)
diff --git a/src/gallium/drivers/ilo/ilo_state.h b/src/gallium/drivers/ilo/ilo_state.h
index 7343b20e357..6f544e1f788 100644
--- a/src/gallium/drivers/ilo/ilo_state.h
+++ b/src/gallium/drivers/ilo/ilo_state.h
@@ -428,6 +428,9 @@ ilo_finalize_3d_states(struct ilo_context *ilo,
const struct pipe_draw_info *draw);
void
+ilo_finalize_compute_states(struct ilo_context *ilo);
+
+void
ilo_state_vector_init(const struct ilo_dev_info *dev,
struct ilo_state_vector *vec);