summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-08-22 20:45:50 +0200
committerMarek Olšák <maraeo@gmail.com>2010-08-25 02:44:28 +0200
commit1802007ee9d63f71d1f372a80b169b6291daa378 (patch)
treeb2908c89fbab74875ba3646a03d16d0c46a315cd /src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
parent6c88f84bddf4b61f8306c5e0eb48642cb636bd58 (diff)
r300/compiler: fail to compile if we hit hw limits or an unimplemented feature
i.e. relative addressing (mainly FS), saturate modifiers, exceeding the maximum number of constants.
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index 56c5fe6d96..e54f1d657f 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -484,6 +484,21 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
if (!valid_dst(compiler->code, &vpi->DstReg))
continue;
+ if (rc_get_opcode_info(vpi->Opcode)->HasDstReg) {
+ /* Relative addressing of destination operands is not supported yet. */
+ if (vpi->DstReg.RelAddr) {
+ rc_error(&compiler->Base, "Vertex program does not support relative "
+ "addressing of destination operands (yet).\n");
+ return;
+ }
+
+ /* Neither is Saturate. */
+ if (vpi->SaturateMode != RC_SATURATE_NONE) {
+ rc_error(&compiler->Base, "Vertex program does not support the Saturate "
+ "modifier (yet).\n");
+ }
+ }
+
if (compiler->code->length >= R500_VS_MAX_ALU_DWORDS ||
(compiler->code->length >= R300_VS_MAX_ALU_DWORDS && !compiler->Base.is_r500)) {
rc_error(&compiler->Base, "Vertex program has too many instructions\n");
@@ -972,4 +987,11 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler)
fprintf(stderr, "Final vertex program code:\n");
r300_vertex_program_dump(compiler);
}
+
+ /* Check the number of constants. */
+ if (!compiler->Base.Error &&
+ compiler->Base.Program.Constants.Count > 256) {
+ rc_error(&compiler->Base, "Too many constants. Max: 256, Got: %i\n",
+ compiler->Base.Program.Constants.Count);
+ }
}