From bbe384c86afeaf5995cddd286a76e1fd789e18f1 Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Sat, 3 Oct 2009 01:26:38 +0200 Subject: r300: Workaround problem on R500 with very large fragment programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/mesa/drivers/dri/r300/r300_fragprog_common.c') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 0bdc90b4a8..70c9252894 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; -- cgit v1.2.3