[virglrenderer-devel] [PATCH] shader_buffers: fix macros and use in decode.

Dave Airlie airlied at gmail.com
Mon Jul 23 19:52:11 UTC 2018


From: Dave Airlie <airlied at redhat.com>

Pointed out by Gert on the mesa review.
---
 src/virgl_protocol.h | 6 +++---
 src/vrend_decode.c   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/virgl_protocol.h b/src/virgl_protocol.h
index 6c73dfb..e9974a8 100644
--- a/src/virgl_protocol.h
+++ b/src/virgl_protocol.h
@@ -496,8 +496,8 @@ enum virgl_context_cmd {
 #define VIRGL_SET_SHADER_BUFFER_SIZE(x) (VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE * (x)) + 2
 #define VIRGL_SET_SHADER_BUFFER_SHADER_TYPE 1
 #define VIRGL_SET_SHADER_BUFFER_START_SLOT 2
-#define VIRGL_SET_SHADER_BUFFER_OFFSET(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 2)
-#define VIRGL_SET_SHADER_BUFFER_LENGTH(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 3)
-#define VIRGL_SET_SHADER_BUFFER_RES_HANDLE(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 4)
+#define VIRGL_SET_SHADER_BUFFER_OFFSET(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 3)
+#define VIRGL_SET_SHADER_BUFFER_LENGTH(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 4)
+#define VIRGL_SET_SHADER_BUFFER_RES_HANDLE(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 5)
 
 #endif
diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index 11fe149..5677bba 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -1098,9 +1098,9 @@ static int vrend_decode_set_shader_buffers(struct vrend_decode_ctx *ctx, uint16_
       return EINVAL;
 
    for (int i = 0; i < num_ssbo; i++) {
-      uint32_t offset = get_buf_entry(ctx, i * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 3);
-      uint32_t buf_len = get_buf_entry(ctx, i * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 4);
-      uint32_t handle = get_buf_entry(ctx, i * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 5);
+      uint32_t offset = get_buf_entry(ctx, VIRGL_SET_SHADER_BUFFER_OFFSET(i));
+      uint32_t buf_len = get_buf_entry(ctx, VIRGL_SET_SHADER_BUFFER_LENGTH(i));
+      uint32_t handle = get_buf_entry(ctx, VIRGL_SET_SHADER_BUFFER_RES_HANDLE(i));
       vrend_set_single_ssbo(ctx->grctx, shader_type, start_slot + i, offset, buf_len,
                             handle);
    }
-- 
2.17.1



More information about the virglrenderer-devel mailing list