iris: Fix compute scratch pinning
[mesa.git] / src / gallium / drivers / iris / iris_resolve.c
index 11967016663c59c79d3ce611c6d5a605cb4b707c..737bcfe0e90fb26cb1b6b9a0e1e0b2c84f154234 100644 (file)
@@ -39,11 +39,11 @@ static void
 resolve_sampler_views(struct iris_batch *batch,
                       struct iris_shader_state *shs)
 {
-   for (int i = 0; i < shs->num_textures; i++) {
-      struct iris_sampler_view *isv = shs->textures[i];
-      if (!isv)
-         continue;
+   uint32_t views = shs->bound_sampler_views;
 
+   while (views) {
+      const int i = u_bit_scan(&views);
+      struct iris_sampler_view *isv = shs->textures[i];
       struct iris_resource *res = (void *) isv->base.texture;
 
       // XXX: aux tracking
@@ -55,10 +55,11 @@ static void
 resolve_image_views(struct iris_batch *batch,
                     struct iris_shader_state *shs)
 {
-   for (int i = 0; i < shs->num_images; i++) {
+   uint32_t views = shs->bound_image_views;
+
+   while (views) {
+      const int i = u_bit_scan(&views);
       struct pipe_resource *res = shs->image[i].res;
-      if (!res)
-         continue;
 
       // XXX: aux tracking
       iris_cache_flush_for_read(batch, iris_resource_bo(res));
@@ -73,16 +74,11 @@ resolve_image_views(struct iris_batch *batch,
  * enabled depth texture, and flush the render cache for any dirty textures.
  */
 void
-iris_predraw_resolve_inputs(struct iris_context *ice,
-                            struct iris_batch *batch)
+iris_predraw_resolve_inputs(struct iris_batch *batch,
+                            struct iris_shader_state *shs)
 {
-   for (gl_shader_stage stage = 0; stage < MESA_SHADER_STAGES; stage++) {
-      struct iris_shader_state *shs = &ice->state.shaders[stage];
-      resolve_sampler_views(batch, shs);
-      resolve_image_views(batch, shs);
-   }
-
-   // XXX: storage images
+   resolve_sampler_views(batch, shs);
+   resolve_image_views(batch, shs);
 }
 
 void