summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-04-10 23:58:34 +0200
committerMarek Olšák <[email protected]>2015-04-16 18:36:29 +0200
commit99eef3b8b324d3be6f3b8f2a34c95006d8205599 (patch)
treeaa688b79742a30015b9629d18f3aab4b8cb5344c /src/mesa/state_tracker/st_program.c
parent993a6288f72fa98932df7cdb6f64d9dd645e670d (diff)
st/mesa: add a debug option to compile shaders at link time
v2: fix crashes Tested-by: Tom Stellard <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r--src/mesa/state_tracker/st_program.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3b0ac4ae7ef..d93b3c7bcb8 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -185,9 +185,6 @@ st_prepare_vertex_program(struct gl_context *ctx,
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.
@@ -1318,3 +1315,47 @@ st_print_current_vertex_program(void)
}
}
}
+
+
+/**
+ * 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);
+ }
+}