summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-08-12 02:33:41 +0200
committerMarek Olšák <[email protected]>2016-08-17 14:15:33 +0200
commit7cd256ce7e4bad680bb77d033cf5dd662abab2dd (patch)
tree3b4a190876c076129e01792f0e3f4a087a820988 /src/gallium/drivers/virgl
parent1ac23a9359556091b12ed1345737084e3a2f6ae3 (diff)
gallium: change pipe_sampler_view::first_element/last_element -> offset/size
This is required by OpenGL. Our hardware supports this. Example: Bind RGBA32F with offset = 4 bytes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97305 Acked-by: Ilia Mirkin <[email protected]> Acked-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl')
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c7
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);