swr: mark both frag and vert textures read, don't forget about cbs
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 10 Nov 2016 03:08:24 +0000 (22:08 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 16 Nov 2016 01:25:22 +0000 (20:25 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/swr_state.cpp

index 65327f39d026bd59513d80cf92e253af5d5fae85..526d7e7307de2fb9ff59f02d17cc6a0c0ab4e5ba 100644 (file)
@@ -674,11 +674,21 @@ swr_update_resource_status(struct pipe_context *pipe,
    }
 
    /* texture sampler views */
-   for (uint32_t i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
-      struct pipe_sampler_view *view =
-         ctx->sampler_views[PIPE_SHADER_FRAGMENT][i];
-      if (view)
-         swr_resource_read(view->texture);
+   for (uint32_t j : {PIPE_SHADER_VERTEX, PIPE_SHADER_FRAGMENT}) {
+      for (uint32_t i = 0; i < ctx->num_sampler_views[j]; i++) {
+         struct pipe_sampler_view *view = ctx->sampler_views[j][i];
+         if (view)
+            swr_resource_read(view->texture);
+      }
+   }
+
+   /* constant buffers */
+   for (uint32_t j : {PIPE_SHADER_VERTEX, PIPE_SHADER_FRAGMENT}) {
+      for (uint32_t i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+         struct pipe_constant_buffer *cb = &ctx->constants[j][i];
+         if (cb->buffer)
+            swr_resource_read(cb->buffer);
+      }
    }
 }