i965: Throw a link error when we see a "return" in main().
authorEric Anholt <eric@anholt.net>
Wed, 18 Aug 2010 02:51:00 +0000 (19:51 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 18 Aug 2010 02:55:14 +0000 (19:55 -0700)
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

index c6d11fed064e2156b9db6ccb913a89c8ca67408e..1cdc8c6411b9775e30066951cf71a5fcbc489a30 100644 (file)
@@ -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,