Mesa (master): i965: Throw a link error when we see a "return" in main().

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 18 02:57:18 UTC 2010


Module: Mesa
Branch: master
Commit: 1cdef8e90a33d982d8ce5ae73eb224e078a2054b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cdef8e90a33d982d8ce5ae73eb224e078a2054b

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug 17 19:51:00 2010 -0700

i965: Throw a link error when we see a "return" in main().

We'll need to use the HALT instruction to do this right, like returns
from other functions.

---

 src/mesa/drivers/dri/i965/brw_program.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index c6d11fe..1cdc8c6 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -175,6 +175,14 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx,
 		      "the end of the function to work around it.\n");
 	 return GL_FALSE;
       }
+
+      if (prog->Instructions[i].Opcode == OPCODE_RET) {
+	 shader_error(ctx, prog,
+		      "i965 driver doesn't yet support \"return\" "
+		      "from main().\n");
+	 return GL_FALSE;
+      }
+
       if (prog->Instructions[i].DstReg.RelAddr &&
 	  prog->Instructions[i].DstReg.File == PROGRAM_INPUT) {
 	 shader_error(ctx, prog,




More information about the mesa-commit mailing list