[Mesa-dev] [PATCH 03/24] st/mesa: don't track shader variants in st_context
Marek Olšák
maraeo at gmail.com
Mon Jun 12 18:18:34 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/state_tracker/st_atom_shader.c | 32 ++++++++++++++------------------
src/mesa/state_tracker/st_context.h | 5 -----
2 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 875279d..37aee83 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -121,26 +121,25 @@ st_update_fp( struct st_context *st )
if (stfp->ati_fs) {
key.fog = st->ctx->Fog._PackedEnabledMode;
for (unsigned u = 0; u < MAX_NUM_FRAGMENT_REGISTERS_ATI; u++) {
key.texture_targets[u] = get_texture_target(st->ctx, u);
}
}
key.external = st_get_external_sampler_key(st, &stfp->Base);
- st->fp_variant = st_get_fp_variant(st, stfp, &key);
+ void *shader = st_get_fp_variant(st, stfp, &key)->driver_shader;
st_reference_fragprog(st, &st->fp, stfp);
- cso_set_fragment_shader_handle(st->cso_context,
- st->fp_variant->driver_shader);
+ cso_set_fragment_shader_handle(st->cso_context, shader);
}
/**
* Update vertex program state/atom. This involves translating the
* Mesa vertex program into a gallium fragment program and binding it.
*/
void
st_update_vp( struct st_context *st )
{
@@ -189,89 +188,86 @@ st_update_gp( struct st_context *st )
if (!st->ctx->GeometryProgram._Current) {
cso_set_geometry_shader_handle(st->cso_context, NULL);
st_reference_prog(st, &st->gp, NULL);
return;
}
stgp = st_common_program(st->ctx->GeometryProgram._Current);
assert(stgp->Base.Target == GL_GEOMETRY_PROGRAM_NV);
- st->gp_variant = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY,
- &stgp->tgsi, &stgp->variants);
+ void *shader = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &stgp->tgsi,
+ &stgp->variants)->driver_shader;
st_reference_prog(st, &st->gp, stgp);
- cso_set_geometry_shader_handle(st->cso_context,
- st->gp_variant->driver_shader);
+ cso_set_geometry_shader_handle(st->cso_context, shader);
}
void
st_update_tcp( struct st_context *st )
{
struct st_common_program *sttcp;
if (!st->ctx->TessCtrlProgram._Current) {
cso_set_tessctrl_shader_handle(st->cso_context, NULL);
st_reference_prog(st, &st->tcp, NULL);
return;
}
sttcp = st_common_program(st->ctx->TessCtrlProgram._Current);
assert(sttcp->Base.Target == GL_TESS_CONTROL_PROGRAM_NV);
- st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL,
- &sttcp->tgsi, &sttcp->variants);
+ void *shader = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, &sttcp->tgsi,
+ &sttcp->variants)->driver_shader;
st_reference_prog(st, &st->tcp, sttcp);
- cso_set_tessctrl_shader_handle(st->cso_context,
- st->tcp_variant->driver_shader);
+ cso_set_tessctrl_shader_handle(st->cso_context, shader);
}
void
st_update_tep( struct st_context *st )
{
struct st_common_program *sttep;
if (!st->ctx->TessEvalProgram._Current) {
cso_set_tesseval_shader_handle(st->cso_context, NULL);
st_reference_prog(st, &st->tep, NULL);
return;
}
sttep = st_common_program(st->ctx->TessEvalProgram._Current);
assert(sttep->Base.Target == GL_TESS_EVALUATION_PROGRAM_NV);
- st->tep_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL,
- &sttep->tgsi, &sttep->variants);
+ void *shader = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, &sttep->tgsi,
+ &sttep->variants)->driver_shader;
st_reference_prog(st, &st->tep, sttep);
- cso_set_tesseval_shader_handle(st->cso_context,
- st->tep_variant->driver_shader);
+ cso_set_tesseval_shader_handle(st->cso_context, shader);
}
void
st_update_cp( struct st_context *st )
{
struct st_compute_program *stcp;
if (!st->ctx->ComputeProgram._Current) {
cso_set_compute_shader_handle(st->cso_context, NULL);
st_reference_compprog(st, &st->cp, NULL);
return;
}
stcp = st_compute_program(st->ctx->ComputeProgram._Current);
assert(stcp->Base.Target == GL_COMPUTE_PROGRAM_NV);
- st->cp_variant = st_get_cp_variant(st, &stcp->tgsi, &stcp->variants);
+ void *shader = st_get_cp_variant(st, &stcp->tgsi,
+ &stcp->variants)->driver_shader;
st_reference_compprog(st, &st->cp, stcp);
- cso_set_compute_shader_handle(st->cso_context,
- st->cp_variant->driver_shader);
+ cso_set_compute_shader_handle(st->cso_context, shader);
}
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index dc3f4c0..5cd8451 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -174,25 +174,20 @@ struct st_context
GLboolean edgeflag_culls_prims;
struct st_vertex_program *vp; /**< Currently bound vertex program */
struct st_fragment_program *fp; /**< Currently bound fragment program */
struct st_common_program *gp; /**< Currently bound geometry program */
struct st_common_program *tcp; /**< Currently bound tess control program */
struct st_common_program *tep; /**< Currently bound tess eval program */
struct st_compute_program *cp; /**< Currently bound compute program */
struct st_vp_variant *vp_variant;
- struct st_fp_variant *fp_variant;
- struct st_basic_variant *gp_variant;
- struct st_basic_variant *tcp_variant;
- struct st_basic_variant *tep_variant;
- struct st_basic_variant *cp_variant;
struct {
struct pipe_resource *pixelmap_texture;
struct pipe_sampler_view *pixelmap_sampler_view;
} pixel_xfer;
/** for glBitmap */
struct {
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
--
2.7.4
More information about the mesa-dev
mailing list