summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/r300_fragprog_common.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-12-12 16:48:32 +0100
committerMichal Krol <michal@vmware.com>2009-12-12 16:48:32 +0100
commita3eb0f718e19653a2ad8e49396c904183be456f3 (patch)
tree0092574c469ea586a6cab8b8ebb7ac62b8221a2a /src/mesa/drivers/dri/r300/r300_fragprog_common.c
parent491f384c3958067e6c4c994041f5d8d413b806bc (diff)
parent784cca9fa527de771754d76545970f78094b9adf (diff)
Merge branch 'master' into glsl-pp-rework-2
Conflicts: progs/perf/drawoverhead.c progs/perf/teximage.c progs/perf/vbo.c progs/perf/vertexrate.c src/mesa/shader/slang/library/slang_common_builtin_gc.h
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_fragprog_common.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 469c278b51..267ee81a7a 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -44,6 +44,7 @@
#include "compiler/radeon_compiler.h"
+#include "radeon_mesa_to_rc.h"
#include "r300_state.h"
@@ -99,8 +100,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler,
{
int i;
+ fp->wpos_attr = FRAG_ATTRIB_MAX;
if (!(compiler->Base.Program.InputsRead & FRAG_BIT_WPOS)) {
- fp->wpos_attr = FRAG_ATTRIB_MAX;
return;
}
@@ -112,6 +113,13 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler,
}
}
+ /* No free texcoord found, fall-back to software rendering */
+ if (fp->wpos_attr == FRAG_ATTRIB_MAX)
+ {
+ compiler->Base.Error = 1;
+ return;
+ }
+
rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, fp->wpos_attr);
}
@@ -124,11 +132,11 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler,
*/
static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r300_fragment_program * fp)
{
- struct prog_src_register src;
+ struct rc_src_register src;
int i;
+ fp->fog_attr = FRAG_ATTRIB_MAX;
if (!(compiler->Base.Program.InputsRead & FRAG_BIT_FOGC)) {
- fp->fog_attr = FRAG_ATTRIB_MAX;
return;
}
@@ -140,8 +148,15 @@ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r
}
}
+ /* No free texcoord found, fall-back to software rendering */
+ if (fp->fog_attr == FRAG_ATTRIB_MAX)
+ {
+ compiler->Base.Error = 1;
+ return;
+ }
+
memset(&src, 0, sizeof(src));
- src.File = PROGRAM_INPUT;
+ src.File = RC_FILE_INPUT;
src.Index = fp->fog_attr;
src.Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE);
rc_move_input(&compiler->Base, FRAG_ATTRIB_FOGC, src);
@@ -218,13 +233,26 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
fflush(stderr);
}
- rc_mesa_to_rc_program(&compiler.Base, &cont->Base.Base);
+ radeon_mesa_to_rc_program(&compiler.Base, &cont->Base.Base);
insert_WPOS_trailer(&compiler, fp);
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;