[Mesa-dev] [PATCH] swr: fix resource backed constant buffers

Tim Rowley timothy.o.rowley at intel.com
Mon Apr 18 23:12:39 UTC 2016


Code was using an incorrect address for the base pointer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94979
---
 src/gallium/drivers/swr/swr_state.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index ded51a9..0e0979d 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -1138,7 +1138,8 @@ swr_update_derived(struct pipe_context *pipe,
          pDC->num_constantsVS[i] = cb->buffer_size;
          if (cb->buffer)
             pDC->constantVS[i] =
-               (const float *)((const uint8_t *)cb->buffer + cb->buffer_offset);
+               (const float *)(swr_resource(cb->buffer)->swr.pBaseAddress +
+                               cb->buffer_offset);
          else {
             /* Need to copy these constants to scratch space */
             if (cb->user_buffer && cb->buffer_size) {
@@ -1163,7 +1164,8 @@ swr_update_derived(struct pipe_context *pipe,
          pDC->num_constantsFS[i] = cb->buffer_size;
          if (cb->buffer)
             pDC->constantFS[i] =
-               (const float *)((const uint8_t *)cb->buffer + cb->buffer_offset);
+               (const float *)(swr_resource(cb->buffer)->swr.pBaseAddress +
+                               cb->buffer_offset);
          else {
             /* Need to copy these constants to scratch space */
             if (cb->user_buffer && cb->buffer_size) {
-- 
1.9.1



More information about the mesa-dev mailing list