zink: unify gfx shader create callbacks
these are identical Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>
This commit is contained in:
committed by
Marge Bot
parent
84bce72014
commit
caf79bd421
@@ -968,19 +968,6 @@ zink_get_compute_pipeline(struct zink_screen *screen,
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
zink_create_vs_state(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *shader)
|
||||
{
|
||||
struct nir_shader *nir;
|
||||
if (shader->type != PIPE_SHADER_IR_NIR)
|
||||
nir = zink_tgsi_to_nir(pctx->screen, shader->tokens);
|
||||
else
|
||||
nir = (struct nir_shader *)shader->ir.nir;
|
||||
|
||||
return zink_shader_create(zink_screen(pctx->screen), nir, &shader->stream_output);
|
||||
}
|
||||
|
||||
static inline void
|
||||
bind_stage(struct zink_context *ctx, enum pipe_shader_type stage,
|
||||
struct zink_shader *shader)
|
||||
@@ -1003,19 +990,6 @@ zink_bind_vs_state(struct pipe_context *pctx,
|
||||
bind_stage(zink_context(pctx), PIPE_SHADER_VERTEX, cso);
|
||||
}
|
||||
|
||||
static void *
|
||||
zink_create_fs_state(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *shader)
|
||||
{
|
||||
struct nir_shader *nir;
|
||||
if (shader->type != PIPE_SHADER_IR_NIR)
|
||||
nir = zink_tgsi_to_nir(pctx->screen, shader->tokens);
|
||||
else
|
||||
nir = (struct nir_shader *)shader->ir.nir;
|
||||
|
||||
return zink_shader_create(zink_screen(pctx->screen), nir, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
zink_bind_fs_state(struct pipe_context *pctx,
|
||||
void *cso)
|
||||
@@ -1023,19 +997,6 @@ zink_bind_fs_state(struct pipe_context *pctx,
|
||||
bind_stage(zink_context(pctx), PIPE_SHADER_FRAGMENT, cso);
|
||||
}
|
||||
|
||||
static void *
|
||||
zink_create_gs_state(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *shader)
|
||||
{
|
||||
struct nir_shader *nir;
|
||||
if (shader->type != PIPE_SHADER_IR_NIR)
|
||||
nir = zink_tgsi_to_nir(pctx->screen, shader->tokens);
|
||||
else
|
||||
nir = (struct nir_shader *)shader->ir.nir;
|
||||
|
||||
return zink_shader_create(zink_screen(pctx->screen), nir, &shader->stream_output);
|
||||
}
|
||||
|
||||
static void
|
||||
zink_bind_gs_state(struct pipe_context *pctx,
|
||||
void *cso)
|
||||
@@ -1047,19 +1008,6 @@ zink_bind_gs_state(struct pipe_context *pctx,
|
||||
bind_stage(ctx, PIPE_SHADER_GEOMETRY, cso);
|
||||
}
|
||||
|
||||
static void *
|
||||
zink_create_tcs_state(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *shader)
|
||||
{
|
||||
struct nir_shader *nir;
|
||||
if (shader->type != PIPE_SHADER_IR_NIR)
|
||||
nir = zink_tgsi_to_nir(pctx->screen, shader->tokens);
|
||||
else
|
||||
nir = (struct nir_shader *)shader->ir.nir;
|
||||
|
||||
return zink_shader_create(zink_screen(pctx->screen), nir, &shader->stream_output);
|
||||
}
|
||||
|
||||
static void
|
||||
zink_bind_tcs_state(struct pipe_context *pctx,
|
||||
void *cso)
|
||||
@@ -1067,19 +1015,6 @@ zink_bind_tcs_state(struct pipe_context *pctx,
|
||||
bind_stage(zink_context(pctx), PIPE_SHADER_TESS_CTRL, cso);
|
||||
}
|
||||
|
||||
static void *
|
||||
zink_create_tes_state(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *shader)
|
||||
{
|
||||
struct nir_shader *nir;
|
||||
if (shader->type != PIPE_SHADER_IR_NIR)
|
||||
nir = zink_tgsi_to_nir(pctx->screen, shader->tokens);
|
||||
else
|
||||
nir = (struct nir_shader *)shader->ir.nir;
|
||||
|
||||
return zink_shader_create(zink_screen(pctx->screen), nir, &shader->stream_output);
|
||||
}
|
||||
|
||||
static void
|
||||
zink_bind_tes_state(struct pipe_context *pctx,
|
||||
void *cso)
|
||||
@@ -1122,26 +1057,38 @@ zink_bind_cs_state(struct pipe_context *pctx,
|
||||
bind_stage(zink_context(pctx), PIPE_SHADER_COMPUTE, cso);
|
||||
}
|
||||
|
||||
static void *
|
||||
zink_create_gfx_shader_state(struct pipe_context *pctx, const struct pipe_shader_state *shader)
|
||||
{
|
||||
struct nir_shader *nir;
|
||||
if (shader->type != PIPE_SHADER_IR_NIR)
|
||||
nir = zink_tgsi_to_nir(pctx->screen, shader->tokens);
|
||||
else
|
||||
nir = (struct nir_shader *)shader->ir.nir;
|
||||
|
||||
return zink_shader_create(zink_screen(pctx->screen), nir, &shader->stream_output);
|
||||
}
|
||||
|
||||
void
|
||||
zink_program_init(struct zink_context *ctx)
|
||||
{
|
||||
ctx->base.create_vs_state = zink_create_vs_state;
|
||||
ctx->base.create_vs_state = zink_create_gfx_shader_state;
|
||||
ctx->base.bind_vs_state = zink_bind_vs_state;
|
||||
ctx->base.delete_vs_state = zink_delete_shader_state;
|
||||
|
||||
ctx->base.create_fs_state = zink_create_fs_state;
|
||||
ctx->base.create_fs_state = zink_create_gfx_shader_state;
|
||||
ctx->base.bind_fs_state = zink_bind_fs_state;
|
||||
ctx->base.delete_fs_state = zink_delete_shader_state;
|
||||
|
||||
ctx->base.create_gs_state = zink_create_gs_state;
|
||||
ctx->base.create_gs_state = zink_create_gfx_shader_state;
|
||||
ctx->base.bind_gs_state = zink_bind_gs_state;
|
||||
ctx->base.delete_gs_state = zink_delete_shader_state;
|
||||
|
||||
ctx->base.create_tcs_state = zink_create_tcs_state;
|
||||
ctx->base.create_tcs_state = zink_create_gfx_shader_state;
|
||||
ctx->base.bind_tcs_state = zink_bind_tcs_state;
|
||||
ctx->base.delete_tcs_state = zink_delete_shader_state;
|
||||
|
||||
ctx->base.create_tes_state = zink_create_tes_state;
|
||||
ctx->base.create_tes_state = zink_create_gfx_shader_state;
|
||||
ctx->base.bind_tes_state = zink_bind_tes_state;
|
||||
ctx->base.delete_tes_state = zink_delete_shader_state;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user