llvmpipe: Take in consideration all current constant buffers when mapping.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 18 Apr 2013 18:05:53 +0000 (19:05 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 18 Apr 2013 19:48:12 +0000 (20:48 +0100)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
src/gallium/drivers/llvmpipe/lp_texture.c

index 99bd6d3417faf7758c104927e7fb07839dd09370..08046193a37c16dd4e237f71de77d1155e98be34 100644 (file)
@@ -669,9 +669,15 @@ llvmpipe_transfer_map( struct pipe_context *pipe,
 
    /* Check if we're mapping the current constant buffer */
    if ((usage & PIPE_TRANSFER_WRITE) &&
-       resource == llvmpipe->constants[PIPE_SHADER_FRAGMENT][0].buffer) {
-      /* constants may have changed */
-      llvmpipe->dirty |= LP_NEW_CONSTANTS;
+       (resource->bind & PIPE_BIND_CONSTANT_BUFFER)) {
+      unsigned i;
+      for (i = 0; i < Elements(llvmpipe->constants[PIPE_SHADER_FRAGMENT]); ++i) {
+         if (resource == llvmpipe->constants[PIPE_SHADER_FRAGMENT][i].buffer) {
+            /* constants may have changed */
+            llvmpipe->dirty |= LP_NEW_CONSTANTS;
+            break;
+         }
+      }
    }
 
    lpt = CALLOC_STRUCT(llvmpipe_transfer);