From bf795b024495831858082cd7bc714fe02b989068 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 24 Jul 2018 16:03:32 -0700 Subject: [PATCH] iris: emit binding table for atomic counters and SSBOs --- src/gallium/drivers/iris/iris_state.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index a721c7ffa8e..d75babee0d4 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2617,6 +2617,21 @@ use_null_surface(struct iris_batch *batch, struct iris_context *ice) return ice->state.unbound_tex.offset; } +static uint32_t +use_ssbo(struct iris_batch *batch, struct iris_context *ice, + struct iris_shader_state *shs, int i) +{ + if (!shs->ssbo[i]) + return use_null_surface(batch, ice); + + struct iris_state_ref *surf_state = &shs->ssbo_surface_state[i]; + + iris_use_pinned_bo(batch, iris_resource_bo(shs->ssbo[i]), true); + iris_use_pinned_bo(batch, iris_resource_bo(surf_state->res), false); + + return surf_state->offset; +} + static void iris_populate_binding_table(struct iris_context *ice, struct iris_batch *batch, @@ -2627,6 +2642,9 @@ iris_populate_binding_table(struct iris_context *ice, if (!shader) return; + const struct shader_info *info = iris_get_shader_info(ice, stage); + struct iris_shader_state *shs = &ice->shaders.state[stage]; + // Surfaces: // - pull constants // - ubos/ssbos/abos @@ -2655,7 +2673,6 @@ iris_populate_binding_table(struct iris_context *ice, } // XXX: want the number of BTE's to shorten this loop - struct iris_shader_state *shs = &ice->shaders.state[stage]; for (int i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) { struct iris_const_buffer *cbuf = &shs->constbuf[i]; if (!cbuf->surface_state.res) @@ -2663,6 +2680,11 @@ iris_populate_binding_table(struct iris_context *ice, bt_map[s++] = use_const_buffer(batch, cbuf); } + + for (int i = 0; i < info->num_abos + info->num_ssbos; i++) { + bt_map[s++] = use_ssbo(batch, ice, shs, i); + } + #if 0 // XXX: not implemented yet assert(prog_data->binding_table.pull_constants_start == 0xd0d0d0d0); -- 2.30.2