if (st->shader_has_one_variant[prog->info.stage] && stp->variants)
return stp->variants->driver_shader;
- struct st_basic_variant_key key;
+ struct st_common_variant_key key;
/* use memset, not an initializer to be sure all memory is zeroed */
memset(&key, 0, sizeof(key));
}
- return st_get_basic_variant(st, stp, &key)->driver_shader;
+ return st_get_common_variant(st, stp, &key)->driver_shader;
}
{
struct st_common_program *p = st_common_program(prog);
- st_release_basic_variants(st, p);
+ st_release_common_variants(st, p);
if (p->glsl_to_tgsi)
free_glsl_to_tgsi_visitor(p->glsl_to_tgsi);
} else {
struct st_common_program *stcp = st_common_program(prog);
- st_release_basic_variants(st, stcp);
+ st_release_common_variants(st, stcp);
if (!stcp->shader_program && /* not GLSL->NIR */
!st_translate_common_program(st, stcp))
return false;
* the variant from the linked list.
*/
static void
-delete_basic_variant(struct st_context *st, struct st_basic_variant *v,
+delete_basic_variant(struct st_context *st, struct st_common_variant *v,
GLenum target)
{
if (v->driver_shader) {
* Free all basic program variants.
*/
void
-st_release_basic_variants(struct st_context *st, struct st_common_program *p)
+st_release_common_variants(struct st_context *st, struct st_common_program *p)
{
- struct st_basic_variant *v;
+ struct st_common_variant *v;
for (v = p->variants; v; ) {
- struct st_basic_variant *next = v->next;
+ struct st_common_variant *next = v->next;
delete_basic_variant(st, v, p->Base.Target);
v = next;
}
/**
* Get/create a basic program variant.
*/
-struct st_basic_variant *
-st_get_basic_variant(struct st_context *st,
- struct st_common_program *prog,
- const struct st_basic_variant_key *key)
+struct st_common_variant *
+st_get_common_variant(struct st_context *st,
+ struct st_common_program *prog,
+ const struct st_common_variant_key *key)
{
struct pipe_context *pipe = st->pipe;
- struct st_basic_variant *v;
+ struct st_common_variant *v;
struct pipe_shader_state tgsi = {0};
/* Search for existing variant */
if (!v) {
/* create new */
- v = CALLOC_STRUCT(st_basic_variant);
+ v = CALLOC_STRUCT(st_common_variant);
if (v) {
if (prog->state.type == PIPE_SHADER_IR_NIR) {
case GL_COMPUTE_PROGRAM_NV:
{
struct st_common_program *p = st_common_program(target);
- struct st_basic_variant *v, **prevPtr = &p->variants;
+ struct st_common_variant *v, **prevPtr = &p->variants;
for (v = p->variants; v; ) {
- struct st_basic_variant *next = v->next;
+ struct st_common_variant *next = v->next;
if (v->key.st == st) {
/* unlink from list */
*prevPtr = next;
case GL_GEOMETRY_PROGRAM_NV:
case GL_COMPUTE_PROGRAM_NV: {
struct st_common_program *p = st_common_program(prog);
- struct st_basic_variant_key key;
+ struct st_common_variant_key key;
memset(&key, 0, sizeof(key));
key.st = st->has_shareable_shaders ? NULL : st;
- st_get_basic_variant(st, p, &key);
+ st_get_common_variant(st, p, &key);
break;
}
-/** Key shared by all shaders except VP, FP */
-struct st_basic_variant_key
+/** Shader key shared by other shaders */
+struct st_common_variant_key
{
struct st_context *st; /**< variants are per-context */
/**
* Geometry program variant.
*/
-struct st_basic_variant
+struct st_common_variant
{
/* Parameters which generated this variant. */
- struct st_basic_variant_key key;
+ struct st_common_variant_key key;
void *driver_shader;
- struct st_basic_variant *next;
+ struct st_common_variant *next;
};
/* used when bypassing glsl_to_tgsi: */
struct gl_shader_program *shader_program;
- struct st_basic_variant *variants;
+ struct st_common_variant *variants;
/** SHA1 hash of linked tgsi shader program, used for on-disk cache */
unsigned char sha1[20];
struct st_fragment_program *stfp,
const struct st_fp_variant_key *key);
-extern struct st_basic_variant *
-st_get_basic_variant(struct st_context *st,
- struct st_common_program *p,
- const struct st_basic_variant_key *key);
+extern struct st_common_variant *
+st_get_common_variant(struct st_context *st,
+ struct st_common_program *p,
+ const struct st_common_variant_key *key);
extern void
st_release_vp_variants( struct st_context *st,
struct st_fragment_program *stfp );
extern void
-st_release_basic_variants(struct st_context *st, struct st_common_program *p);
+st_release_common_variants(struct st_context *st, struct st_common_program *p);
extern void
st_destroy_program_variants(struct st_context *st);
case MESA_SHADER_COMPUTE: {
struct st_common_program *stcp = st_common_program(prog);
- st_release_basic_variants(st, stcp);
+ st_release_common_variants(st, stcp);
if (prog->info.stage == MESA_SHADER_TESS_EVAL ||
prog->info.stage == MESA_SHADER_GEOMETRY)