mesa: add PackedDriverUniformStorage const
[mesa.git] / src / mesa / main / mtypes.h
index a589bd4bb297cece8db1bcd0cde00b954afd0c44..08db8062ec8e628ea244f618bd5d9b0a4c74f69e 100644 (file)
@@ -1068,7 +1068,7 @@ struct gl_texture_object
    GLbyte _MaxLevel;           /**< actual max mipmap level (q in the spec) */
    GLfloat _MaxLambda;         /**< = _MaxLevel - BaseLevel (q - p in spec) */
    GLint CropRect[4];          /**< GL_OES_draw_texture */
-   GLenum16 Swizzle[4];        /**< GL_EXT_texture_swizzle */
+   GLenum Swizzle[4];          /**< GL_EXT_texture_swizzle */
    GLushort _Swizzle;          /**< same as Swizzle, but SWIZZLE_* format */
    GLbyte ImmutableLevels;     /**< ES 3.0 / ARB_texture_view */
    GLboolean GenerateMipmap;   /**< GL_SGIS_generate_mipmap */
@@ -1503,29 +1503,6 @@ struct gl_pixelstore_attrib
 };
 
 
-/**
- * Vertex array information which is derived from gl_array_attributes
- * and gl_vertex_buffer_binding information.  Used by the VBO module and
- * device drivers.
- */
-struct gl_vertex_array
-{
-   /** if NULL, vertex data are in user memory */
-   struct gl_buffer_object *BufferObj;
-   /** Pointer into user memory, or offset into the BufferObj */
-   const GLubyte *Ptr;
-   GLsizei StrideB;            /**< actual stride in bytes */
-   GLuint InstanceDivisor;      /**< GL_ARB_instanced_arrays */
-   GLenum16 Type;               /**< datatype: GL_FLOAT, GL_INT, etc */
-   GLenum16 Format;             /**< default: GL_RGBA, but may be GL_BGRA */
-   unsigned Size:4;             /**< components per element (1,2,3,4) */
-   unsigned _ElementSize:8;     /**< in bytes, up to 4*sizeof(GLdouble) */
-   unsigned Normalized:1;       /**< GL_ARB_vertex_program */
-   unsigned Integer:1;          /**< Integer-valued? */
-   unsigned Doubles:1;          /**< doubles not converted to floats */
-};
-
-
 /**
  * Enum for defining the mapping for the position/generic0 attribute.
  *
@@ -1589,6 +1566,20 @@ struct gl_vertex_buffer_binding
 };
 
 
+/**
+ * Vertex array information which is derived from gl_array_attributes
+ * and gl_vertex_buffer_binding information.  Used by the VBO module and
+ * device drivers.
+ */
+struct gl_vertex_array
+{
+   /** Vertex attribute array */
+   const struct gl_array_attributes *VertexAttrib;
+   /** Vertex buffer binding */
+   const struct gl_vertex_buffer_binding *BufferBinding;
+};
+
+
 /**
  * A representation of "Vertex Array Objects" (VAOs) from OpenGL 3.1+ /
  * the GL_ARB_vertex_array_object extension.
@@ -1608,12 +1599,11 @@ struct gl_vertex_array_object
    GLboolean EverBound;
 
    /**
-    * Derived vertex attribute arrays
-    *
-    * This is a legacy data structure created from gl_array_attributes and
-    * gl_vertex_buffer_binding, only used by the VBO module at this time.
+    * Marked to true if the object is shared between contexts and immutable.
+    * Then reference counting is done using atomics and thread safe.
+    * Is used for dlist VAOs.
     */
-   struct gl_vertex_array _VertexArray[VERT_ATTRIB_MAX];
+   bool SharedAndImmutable;
 
    /** Vertex attribute arrays */
    struct gl_array_attributes VertexAttrib[VERT_ATTRIB_MAX];
@@ -1691,11 +1681,33 @@ struct gl_array_attrib
    /* GL_ARB_vertex_buffer_object */
    struct gl_buffer_object *ArrayBufferObj;
 
