};
+class ast_demote_statement : public ast_node {
+public:
+ ast_demote_statement(void) {}
+ virtual void print(void) const;
+
+ virtual ir_rvalue *hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+};
+
+
class ast_function_definition : public ast_node {
public:
ast_function_definition() : prototype(NULL), body(NULL)
}
+ir_rvalue *
+ast_demote_statement::hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ void *ctx = state;
+
+ if (state->stage != MESA_SHADER_FRAGMENT) {
+ YYLTYPE loc = this->get_location();
+
+ _mesa_glsl_error(& loc, state,
+ "`demote' may only appear in a fragment shader");
+ }
+
+ instructions->push_tail(new(ctx) ir_demote);
+
+ return NULL;
+}
+
+
ir_rvalue *
ast_selection_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
if return IF;
discard return DISCARD;
return return RETURN;
+demote KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->EXT_demote_to_helper_invocation_enable, DEMOTE);
bvec2 { yylval->type = glsl_type::bvec2_type; return BASIC_TYPE_TOK; }
bvec3 { yylval->type = glsl_type::bvec3_type; return BASIC_TYPE_TOK; }
%token ATTRIBUTE CONST_TOK
%token <type> BASIC_TYPE_TOK
-%token BREAK BUFFER CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
+%token BREAK BUFFER CONTINUE DO ELSE FOR IF DEMOTE DISCARD RETURN SWITCH CASE DEFAULT
%token CENTROID IN_TOK OUT_TOK INOUT_TOK UNIFORM VARYING SAMPLE
%token NOPERSPECTIVE FLAT SMOOTH
%token IMAGE1DSHADOW IMAGE2DSHADOW IMAGE1DARRAYSHADOW IMAGE2DARRAYSHADOW
%type <node> declaration
%type <node> declaration_statement
%type <node> jump_statement
+%type <node> demote_statement
%type <node> interface_block
%type <interface_block> basic_interface_block
%type <struct_specifier> struct_specifier
| switch_statement
| iteration_statement
| jump_statement
+ | demote_statement
;
compound_statement:
}
;
+demote_statement:
+ DEMOTE ';'
+ {
+ void *ctx = state->linalloc;
+ $$ = new(ctx) ast_demote_statement();
+ $$->set_location(@1);
+ }
+ ;
+
external_declaration:
function_definition { $$ = $1; }
| declaration { $$ = $1; }
}
+void
+ast_demote_statement::print(void) const
+{
+ printf("demote; ");
+}
+
+
void
ast_selection_statement::print(void) const
{