swr: add streamout buffer offset into pBuffer pointer
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 27 Nov 2016 06:15:03 +0000 (01:15 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 1 Dec 2016 01:36:03 +0000 (20:36 -0500)
The buffer_size does not take the offset into account. Just add the
offset into the pointer which lines up the structures much better.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/swr_state.cpp

index fc835dc1867a776c2fe7b953bf49c375ac249fb6..4475252e50ef73aa5ad497e7c3f2fc9bd95eeded 100644 (file)
@@ -1488,10 +1488,11 @@ swr_update_derived(struct pipe_context *pipe,
             continue;
          buffer.enable = true;
          buffer.pBuffer =
-            (uint32_t *)swr_resource_data(ctx->so_targets[i]->buffer);
+            (uint32_t *)(swr_resource_data(ctx->so_targets[i]->buffer) +
+                         ctx->so_targets[i]->buffer_offset);
          buffer.bufferSize = ctx->so_targets[i]->buffer_size >> 2;
          buffer.pitch = stream_output->stride[i];
-         buffer.streamOffset = ctx->so_targets[i]->buffer_offset >> 2;
+         buffer.streamOffset = 0;
 
          SwrSetSoBuffers(ctx->swrContext, &buffer, i);
       }