{
struct gl_context *ctx = st->ctx;
struct st_vertex_program *old_vp = st->vp;
- struct st_tessctrl_program *old_tcp = st->tcp;
- struct st_tesseval_program *old_tep = st->tep;
- struct st_geometry_program *old_gp = st->gp;
+ struct st_common_program *old_tcp = st->tcp;
+ struct st_common_program *old_tep = st->tep;
+ struct st_common_program *old_gp = st->gp;
struct st_fragment_program *old_fp = st->fp;
struct gl_program *new_vp = ctx->VertexProgram._Current;
if (old_tcp)
dirty |= old_tcp->affected_states;
if (new_tcp)
- dirty |= st_tessctrl_program(new_tcp)->affected_states;
+ dirty |= st_common_program(new_tcp)->affected_states;
}
if (unlikely(new_tep != &old_tep->Base)) {
if (old_tep)
dirty |= old_tep->affected_states;
if (new_tep)
- dirty |= st_tesseval_program(new_tep)->affected_states;
+ dirty |= st_common_program(new_tep)->affected_states;
}
if (unlikely(new_gp != &old_gp->Base)) {
if (old_gp)
dirty |= old_gp->affected_states;
if (new_gp)
- dirty |= st_geometry_program(new_gp)->affected_states;
+ dirty |= st_common_program(new_gp)->affected_states;
}
if (unlikely(new_fp != &old_fp->Base)) {
*/
void st_update_gs_constants(struct st_context *st )
{
- struct st_geometry_program *gp = st->gp;
+ struct st_common_program *gp = st->gp;
struct gl_program_parameter_list *params;
if (gp) {
*/
void st_update_tcs_constants(struct st_context *st )
{
- struct st_tessctrl_program *tcp = st->tcp;
+ struct st_common_program *tcp = st->tcp;
struct gl_program_parameter_list *params;
if (tcp) {
*/
void st_update_tes_constants(struct st_context *st )
{
- struct st_tesseval_program *tep = st->tep;
+ struct st_common_program *tep = st->tep;
struct gl_program_parameter_list *params;
if (tep) {
void
st_update_gp( struct st_context *st )
{
- struct st_geometry_program *stgp;
+ struct st_common_program *stgp;
if (!st->ctx->GeometryProgram._Current) {
cso_set_geometry_shader_handle(st->cso_context, NULL);
- st_reference_geomprog(st, &st->gp, NULL);
+ st_reference_prog(st, &st->gp, NULL);
return;
}
- stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
+ 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);
- st_reference_geomprog(st, &st->gp, stgp);
+ st_reference_prog(st, &st->gp, stgp);
cso_set_geometry_shader_handle(st->cso_context,
st->gp_variant->driver_shader);
void
st_update_tcp( struct st_context *st )
{
- struct st_tessctrl_program *sttcp;
+ struct st_common_program *sttcp;
if (!st->ctx->TessCtrlProgram._Current) {
cso_set_tessctrl_shader_handle(st->cso_context, NULL);
- st_reference_tesscprog(st, &st->tcp, NULL);
+ st_reference_prog(st, &st->tcp, NULL);
return;
}
- sttcp = st_tessctrl_program(st->ctx->TessCtrlProgram._Current);
+ 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);
- st_reference_tesscprog(st, &st->tcp, sttcp);
+ st_reference_prog(st, &st->tcp, sttcp);
cso_set_tessctrl_shader_handle(st->cso_context,
st->tcp_variant->driver_shader);
void
st_update_tep( struct st_context *st )
{
- struct st_tesseval_program *sttep;
+ struct st_common_program *sttep;
if (!st->ctx->TessEvalProgram._Current) {
cso_set_tesseval_shader_handle(st->cso_context, NULL);
- st_reference_tesseprog(st, &st->tep, NULL);
+ st_reference_prog(st, &st->tep, NULL);
return;
}
- sttep = st_tesseval_program(st->ctx->TessEvalProgram._Current);
+ 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);
- st_reference_tesseprog(st, &st->tep, sttep);
+ st_reference_prog(st, &st->tep, sttep);
cso_set_tesseval_shader_handle(st->cso_context,
st->tep_variant->driver_shader);
return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_GEOMETRY_PROGRAM_NV: {
- struct st_geometry_program *prog = rzalloc(NULL,
- struct st_geometry_program);
+ struct st_common_program *prog = rzalloc(NULL,
+ struct st_common_program);
return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_TESS_CONTROL_PROGRAM_NV: {
- struct st_tessctrl_program *prog = rzalloc(NULL,
- struct st_tessctrl_program);
+ struct st_common_program *prog = rzalloc(NULL,
+ struct st_common_program);
return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_TESS_EVALUATION_PROGRAM_NV: {
- struct st_tesseval_program *prog = rzalloc(NULL,
- struct st_tesseval_program);
+ struct st_common_program *prog = rzalloc(NULL,
+ struct st_common_program);
return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_COMPUTE_PROGRAM_NV: {
break;
case GL_GEOMETRY_PROGRAM_NV:
{
- struct st_geometry_program *stgp =
- (struct st_geometry_program *) prog;
+ struct st_common_program *stgp =
+ (struct st_common_program *) prog;
st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
&stgp->tgsi);
break;
case GL_TESS_CONTROL_PROGRAM_NV:
{
- struct st_tessctrl_program *sttcp =
- (struct st_tessctrl_program *) prog;
+ struct st_common_program *sttcp =
+ (struct st_common_program *) prog;
st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
&sttcp->tgsi);
break;
case GL_TESS_EVALUATION_PROGRAM_NV:
{
- struct st_tesseval_program *sttep =
- (struct st_tesseval_program *) prog;
+ struct st_common_program *sttep =
+ (struct st_common_program *) prog;
st_release_basic_variants(st, sttep->Base.Target,
&sttep->variants, &sttep->tgsi);
st->dirty |= stfp->affected_states;
}
else if (target == GL_GEOMETRY_PROGRAM_NV) {
- struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
+ struct st_common_program *stgp = (struct st_common_program *) prog;
st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
&stgp->tgsi);
st->dirty |= ST_NEW_VERTEX_PROGRAM(st, stvp);
}
else if (target == GL_TESS_CONTROL_PROGRAM_NV) {
- struct st_tessctrl_program *sttcp =
- (struct st_tessctrl_program *) prog;
+ struct st_common_program *sttcp =
+ (struct st_common_program *) prog;
st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
&sttcp->tgsi);
st->dirty |= sttcp->affected_states;
}
else if (target == GL_TESS_EVALUATION_PROGRAM_NV) {
- struct st_tesseval_program *sttep =
- (struct st_tesseval_program *) prog;
+ struct st_common_program *sttep =
+ (struct st_common_program *) prog;
st_release_basic_variants(st, sttep->Base.Target, &sttep->variants,
&sttep->tgsi);
{
struct st_vertex_program *vp =
st_vertex_program(ctx->VertexProgram._Current);
- struct st_tessctrl_program *tcp =
- st_tessctrl_program(ctx->TessCtrlProgram._Current);
- struct st_tesseval_program *tep =
- st_tesseval_program(ctx->TessEvalProgram._Current);
- struct st_geometry_program *gp =
- st_geometry_program(ctx->GeometryProgram._Current);
+ struct st_common_program *tcp =
+ st_common_program(ctx->TessCtrlProgram._Current);
+ struct st_common_program *tep =
+ st_common_program(ctx->TessEvalProgram._Current);
+ struct st_common_program *gp =
+ st_common_program(ctx->GeometryProgram._Current);
struct st_fragment_program *fp =
st_fragment_program(ctx->FragmentProgram._Current);
struct st_compute_program *cp =
_mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st);
st_reference_fragprog(st, &st->fp, NULL);
- st_reference_geomprog(st, &st->gp, NULL);
+ st_reference_prog(st, &st->gp, NULL);
st_reference_vertprog(st, &st->vp, NULL);
- st_reference_tesscprog(st, &st->tcp, NULL);
- st_reference_tesseprog(st, &st->tep, NULL);
+ st_reference_prog(st, &st->tcp, NULL);
+ st_reference_prog(st, &st->tep, NULL);
st_reference_compprog(st, &st->cp, NULL);
/* release framebuffer surfaces */
struct st_vertex_program *vp; /**< Currently bound vertex program */
struct st_fragment_program *fp; /**< Currently bound fragment program */
- struct st_geometry_program *gp; /**< Currently bound geometry program */
- struct st_tessctrl_program *tcp; /**< Currently bound tess control program */
- struct st_tesseval_program *tep; /**< Currently bound tess eval 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_vertex_program *stvp;
struct st_fragment_program *stfp;
- struct st_geometry_program *stgp;
- struct st_tessctrl_program *sttcp;
- struct st_tesseval_program *sttep;
+ struct st_common_program *stgp;
+ struct st_common_program *sttcp;
+ struct st_common_program *sttep;
struct st_compute_program *stcp;
switch (shader->Stage) {
stfp->glsl_to_tgsi = v;
break;
case MESA_SHADER_GEOMETRY:
- stgp = (struct st_geometry_program *)prog;
+ stgp = (struct st_common_program *)prog;
stgp->glsl_to_tgsi = v;
break;
case MESA_SHADER_TESS_CTRL:
- sttcp = (struct st_tessctrl_program *)prog;
+ sttcp = (struct st_common_program *)prog;
sttcp->glsl_to_tgsi = v;
break;
case MESA_SHADER_TESS_EVAL:
- sttep = (struct st_tesseval_program *)prog;
+ sttep = (struct st_common_program *)prog;
sttep->glsl_to_tgsi = v;
break;
case MESA_SHADER_COMPUTE:
break;
case MESA_SHADER_TESS_CTRL:
- states = &((struct st_tessctrl_program*)prog)->affected_states;
+ states = &((struct st_common_program*)prog)->affected_states;
*states = ST_NEW_TCS_STATE;
break;
case MESA_SHADER_TESS_EVAL:
- states = &((struct st_tesseval_program*)prog)->affected_states;
+ states = &((struct st_common_program*)prog)->affected_states;
*states = ST_NEW_TES_STATE |
ST_NEW_RASTERIZER;
break;
case MESA_SHADER_GEOMETRY:
- states = &((struct st_geometry_program*)prog)->affected_states;
+ states = &((struct st_common_program*)prog)->affected_states;
*states = ST_NEW_GS_STATE |
ST_NEW_RASTERIZER;
*/
bool
st_translate_geometry_program(struct st_context *st,
- struct st_geometry_program *stgp)
+ struct st_common_program *stgp)
{
struct ureg_program *ureg;
*/
bool
st_translate_tessctrl_program(struct st_context *st,
- struct st_tessctrl_program *sttcp)
+ struct st_common_program *sttcp)
{
struct ureg_program *ureg;
*/
bool
st_translate_tesseval_program(struct st_context *st,
- struct st_tesseval_program *sttep)
+ struct st_common_program *sttep)
{
struct ureg_program *ureg;
case GL_TESS_EVALUATION_PROGRAM_NV:
case GL_COMPUTE_PROGRAM_NV:
{
- struct st_geometry_program *gp = (struct st_geometry_program*)target;
- struct st_tessctrl_program *tcp = (struct st_tessctrl_program*)target;
- struct st_tesseval_program *tep = (struct st_tesseval_program*)target;
+ struct st_common_program *gp = (struct st_common_program*)target;
+ struct st_common_program *tcp = (struct st_common_program*)target;
+ struct st_common_program *tep = (struct st_common_program*)target;
struct st_compute_program *cp = (struct st_compute_program*)target;
struct st_basic_variant **variants =
target->Target == GL_GEOMETRY_PROGRAM_NV ? &gp->variants :
}
case GL_TESS_CONTROL_PROGRAM_NV: {
- struct st_tessctrl_program *p = (struct st_tessctrl_program *)prog;
+ struct st_common_program *p = (struct st_common_program *)prog;
st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, &p->tgsi, &p->variants);
break;
}
case GL_TESS_EVALUATION_PROGRAM_NV: {
- struct st_tesseval_program *p = (struct st_tesseval_program *)prog;
+ struct st_common_program *p = (struct st_common_program *)prog;
st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, &p->tgsi, &p->variants);
break;
}
case GL_GEOMETRY_PROGRAM_NV: {
- struct st_geometry_program *p = (struct st_geometry_program *)prog;
+ struct st_common_program *p = (struct st_common_program *)prog;
st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &p->tgsi, &p->variants);
break;
}
/**
* Derived from Mesa gl_program:
*/
-struct st_geometry_program
+struct st_common_program
{
- struct gl_program Base; /**< The Mesa geometry program */
- struct pipe_shader_state tgsi;
- struct glsl_to_tgsi_visitor* glsl_to_tgsi;
- uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
-
- struct st_basic_variant *variants;
-
- /** SHA1 hash of linked tgsi shader program, used for on-disk cache */
- unsigned char sha1[20];
-};
-
-
-/**
- * Derived from Mesa gl_program:
- */
-struct st_tessctrl_program
-{
- struct gl_program Base; /**< The Mesa tess ctrl program */
- struct pipe_shader_state tgsi;
- struct glsl_to_tgsi_visitor* glsl_to_tgsi;
- uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
-
- struct st_basic_variant *variants;
-
- /** SHA1 hash of linked tgsi shader program, used for on-disk cache */
- unsigned char sha1[20];
-};
-
-
-/**
- * Derived from Mesa gl_program:
- */
-struct st_tesseval_program
-{
- struct gl_program Base; /**< The Mesa tess eval program */
+ struct gl_program Base;
struct pipe_shader_state tgsi;
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
return (struct st_vertex_program *)vp;
}
-static inline struct st_geometry_program *
-st_geometry_program( struct gl_program *gp )
+static inline struct st_common_program *
+st_common_program( struct gl_program *gp )
{
- return (struct st_geometry_program *)gp;
-}
-
-static inline struct st_tessctrl_program *
-st_tessctrl_program( struct gl_program *tcp )
-{
- return (struct st_tessctrl_program *)tcp;
-}
-
-static inline struct st_tesseval_program *
-st_tesseval_program( struct gl_program *tep )
-{
- return (struct st_tesseval_program *)tep;
+ return (struct st_common_program *)gp;
}
static inline struct st_compute_program *
(struct gl_program *) prog);
}
-static inline void
-st_reference_geomprog(struct st_context *st,
- struct st_geometry_program **ptr,
- struct st_geometry_program *prog)
-{
- _mesa_reference_program(st->ctx,
- (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
static inline void
st_reference_fragprog(struct st_context *st,
struct st_fragment_program **ptr,
}
static inline void
-st_reference_tesscprog(struct st_context *st,
- struct st_tessctrl_program **ptr,
- struct st_tessctrl_program *prog)
-{
- _mesa_reference_program(st->ctx,
- (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-static inline void
-st_reference_tesseprog(struct st_context *st,
- struct st_tesseval_program **ptr,
- struct st_tesseval_program *prog)
+st_reference_prog(struct st_context *st,
+ struct st_common_program **ptr,
+ struct st_common_program *prog)
{
_mesa_reference_program(st->ctx,
(struct gl_program **) ptr,
extern bool
st_translate_geometry_program(struct st_context *st,
- struct st_geometry_program *stgp);
+ struct st_common_program *stgp);
extern bool
st_translate_tessctrl_program(struct st_context *st,
- struct st_tessctrl_program *sttcp);
+ struct st_common_program *sttcp);
extern bool
st_translate_tesseval_program(struct st_context *st,
- struct st_tesseval_program *sttep);
+ struct st_common_program *sttep);
extern bool
st_translate_compute_program(struct st_context *st,
break;
}
case MESA_SHADER_TESS_CTRL: {
- struct st_tessctrl_program *stcp = (struct st_tessctrl_program *) prog;
+ struct st_common_program *stcp = (struct st_common_program *) prog;
sha1 = stcp->sha1;
write_stream_out_to_cache(blob, out_state);
break;
}
case MESA_SHADER_TESS_EVAL: {
- struct st_tesseval_program *step = (struct st_tesseval_program *) prog;
+ struct st_common_program *step = (struct st_common_program *) prog;
sha1 = step->sha1;
write_stream_out_to_cache(blob, out_state);
break;
}
case MESA_SHADER_GEOMETRY: {
- struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
+ struct st_common_program *stgp = (struct st_common_program *) prog;
sha1 = stgp->sha1;
write_stream_out_to_cache(blob, out_state);
break;
}
case MESA_SHADER_TESS_CTRL: {
- struct st_tessctrl_program *stcp =
- (struct st_tessctrl_program *) glprog;
+ struct st_common_program *stcp =
+ (struct st_common_program *) glprog;
stage_sha1[i] = stcp->sha1;
ralloc_strcat(&buf, " tcs");
disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_TESS_EVAL: {
- struct st_tesseval_program *step =
- (struct st_tesseval_program *) glprog;
+ struct st_common_program *step =
+ (struct st_common_program *) glprog;
stage_sha1[i] = step->sha1;
ralloc_strcat(&buf, " tes");
disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_GEOMETRY: {
- struct st_geometry_program *stgp =
- (struct st_geometry_program *) glprog;
+ struct st_common_program *stgp =
+ (struct st_common_program *) glprog;
stage_sha1[i] = stgp->sha1;
ralloc_strcat(&buf, " gs");
disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_TESS_CTRL: {
- struct st_tessctrl_program *sttcp =
- (struct st_tessctrl_program *) glprog;
+ struct st_common_program *sttcp =
+ (struct st_common_program *) glprog;
st_release_basic_variants(st, sttcp->Base.Target,
&sttcp->variants, &sttcp->tgsi);
break;
}
case MESA_SHADER_TESS_EVAL: {
- struct st_tesseval_program *sttep =
- (struct st_tesseval_program *) glprog;
+ struct st_common_program *sttep =
+ (struct st_common_program *) glprog;
st_release_basic_variants(st, sttep->Base.Target,
&sttep->variants, &sttep->tgsi);
break;
}
case MESA_SHADER_GEOMETRY: {
- struct st_geometry_program *stgp =
- (struct st_geometry_program *) glprog;
+ struct st_common_program *stgp =
+ (struct st_common_program *) glprog;
st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
&stgp->tgsi);