diff options
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index 1d193ae6c7f..0cb5184d193 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -241,6 +241,7 @@ int virgl_encode_shader_state(struct virgl_context *ctx, uint32_t handle, uint32_t type, const struct pipe_stream_output_info *so_info, + uint32_t cs_req_local_mem, const struct tgsi_token *tokens) { char *str, *sptr; @@ -298,7 +299,10 @@ int virgl_encode_shader_state(struct virgl_context *ctx, virgl_emit_shader_header(ctx, handle, len, type, offlen, num_tokens); - virgl_emit_shader_streamout(ctx, first_pass ? so_info : NULL); + if (type == PIPE_SHADER_COMPUTE) + virgl_encoder_write_dword(ctx->cbuf, cs_req_local_mem); + else + virgl_emit_shader_streamout(ctx, first_pass ? so_info : NULL); virgl_encoder_write_block(ctx->cbuf, (uint8_t *)sptr, length); @@ -980,3 +984,22 @@ int virgl_encode_memory_barrier(struct virgl_context *ctx, virgl_encoder_write_dword(ctx->cbuf, flags); return 0; } + +int virgl_encode_launch_grid(struct virgl_context *ctx, + const struct pipe_grid_info *grid_info) +{ + virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_LAUNCH_GRID, 0, VIRGL_LAUNCH_GRID_SIZE)); + virgl_encoder_write_dword(ctx->cbuf, grid_info->block[0]); + virgl_encoder_write_dword(ctx->cbuf, grid_info->block[1]); + virgl_encoder_write_dword(ctx->cbuf, grid_info->block[2]); + virgl_encoder_write_dword(ctx->cbuf, grid_info->grid[0]); + virgl_encoder_write_dword(ctx->cbuf, grid_info->grid[1]); + virgl_encoder_write_dword(ctx->cbuf, grid_info->grid[2]); + if (grid_info->indirect) { + struct virgl_resource *res = virgl_resource(grid_info->indirect); + virgl_encoder_write_res(ctx, res); + } else + virgl_encoder_write_dword(ctx->cbuf, 0); + virgl_encoder_write_dword(ctx->cbuf, grid_info->indirect_offset); + return 0; +} |