+   /**
+    * Vertex array object that is used with the currently active draw command.
+    * The _DrawVAO is either set to the currently bound VAO for array type
+    * draws or to internal VAO's set up by the vbo module to execute immediate
+    * mode or display list draws.
+    */
+   struct gl_vertex_array_object *_DrawVAO;
+   /**
+    * The VERT_BIT_* bits effectively enabled from the current _DrawVAO.
+    * This is always a subset of _mesa_get_vao_vp_inputs(_DrawVAO)
+    * but may omit those arrays that shall not be referenced by the current
+    * gl_vertex_program_state::_VPMode. For example the generic attributes are
+    * maked out form the _DrawVAO's enabled arrays when a fixed function
+    * array draw is executed.
+    */
+   GLbitfield _DrawVAOEnabledAttribs;
+   /**
+    * Initially or if the VAO referenced by _DrawVAO is deleted the _DrawVAO
+    * pointer is set to the _EmptyVAO which is just an empty VAO all the time.
+    */
+   struct gl_vertex_array_object *_EmptyVAO;
+
    /**
     * Vertex arrays as consumed by a driver.
     * The array pointer is set up only by the VBO module.
     */
-   const struct gl_vertex_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
+   const struct gl_vertex_array *_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
 
    /** Legal array datatypes and the API for which they have been computed */
    GLbitfield LegalTypesMask;
@@ -1849,9 +1861,6 @@ struct gl_transform_feedback_buffer
 /** Post-link transform feedback info. */
 struct gl_transform_feedback_info
 {
-   /* Was xfb enabled via the api or in shader layout qualifiers */
-   bool api_enabled;
-
    unsigned NumOutputs;
 
    /* Bitmask of active buffer indices. */
@@ -2136,6 +2145,19 @@ typedef enum
 } gl_register_file;
 
 
+/**
+ * Current vertex processing mode: fixed function vs. shader.
+ * In reality, fixed function is probably implemented by a shader but that's
+ * not what we care about here.
+ */
+typedef enum
+{
+   VP_MODE_FF,     /**< legacy / fixed function */
+   VP_MODE_SHADER, /**< ARB vertex program or GLSL vertex shader */
+   VP_MODE_MAX     /**< for sizing arrays */
+} gl_vertex_processing_mode;
+
+
 /**
  * Base class for any kind of program object
  */
@@ -2362,6 +2384,17 @@ struct gl_vertex_program_state
    struct gl_program_cache *Cache;
 
    GLboolean _Overriden;
+
+   /**
+    * If we have a vertex program, a TNL program or no program at all.
+    * Note that this value should be kept up to date all the time,
+    * nevertheless its correctness is asserted in _mesa_update_state.
+    * The reason is to avoid calling _mesa_update_state twice we need
+    * this value on draw *before* actually calling _mesa_update_state.
+    * Also it should need to get recomputed only on changes to the
+    * vertex program which are heavyweight already.
+    */
+   gl_vertex_processing_mode _VPMode;
 };
 
 /**
@@ -4099,6 +4132,9 @@ struct gl_constants
 
    /** GL_ARB_get_program_binary */
    GLuint NumProgramBinaryFormats;
+
+   /** Is the drivers uniform storage packed or padded to 16 bytes. */
+   bool PackedDriverUniformStorage;
 };
 
 
@@ -4124,6 +4160,7 @@ struct gl_extensions
    GLboolean ARB_clear_texture;
    GLboolean ARB_clip_control;
    GLboolean ARB_color_buffer_float;
+   GLboolean ARB_compatibility;
    GLboolean ARB_compute_shader;
    GLboolean ARB_compute_variable_group_size;
    GLboolean ARB_conditional_render_inverted;
@@ -4297,8 +4334,8 @@ struct gl_extensions
    GLboolean KHR_texture_compression_astc_sliced_3d;
    GLboolean MESA_tile_raster_order;
    GLboolean MESA_pack_invert;
-   GLboolean MESA_shader_framebuffer_fetch;
-   GLboolean MESA_shader_framebuffer_fetch_non_coherent;
+   GLboolean EXT_shader_framebuffer_fetch;
+   GLboolean EXT_shader_framebuffer_fetch_non_coherent;
    GLboolean MESA_shader_integer_functions;
    GLboolean MESA_ycbcr_texture;
    GLboolean NV_conditional_render;