assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
/* _NEW_FRAG_CLAMP */
key.clamp_color = st->clamp_frag_color_in_shader &&
assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
memset(&key, 0, sizeof key);
- key.st = st; /* variants are per-context */
+ key.st = st->has_shareable_shaders ? NULL : st;
/* When this is true, we will add an extra input to the vertex
* shader translation (for edgeflags), an extra output with
assert(stgp->Base.Base.Target == GL_GEOMETRY_PROGRAM_NV);
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st->gp_variant = st_get_gp_variant(st, stgp, &key);
assert(sttcp->Base.Base.Target == GL_TESS_CONTROL_PROGRAM_NV);
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st->tcp_variant = st_get_tcp_variant(st, sttcp, &key);
assert(sttep->Base.Base.Target == GL_TESS_EVALUATION_PROGRAM_NV);
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st->tep_variant = st_get_tep_variant(st, sttep, &key);
struct pipe_resource *vbuf = NULL;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
key.bitmap = GL_TRUE;
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
key.drawpixels = 1;
key.scaleAndBias = (ctx->Pixel.RedBias != 0.0 ||
ctx->Pixel.RedScale != 1.0 ||
PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER);
st->can_force_persample_interp = screen->get_param(screen,
PIPE_CAP_FORCE_PERSAMPLE_INTERP);
-
+ st->has_shareable_shaders = screen->get_param(screen,
+ PIPE_CAP_SHAREABLE_SHADERS);
st->needs_texcoord_semantic =
screen->get_param(screen, PIPE_CAP_TGSI_TEXCOORD);
st->apply_texture_swizzle_to_border_color =
boolean has_etc2;
boolean prefer_blit_based_texture_transfer;
boolean can_force_persample_interp;
+ boolean has_shareable_shaders;
boolean needs_texcoord_semantic;
boolean apply_texture_swizzle_to_border_color;
void
st_destroy_program_variants(struct st_context *st)
{
+ /* If shaders can be shared with other contexts, the last context will
+ * call DeleteProgram on all shaders, releasing everything.
+ */
+ if (st->has_shareable_shaders)
+ return;
+
/* ARB vert/frag program */
_mesa_HashWalk(st->ctx->Shared->Programs,
destroy_program_variants_cb, st);
struct st_vp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_vp_variant(st, p, &key);
break;
}
struct st_tcp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_tcp_variant(st, p, &key);
break;
}
struct st_tep_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_tep_variant(st, p, &key);
break;
}
struct st_gp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_gp_variant(st, p, &key);
break;
}
struct st_fp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_fp_variant(st, p, &key);
break;
}