#include "draw/draw_context.h"
#include "st_context.h"
+#include "st_debug.h"
#include "st_program.h"
#include "st_mesa_to_tgsi.h"
#include "st_cb_program.h"
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
}
+ if (ST_DEBUG & DEBUG_PRECOMPILE)
+ st_precompile_shader_variant(st, prog);
+
/* XXX check if program is legal, within limits */
return GL_TRUE;
}
{ "draw", DEBUG_DRAW, NULL },
{ "buffer", DEBUG_BUFFER, NULL },
{ "wf", DEBUG_WIREFRAME, NULL },
+ { "precompile", DEBUG_PRECOMPILE, NULL },
DEBUG_NAMED_VALUE_END
};
* program constant) has to happen before creating this linkage.
*/
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
- if (program->shader_program->_LinkedShaders[i] == NULL)
+ if (program->shader_program->_LinkedShaders[i] == NULL ||
+ program->shader_program->_LinkedShaders[i]->Program == NULL)
continue;
_mesa_associate_uniform_storage(ctx, program->shader_program,
if (stvp->Base.IsPositionInvariant)
_mesa_insert_mvp_code(ctx, &stvp->Base);
- if (!stvp->glsl_to_tgsi)
- assert(stvp->Base.Base.NumInstructions > 1);
-
/*
* Determine number of inputs, the mappings between VERT_ATTRIB_x
* and TGSI generic input indexes, plus input attrib semantic info.
}
}
}
+
+
+/**
+ * Compile one shader variant.
+ */
+void
+st_precompile_shader_variant(struct st_context *st,
+ struct gl_program *prog)
+{
+ switch (prog->Target) {
+ case GL_VERTEX_PROGRAM_ARB: {
+ struct st_vertex_program *p = (struct st_vertex_program *)prog;
+ struct st_vp_variant_key key;
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+ st_get_vp_variant(st, p, &key);
+ break;
+ }
+
+ case GL_GEOMETRY_PROGRAM_NV: {
+ struct st_geometry_program *p = (struct st_geometry_program *)prog;
+ struct st_gp_variant_key key;
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+ st_get_gp_variant(st, p, &key);
+ break;
+ }
+
+ case GL_FRAGMENT_PROGRAM_ARB: {
+ struct st_fragment_program *p = (struct st_fragment_program *)prog;
+ struct st_fp_variant_key key;
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+ st_get_fp_variant(st, p, &key);
+ break;
+ }
+
+ default:
+ assert(0);
+ }
+}