aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/r300_fragprog_common.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2009-10-03 01:26:38 +0200
committerNicolai Hähnle <[email protected]>2009-10-03 01:39:13 +0200
commitbbe384c86afeaf5995cddd286a76e1fd789e18f1 (patch)
treeabfd58da4495819027ac24f39783c3c6f6316550 /src/mesa/drivers/dri/r300/r300_fragprog_common.c
parentc01a77d304776153e968d68617a2c84e3af35555 (diff)
r300: Workaround problem on R500 with very large fragment programs
The non-KMS interface is to blame here. In theory, a proper fix could be produced that works for the KMS interface only, but it require cleaning a lot of mess. Easier to just do it right in r300g. Signed-off-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_fragprog_common.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 0bdc90b4a84..70c92528943 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -239,6 +239,19 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
rewriteFog(&compiler, fp);
r3xx_compile_fragment_program(&compiler);
+
+ if (compiler.is_r500) {
+ /* We need to support the non-KMS DRM interface, which
+ * artificially limits the number of instructions and
+ * constants which are available to us.
+ *
+ * See also the comment in r300_context.c where we
+ * set the MAX_NATIVE_xxx values.
+ */
+ if (fp->code.code.r500.inst_end >= 255 || fp->code.constants.Count > 255)
+ rc_error(&compiler.Base, "Program is too big (upgrade to r300g to avoid this limitation).\n");
+ }
+
fp->error = compiler.Base.Error;
fp->InputsRead = compiler.Base.Program.InputsRead;