diff options
author | Tomeu Vizoso <[email protected]> | 2018-07-17 13:13:21 +0200 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2018-09-05 05:46:58 +0100 |
commit | f13de57edb1b0bea0090421e5f812f1041f36e12 (patch) | |
tree | 89f768fbd91e3db77d180353dceb8a69468a2095 /src/gallium/drivers/virgl/virgl_encode.c | |
parent | 1bd927d997f75c85e9f13826d486b6d2d159a621 (diff) |
virgl: use hw-atomics instead of in-ssbo ones
Emulating atomics on top of ssbos can lead to too small max SSBO count,
so let's use the hw-atomics mechanism to expose atomic buffers instead.
Signed-off-by: Erik Faye-Lund <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index bcb14d8939a..29920b22be5 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -958,6 +958,29 @@ int virgl_encode_set_shader_buffers(struct virgl_context *ctx, return 0; } +int virgl_encode_set_hw_atomic_buffers(struct virgl_context *ctx, + unsigned start_slot, unsigned count, + const struct pipe_shader_buffer *buffers) +{ + int i; + virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_ATOMIC_BUFFERS, 0, VIRGL_SET_ATOMIC_BUFFER_SIZE(count))); + + virgl_encoder_write_dword(ctx->cbuf, start_slot); + for (i = 0; i < count; i++) { + if (buffers) { + struct virgl_resource *res = virgl_resource(buffers[i].buffer); + virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset); + virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_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); + } + } + return 0; +} + int virgl_encode_set_shader_images(struct virgl_context *ctx, enum pipe_shader_type shader, unsigned start_slot, unsigned count, |