From 519a091b74eea1f3d693190983683d4fcb98ebea Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Jul 2018 05:51:19 +1000 Subject: [PATCH] shader_buffers: fix macros and use in decode. 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 54d066e..088ed68 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -1097,9 +1097,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); }