iris: better BT asserts
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 7 Apr 2018 14:07:19 +0000 (07:07 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
Probably nothing is working because texture upload isn't implemented

src/gallium/drivers/iris/iris_program.c
src/gallium/drivers/iris/iris_state.c

index b0ec74c58dac3cc734fe4310852f74e8e6b7302c..3263723f11f164ca8a756aaf486247e8e26fc47f 100644 (file)
@@ -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);
index 0b0cdc1960a85f51266fc5fdd0f271f6305de105..67740718056da5d36285cd2f2258c52bc50333ba 100644 (file)
@@ -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