aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_encode.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-07-18 12:54:30 +1000
committerDave Airlie <[email protected]>2018-08-01 08:02:27 +1000
commit452eea140d909db6d10101914dff0e1274acc1e0 (patch)
tree9b63b79dd0851c2c9329285d669ddf0036e97cc2 /src/gallium/drivers/virgl/virgl_encode.c
parentfaa29c0e2449e3d7521bc273d723012b537593df (diff)
virgl: add initial images support (v2)
v2: add max image samples support Reviwed-by: Gert Wollny <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index b09366dcee6..68ec5a1dc9d 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -943,3 +943,32 @@ int virgl_encode_set_shader_buffers(struct virgl_context *ctx,
}
return 0;
}
+
+int virgl_encode_set_shader_images(struct virgl_context *ctx,
+ enum pipe_shader_type shader,
+ unsigned start_slot, unsigned count,
+ const struct pipe_image_view *images)
+{
+ int i;
+ virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_SHADER_IMAGES, 0, VIRGL_SET_SHADER_IMAGE_SIZE(count)));
+
+ virgl_encoder_write_dword(ctx->cbuf, shader);
+ virgl_encoder_write_dword(ctx->cbuf, start_slot);
+ for (i = 0; i < count; i++) {
+ if (images) {
+ struct virgl_resource *res = virgl_resource(images[i].resource);
+ virgl_encoder_write_dword(ctx->cbuf, images[i].format);
+ virgl_encoder_write_dword(ctx->cbuf, images[i].access);
+ virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.offset);
+ virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.size);
+ virgl_encoder_write_res(ctx, res);
+ } else {
+ virgl_encoder_write_dword(ctx->cbuf, 0);
+ virgl_encoder_write_dword(ctx->cbuf, 0);
+ virgl_encoder_write_dword(ctx->cbuf, 0);
+ virgl_encoder_write_dword(ctx->cbuf, 0);
+ virgl_encoder_write_dword(ctx->cbuf, 0);
+ }
+ }
+ return 0;
+}