struct st_fragment_program);
return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
+ case GL_TESS_CONTROL_PROGRAM_NV:
+ case GL_TESS_EVALUATION_PROGRAM_NV:
case GL_GEOMETRY_PROGRAM_NV: {
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_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_common_program *prog = rzalloc(NULL,
- struct st_common_program);
+ struct st_common_program);
return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_COMPUTE_PROGRAM_NV: {
free_glsl_to_tgsi_visitor(stvp->glsl_to_tgsi);
}
break;
+ case GL_TESS_CONTROL_PROGRAM_NV:
+ case GL_TESS_EVALUATION_PROGRAM_NV:
case GL_GEOMETRY_PROGRAM_NV:
{
- struct st_common_program *stgp =
- (struct st_common_program *) prog;
+ struct st_common_program *p = st_common_program(prog);
- st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
- &stgp->tgsi);
+ st_release_basic_variants(st, p->Base.Target, &p->variants,
+ &p->tgsi);
- if (stgp->glsl_to_tgsi)
- free_glsl_to_tgsi_visitor(stgp->glsl_to_tgsi);
+ if (p->glsl_to_tgsi)
+ free_glsl_to_tgsi_visitor(p->glsl_to_tgsi);
}
break;
case GL_FRAGMENT_PROGRAM_ARB:
free_glsl_to_tgsi_visitor(stfp->glsl_to_tgsi);
}
break;
- case GL_TESS_CONTROL_PROGRAM_NV:
- {
- struct st_common_program *sttcp =
- (struct st_common_program *) prog;
-
- st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
- &sttcp->tgsi);
-
- if (sttcp->glsl_to_tgsi)
- free_glsl_to_tgsi_visitor(sttcp->glsl_to_tgsi);
- }
- break;
- case GL_TESS_EVALUATION_PROGRAM_NV:
- {
- struct st_common_program *sttep =
- (struct st_common_program *) prog;
-
- st_release_basic_variants(st, sttep->Base.Target,
- &sttep->variants, &sttep->tgsi);
-
- if (sttep->glsl_to_tgsi)
- free_glsl_to_tgsi_visitor(sttep->glsl_to_tgsi);
- }
- break;
case GL_COMPUTE_PROGRAM_NV:
{
struct st_compute_program *stcp =
st->dirty |= stfp->affected_states;
}
else if (target == GL_GEOMETRY_PROGRAM_NV) {
- struct st_common_program *stgp = (struct st_common_program *) prog;
+ struct st_common_program *stgp = st_common_program(prog);
st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
&stgp->tgsi);
}
else if (target == GL_TESS_CONTROL_PROGRAM_NV) {
struct st_common_program *sttcp =
- (struct st_common_program *) prog;
+ st_common_program(prog);
st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
&sttcp->tgsi);
}
else if (target == GL_TESS_EVALUATION_PROGRAM_NV) {
struct st_common_program *sttep =
- (struct st_common_program *) prog;
+ st_common_program(prog);
st_release_basic_variants(st, sttep->Base.Target, &sttep->variants,
&sttep->tgsi);
struct st_vertex_program *stvp;
struct st_fragment_program *stfp;
- struct st_common_program *stgp;
- struct st_common_program *sttcp;
- struct st_common_program *sttep;
+ struct st_common_program *stp;
struct st_compute_program *stcp;
switch (shader->Stage) {
stfp = (struct st_fragment_program *)prog;
stfp->glsl_to_tgsi = v;
break;
- case MESA_SHADER_GEOMETRY:
- stgp = (struct st_common_program *)prog;
- stgp->glsl_to_tgsi = v;
- break;
case MESA_SHADER_TESS_CTRL:
- sttcp = (struct st_common_program *)prog;
- sttcp->glsl_to_tgsi = v;
- break;
case MESA_SHADER_TESS_EVAL:
- sttep = (struct st_common_program *)prog;
- sttep->glsl_to_tgsi = v;
+ case MESA_SHADER_GEOMETRY:
+ stp = st_common_program(prog);
+ stp->glsl_to_tgsi = v;
break;
case MESA_SHADER_COMPUTE:
stcp = (struct st_compute_program *)prog;
break;
case MESA_SHADER_TESS_CTRL:
- states = &((struct st_common_program*)prog)->affected_states;
+ states = &(st_common_program(prog))->affected_states;
*states = ST_NEW_TCS_STATE;
break;
case MESA_SHADER_TESS_EVAL:
- states = &((struct st_common_program*)prog)->affected_states;
+ states = &(st_common_program(prog))->affected_states;
*states = ST_NEW_TES_STATE |
ST_NEW_RASTERIZER;
break;
case MESA_SHADER_GEOMETRY:
- states = &((struct st_common_program*)prog)->affected_states;
+ states = &(st_common_program(prog))->affected_states;
*states = ST_NEW_GS_STATE |
ST_NEW_RASTERIZER;
case GL_TESS_EVALUATION_PROGRAM_NV:
case GL_COMPUTE_PROGRAM_NV:
{
- 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_common_program *p = 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 :
- target->Target == GL_TESS_CONTROL_PROGRAM_NV ? &tcp->variants :
- target->Target == GL_TESS_EVALUATION_PROGRAM_NV ? &tep->variants :
target->Target == GL_COMPUTE_PROGRAM_NV ? &cp->variants :
- NULL;
+ &p->variants;
struct st_basic_variant *v, **prevPtr = variants;
for (v = *variants; v; ) {
}
case GL_TESS_CONTROL_PROGRAM_NV: {
- struct st_common_program *p = (struct st_common_program *)prog;
+ struct st_common_program *p = 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_common_program *p = (struct st_common_program *)prog;
+ struct st_common_program *p = 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_common_program *p = (struct st_common_program *)prog;
+ struct st_common_program *p = st_common_program(prog);
st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &p->tgsi, &p->variants);
break;
}
write_tgsi_to_cache(blob, &stvp->tgsi, st, sha1, num_tokens);
break;
}
- case MESA_SHADER_TESS_CTRL: {
- struct st_common_program *stcp = (struct st_common_program *) prog;
- sha1 = stcp->sha1;
-
- write_stream_out_to_cache(blob, out_state);
- write_tgsi_to_cache(blob, out_state, st, sha1, num_tokens);
- break;
- }
- case MESA_SHADER_TESS_EVAL: {
- struct st_common_program *step = (struct st_common_program *) prog;
- sha1 = step->sha1;
-
- write_stream_out_to_cache(blob, out_state);
- write_tgsi_to_cache(blob, out_state, st, sha1, num_tokens);
- break;
- }
+ case MESA_SHADER_TESS_CTRL:
+ case MESA_SHADER_TESS_EVAL:
case MESA_SHADER_GEOMETRY: {
- struct st_common_program *stgp = (struct st_common_program *) prog;
- sha1 = stgp->sha1;
+ struct st_common_program *p = st_common_program(prog);
+ sha1 = p->sha1;
write_stream_out_to_cache(blob, out_state);
write_tgsi_to_cache(blob, out_state, st, sha1, num_tokens);
break;
}
case MESA_SHADER_TESS_CTRL: {
- struct st_common_program *stcp =
- (struct st_common_program *) glprog;
+ struct st_common_program *stcp = 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_common_program *step =
- (struct st_common_program *) glprog;
+ struct st_common_program *step = 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_common_program *stgp =
- (struct st_common_program *) glprog;
+ struct st_common_program *stgp = 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_common_program *sttcp =
- (struct st_common_program *) glprog;
+ struct st_common_program *sttcp = st_common_program(glprog);
st_release_basic_variants(st, sttcp->Base.Target,
&sttcp->variants, &sttcp->tgsi);
break;
}
case MESA_SHADER_TESS_EVAL: {
- struct st_common_program *sttep =
- (struct st_common_program *) glprog;
+ struct st_common_program *sttep = st_common_program(glprog);
st_release_basic_variants(st, sttep->Base.Target,
&sttep->variants, &sttep->tgsi);
break;
}
case MESA_SHADER_GEOMETRY: {
- struct st_common_program *stgp =
- (struct st_common_program *) glprog;
+ struct st_common_program *stgp = st_common_program(glprog);
st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
&stgp->tgsi);