nir: move to compiler/
[mesa.git] / src / glsl / glcpp / glcpp-parse.y
index f1119eb805ad4b5f95f6973e6efcb31a25bd150d..ef1a6575aaa359a1a6bc0c3b334dbeb615bd3e4e 100644 (file)
@@ -290,9 +290,10 @@ control_line_success:
                macro_t *macro;
                if (strcmp("__LINE__", $4) == 0
                    || strcmp("__FILE__", $4) == 0
-                   || strcmp("__VERSION__", $4) == 0)
+                   || strcmp("__VERSION__", $4) == 0
+                   || strncmp("GL_", $4, 3) == 0)
                        glcpp_error(& @1, parser, "Built-in (pre-defined)"
-                                   " macro names can not be undefined.");
+                                   " macro names cannot be undefined.");
 
                macro = hash_table_find (parser->defines, $4);
                if (macro) {
@@ -1073,9 +1074,9 @@ _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b)
                 */
                if (node_a->token->type == SPACE
                    && node_b->token->type == SPACE) {
-                       while (node_a->token->type == SPACE)
+                       while (node_a && node_a->token->type == SPACE)
                                node_a = node_a->next;
-                       while (node_b->token->type == SPACE)
+                       while (node_b && node_b->token->type == SPACE)
                                node_b = node_b->next;
                        continue;
                }
@@ -1462,7 +1463,7 @@ _arguments_parse (argument_list_t *arguments,
                else {
                        if (argument->head == NULL) {
                                /* Don't treat initial whitespace as
-                                * part of the arguement. */
+                                * part of the argument. */
                                if (node->token->type == SPACE)
                                        continue;
                        }
@@ -2374,15 +2375,21 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
        if (parser->is_gles) {
           add_builtin_define(parser, "GL_ES", 1);
            add_builtin_define(parser, "GL_EXT_separate_shader_objects", 1);
+           add_builtin_define(parser, "GL_EXT_draw_buffers", 1);
 
           if (extensions != NULL) {
              if (extensions->OES_EGL_image_external)
                 add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
               if (extensions->OES_standard_derivatives)
                  add_builtin_define(parser, "GL_OES_standard_derivatives", 1);
+              if (extensions->ARB_texture_multisample)
+                 add_builtin_define(parser, "GL_OES_texture_storage_multisample_2d_array", 1);
+              if (extensions->ARB_blend_func_extended)
+                 add_builtin_define(parser, "GL_EXT_blend_func_extended", 1);
           }
        } else {
           add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
+           add_builtin_define(parser, "GL_ARB_enhanced_layouts", 1);
            add_builtin_define(parser, "GL_ARB_separate_shader_objects", 1);
           add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
            add_builtin_define(parser, "GL_AMD_shader_trinary_minmax", 1);
@@ -2422,6 +2429,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
              if (extensions->ARB_shader_bit_encoding)
                 add_builtin_define(parser, "GL_ARB_shader_bit_encoding", 1);
 
+             if (extensions->ARB_shader_clock)
+                add_builtin_define(parser, "GL_ARB_shader_clock", 1);
+
              if (extensions->ARB_uniform_buffer_object)
                 add_builtin_define(parser, "GL_ARB_uniform_buffer_object", 1);
 
@@ -2443,6 +2453,12 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
              if (extensions->ARB_gpu_shader5)
                 add_builtin_define(parser, "GL_ARB_gpu_shader5", 1);
 
+              if (extensions->ARB_gpu_shader_fp64)
+                 add_builtin_define(parser, "GL_ARB_gpu_shader_fp64", 1);
+
+             if (extensions->ARB_vertex_attrib_64bit)
+                add_builtin_define(parser, "GL_ARB_vertex_attrib_64bit", 1);
+
              if (extensions->AMD_vertex_shader_layer)
                 add_builtin_define(parser, "GL_AMD_vertex_shader_layer", 1);
 
@@ -2470,14 +2486,38 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
              if (extensions->ARB_shader_image_load_store)
                 add_builtin_define(parser, "GL_ARB_shader_image_load_store", 1);
 
+              if (extensions->ARB_shader_image_size)
+                 add_builtin_define(parser, "GL_ARB_shader_image_size", 1);
+
+              if (extensions->ARB_shader_texture_image_samples)
+                 add_builtin_define(parser, "GL_ARB_shader_texture_image_samples", 1);
+
               if (extensions->ARB_derivative_control)
                  add_builtin_define(parser, "GL_ARB_derivative_control", 1);
+
+              if (extensions->ARB_shader_precision)
+                 add_builtin_define(parser, "GL_ARB_shader_precision", 1);
+
+             if (extensions->ARB_shader_storage_buffer_object)
+                add_builtin_define(parser, "GL_ARB_shader_storage_buffer_object", 1);
+
+             if (extensions->ARB_tessellation_shader)
+                add_builtin_define(parser, "GL_ARB_tessellation_shader", 1);
+
+              if (extensions->ARB_shader_subroutine)
+                 add_builtin_define(parser, "GL_ARB_shader_subroutine", 1);
+
+              if (extensions->ARB_shader_draw_parameters)
+                 add_builtin_define(parser, "GL_ARB_shader_draw_parameters", 1);
           }
        }
 
        if (extensions != NULL) {
           if (extensions->EXT_shader_integer_mix)
              add_builtin_define(parser, "GL_EXT_shader_integer_mix", 1);
+
+          if (extensions->EXT_shader_samples_identical)
+             add_builtin_define(parser, "GL_EXT_shader_samples_identical", 1);
        }
 
        if (version >= 150)