diff options
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index 1a1c40bac78..be72f707fa1 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -22,6 +22,7 @@ */ #include <stdint.h> +#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_math.h" #include "pipe/p_state.h" @@ -562,14 +563,16 @@ int virgl_encode_sampler_view(struct virgl_context *ctx, struct virgl_resource *res, const struct pipe_sampler_view *state) { + unsigned elem_size = util_format_get_blocksize(state->format); + uint32_t tmp; virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_CREATE_OBJECT, VIRGL_OBJECT_SAMPLER_VIEW, VIRGL_OBJ_SAMPLER_VIEW_SIZE)); virgl_encoder_write_dword(ctx->cbuf, handle); virgl_encoder_write_res(ctx, res); virgl_encoder_write_dword(ctx->cbuf, state->format); if (res->u.b.target == PIPE_BUFFER) { - virgl_encoder_write_dword(ctx->cbuf, state->u.buf.first_element); - virgl_encoder_write_dword(ctx->cbuf, state->u.buf.last_element); + virgl_encoder_write_dword(ctx->cbuf, state->u.buf.offset / elem_size); + virgl_encoder_write_dword(ctx->cbuf, (state->u.buf.offset + state->u.buf.size) / elem_size - 1); } else { virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_layer | state->u.tex.last_layer << 16); virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_level | state->u.tex.last_level << 8); |