virgl: Drop a context dependency from part of the shader compile path.

We should be exposing PIPE_CAP_SHAREABLE_SHADERS, but we aren't.  Clear up
one place that was using it so the next person has less to look through,
and document what's left.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9088>
This commit is contained in:
Eric Anholt 2021-02-15 12:10:18 -08:00 committed by Marge Bot
parent 175c827e72
commit a212d08296
4 changed files with 6 additions and 4 deletions

View File

@ -681,7 +681,7 @@ static void *virgl_shader_encoder(struct pipe_context *ctx,
struct tgsi_token *new_tokens;
int ret;
new_tokens = virgl_tgsi_transform(vctx, shader->tokens);
new_tokens = virgl_tgsi_transform((struct virgl_screen *)vctx->base.screen, shader->tokens);
if (!new_tokens)
return NULL;

View File

@ -127,7 +127,7 @@ void virgl_init_blit_functions(struct virgl_context *vctx);
void virgl_init_query_functions(struct virgl_context *vctx);
void virgl_init_so_functions(struct virgl_context *vctx);
struct tgsi_token *virgl_tgsi_transform(struct virgl_context *vctx, const struct tgsi_token *tokens_in);
struct tgsi_token *virgl_tgsi_transform(struct virgl_screen *vscreen, const struct tgsi_token *tokens_in);
bool
virgl_can_rebind_resource(struct virgl_context *vctx,

View File

@ -329,6 +329,9 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS:
return vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_INDIRECT_INPUT_ADDR;
case PIPE_CAP_SHAREABLE_SHADERS:
/* Shader creation emits the shader through the context's command buffer
* in virgl_encode_shader_state().
*/
return 0;
default:
return u_pipe_screen_get_param_defaults(screen, param);

View File

@ -101,9 +101,8 @@ virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
ctx->emit_instruction(ctx, inst);
}
struct tgsi_token *virgl_tgsi_transform(struct virgl_context *vctx, const struct tgsi_token *tokens_in)
struct tgsi_token *virgl_tgsi_transform(struct virgl_screen *vscreen, const struct tgsi_token *tokens_in)
{
struct virgl_screen *vscreen = (struct virgl_screen *)vctx->base.screen;
struct virgl_transform_context transform;
const uint newLen = tgsi_num_tokens(tokens_in);
struct tgsi_token *new_tokens;