glsl: fix the type of ir_constant_data::u16
[mesa.git] / src / compiler / glsl / ast.h
index eee224828129fb9798ca2a0f8891f0a06bb5244d..3a960c2ff327306b924657ffdad22569fc07e5aa 100644 (file)
@@ -28,6 +28,7 @@
 #include "list.h"
 #include "glsl_parser_extras.h"
 #include "compiler/glsl_types.h"
+#include "util/bitset.h"
 
 struct _mesa_glsl_parse_state;
 
@@ -76,6 +77,7 @@ public:
    {
       struct YYLTYPE locp;
 
+      locp.path = this->location.path;
       locp.source = this->location.source;
       locp.first_line = this->location.first_line;
       locp.first_column = this->location.first_column;
@@ -92,6 +94,7 @@ public:
     */
    void set_location(const struct YYLTYPE &locp)
    {
+      this->location.path = locp.path;
       this->location.source = locp.source;
       this->location.first_line = locp.first_line;
       this->location.first_column = locp.first_column;
@@ -106,6 +109,7 @@ public:
     */
    void set_location_range(const struct YYLTYPE &begin, const struct YYLTYPE &end)
    {
+      this->location.path = begin.path;
       this->location.source = begin.source;
       this->location.first_line = begin.first_line;
       this->location.last_line = end.last_line;
@@ -117,6 +121,7 @@ public:
     * Source location of the AST node.
     */
    struct {
+      char *path;               /**< GLSL shader include path. */
       unsigned source;          /**< GLSL source number. */
       unsigned first_line;      /**< First line number within the source string. */
       unsigned first_column;    /**< First column in the first line. */
@@ -473,8 +478,15 @@ enum {
 
 struct ast_type_qualifier {
    DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier);
+   /* Note: this bitset needs to have at least as many bits as the 'q'
+    * struct has flags, below.  Previously, the size was 128 instead of 96.
+    * But an apparent bug in GCC 5.4.0 causes bad SSE code generation
+    * elsewhere, leading to a crash.  96 bits works around the issue.
+    * See https://bugs.freedesktop.org/show_bug.cgi?id=105497
+    */
+   DECLARE_BITSET_T(bitset_t, 96);
 
-   union {
+   union flags {
       struct {
         unsigned invariant:1;
          unsigned precise:1;
@@ -618,6 +630,16 @@ struct ast_type_qualifier {
           * Flag set if GL_ARB_post_depth_coverage layout qualifier is used.
           */
          unsigned post_depth_coverage:1;
+
+         /**
+          * Flags for the layout qualifers added by ARB_fragment_shader_interlock
+          */
+
+         unsigned pixel_interlock_ordered:1;
+         unsigned pixel_interlock_unordered:1;
+         unsigned sample_interlock_ordered:1;
+         unsigned sample_interlock_unordered:1;
+
          /**
           * Flag set if GL_INTEL_conservartive_rasterization layout qualifier
           * is used.
@@ -631,12 +653,28 @@ struct ast_type_qualifier {
          unsigned bound_sampler:1;
          unsigned bound_image:1;
          /** \} */
+
+         /** \name Layout qualifiers for GL_EXT_shader_framebuffer_fetch_non_coherent */
+         /** \{ */
+         unsigned non_coherent:1;
+         /** \} */
+
+         /** \name Layout qualifiers for NV_compute_shader_derivatives */
+         /** \{ */
+         unsigned derivative_group:1;
+         /** \} */
+
+         /**
+          * Flag set if GL_NV_viewport_array2 viewport_relative layout
+          * qualifier is used.
+          */
+         unsigned viewport_relative:1;
       }
       /** \brief Set of flags, accessed by name. */
       q;
 
       /** \brief Set of flags, accessed as a bitmask. */
-      uint64_t i;
+      bitset_t i;
    } flags;
 
    /** Precision of the type (highp/medium/lowp). */
@@ -741,7 +779,13 @@ struct ast_type_qualifier {
     * \note
     * This field is only valid if \c explicit_image_format is set.
     */
-   GLenum image_format;
+   enum pipe_format image_format;
+
+   /**
+    * Arrangement of invocations used to calculate derivatives in a compute
+    * shader.  From NV_compute_shader_derivatives.
+    */
+   enum gl_derivative_group derivative_group;
 
    /**
     * Base type of the data read from or written to this image.  Only
@@ -1179,6 +1223,16 @@ public:
 };
 
 
+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)
@@ -1292,6 +1346,20 @@ private:
    ast_layout_expression *local_size[3];
 };
 
+class ast_warnings_toggle : public ast_node {
+public:
+   ast_warnings_toggle(bool _enable)
+      : enable(_enable)
+   {
+      /* empty */
+   }
+
+   virtual ir_rvalue *hir(exec_list *instructions,
+                          struct _mesa_glsl_parse_state *state);
+
+private:
+   bool enable;
+};
 /*@}*/
 
 extern void