From 35afa8c8f34568326e5f3a5089b24bbeb3b16969 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 7 Apr 2018 07:07:19 -0700 Subject: [PATCH] iris: better BT asserts Probably nothing is working because texture upload isn't implemented --- src/gallium/drivers/iris/iris_program.c | 11 ++++++++--- src/gallium/drivers/iris/iris_state.c | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index b0ec74c58da..3263723f11f 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -155,9 +155,14 @@ assign_common_binding_table_offsets(const struct gen_device_info *devinfo, struct brw_stage_prog_data *prog_data, uint32_t next_binding_table_offset) { - prog_data->binding_table.texture_start = next_binding_table_offset; - prog_data->binding_table.gather_texture_start = next_binding_table_offset; - next_binding_table_offset += info->num_textures; + if (info->num_textures) { + prog_data->binding_table.texture_start = next_binding_table_offset; + prog_data->binding_table.gather_texture_start = next_binding_table_offset; + next_binding_table_offset += info->num_textures; + } else { + prog_data->binding_table.texture_start = 0xd0d0d0d0; + prog_data->binding_table.gather_texture_start = 0xd0d0d0d0; + } if (info->num_ubos) { //assert(info->num_ubos <= BRW_MAX_UBO); diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 0b0cdc1960a..67740718056 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2088,6 +2088,7 @@ iris_upload_render_state(struct iris_context *ice, struct brw_stage_prog_data *prog_data = (void *) shader->prog_data; uint32_t bt_offset = 0; uint32_t *bt_map = NULL; + int s = 0; if (prog_data->binding_table.size_bytes != 0) { iris_use_pinned_bo(batch, ice->state.binder.bo, false); @@ -2104,14 +2105,17 @@ iris_upload_render_state(struct iris_context *ice, if (stage == MESA_SHADER_FRAGMENT) { struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer; for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) { - *bt_map++ = use_surface(batch, cso_fb->cbufs[i], true); + bt_map[s++] = use_surface(batch, cso_fb->cbufs[i], true); } } + assert(prog_data->binding_table.texture_start == + ice->state.num_textures[stage] ? s : 0xd0d0d0d0); + for (int i = 0; i < ice->state.num_textures[stage]; i++) { struct iris_sampler_view *view = ice->state.textures[stage][i]; struct iris_resource *res = (void *) view->pipe.texture; - *bt_map++ = use_sampler_view(batch, view); + bt_map[s++] = use_sampler_view(batch, view); } #if 0 -- 2.30.2