Test that discard only appears in the fragment shader.
authorEric Anholt <eric@anholt.net>
Wed, 31 Mar 2010 09:40:14 +0000 (23:40 -1000)
committerEric Anholt <eric@anholt.net>
Wed, 31 Mar 2010 09:40:14 +0000 (23:40 -1000)
Fixes fragmentOnly4.vert.

ast_to_hir.cpp

index a0fe37b548514434548126ae1095ee9a20308401..f66c02980852f7766b5243ce096c9319a567f882 100644 (file)
@@ -1591,6 +1591,16 @@ ast_jump_statement::hir(exec_list *instructions,
       instructions->push_tail(inst);
    }
 
+   if (mode == ast_discard) {
+      /* FINISHME: discard support */
+      if (state->target != fragment_shader) {
+        YYLTYPE loc = this->get_location();
+
+        _mesa_glsl_error(& loc, state,
+                         "`discard' may only appear in a fragment shader");
+      }
+   }
+
    /* Jump instructions do not have r-values.
     */
    return NULL;