diff options
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 29 |
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; +} |