struct gl_program *prog )
{
struct st_context *st = st_context(ctx);
+ gl_shader_stage stage = _mesa_program_enum_to_shader_stage(target);
if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM;
}
- if (ST_DEBUG & DEBUG_PRECOMPILE)
+ if (ST_DEBUG & DEBUG_PRECOMPILE ||
+ st->shader_has_one_variant[stage])
st_precompile_shader_variant(st, prog);
- /* XXX check if program is legal, within limits */
return GL_TRUE;
}
ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectSampler = true;
}
+ /* Set which shader types can be compiled at link time. */
+ st->shader_has_one_variant[MESA_SHADER_VERTEX] =
+ st->has_shareable_shaders &&
+ !st->clamp_vert_color_in_shader;
+
+ st->shader_has_one_variant[MESA_SHADER_FRAGMENT] =
+ st->has_shareable_shaders &&
+ !st->clamp_frag_color_in_shader &&
+ !st->force_persample_in_shader;
+
+ st->shader_has_one_variant[MESA_SHADER_TESS_CTRL] = st->has_shareable_shaders;
+ st->shader_has_one_variant[MESA_SHADER_TESS_EVAL] = st->has_shareable_shaders;
+ st->shader_has_one_variant[MESA_SHADER_GEOMETRY] = st->has_shareable_shaders;
+
_mesa_compute_version(ctx);
if (ctx->Version == 0) {
boolean force_persample_in_shader;
boolean has_shareable_shaders;
+ /**
+ * If a shader can be created when we get its source.
+ * This means it has only 1 variant, not counting glBitmap and
+ * glDrawPixels.
+ */
+ boolean shader_has_one_variant[MESA_SHADER_STAGES];
+
boolean needs_texcoord_semantic;
boolean apply_texture_swizzle_to_border_color;