{
simple_mtx_t Mutex;
GLuint Name;
- GLint RefCount;
GLchar *Label; /**< GL_KHR_debug */
+ GLint RefCount;
GLenum16 WrapS; /**< S-axis texture image wrap mode */
GLenum16 WrapT; /**< T-axis texture image wrap mode */
GLenum16 WrapR; /**< R-axis texture image wrap mode */
GLenum16 MinFilter; /**< minification filter */
GLenum16 MagFilter; /**< magnification filter */
+ GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
union gl_color_union BorderColor; /**< Interpreted according to texture format */
GLfloat MinLod; /**< min lambda, OpenGL 1.2 */
GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLenum16 CompareMode; /**< GL_ARB_shadow */
GLenum16 CompareFunc; /**< GL_ARB_shadow */
- GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
/** GL_ARB_bindless_texture */
*/
struct gl_texture_object
{
- simple_mtx_t Mutex; /**< for thread safety */
- GLint RefCount; /**< reference count */
- GLuint Name; /**< the user-visible texture object ID */
- GLchar *Label; /**< GL_KHR_debug */
- GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
- gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
- Only valid when Target is valid. */
+ simple_mtx_t Mutex; /**< for thread safety */
+ GLint RefCount; /**< reference count */
+ GLuint Name; /**< the user-visible texture object ID */
+ GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
+ GLenum16 DepthMode; /**< GL_ARB_depth_texture */
+ GLchar *Label; /**< GL_KHR_debug */
struct gl_sampler_object Sampler;
- GLenum16 DepthMode; /**< GL_ARB_depth_texture */
-
+ gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
+ Only valid when Target is valid. */
GLfloat Priority; /**< in [0,1] */
- GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
- GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
- GLint ImmutableLevels; /**< ES 3.0 / ARB_texture_view */
- GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */
+ GLint MaxLevel; /**< max mipmap level (max=1000), OpenGL 1.2 */
+ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
+ 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 */
- GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ 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 */
GLboolean _BaseComplete; /**< Is the base texture level valid? */
GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
bool StencilSampling; /**< Should we sample stencil instead of depth? */
bool HandleAllocated; /**< GL_ARB_bindless_texture */
- GLuint MinLevel; /**< GL_ARB_texture_view */
- GLuint MinLayer; /**< GL_ARB_texture_view */
- GLuint NumLevels; /**< GL_ARB_texture_view */
- GLuint NumLayers; /**< GL_ARB_texture_view */
+ /** GL_OES_EGL_image_external */
+ GLubyte RequiredTextureImageUnits;
+
+ GLubyte MinLevel; /**< GL_ARB_texture_view */
+ GLubyte NumLevels; /**< GL_ARB_texture_view */
+ GLushort MinLayer; /**< GL_ARB_texture_view */
+ GLushort NumLayers; /**< GL_ARB_texture_view */
/** GL_EXT_memory_object */
GLenum16 TextureTiling;
- /** Actual texture images, indexed by [cube face] and [mipmap level] */
- struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
+ /** GL_ARB_shader_image_load_store */
+ GLenum16 ImageFormatCompatibilityType;
/** GL_ARB_texture_buffer_object */
- struct gl_buffer_object *BufferObject;
GLenum16 BufferObjectFormat;
/** Equivalent Mesa format for BufferObjectFormat. */
mesa_format _BufferObjectFormat;
+ struct gl_buffer_object *BufferObject;
+
/** GL_ARB_texture_buffer_range */
GLintptr BufferOffset;
GLsizeiptr BufferSize; /**< if this is -1, use BufferObject->Size instead */
- /** GL_OES_EGL_image_external */
- GLint RequiredTextureImageUnits;
-
- /** GL_ARB_shader_image_load_store */
- GLenum16 ImageFormatCompatibilityType;
+ /** Actual texture images, indexed by [cube face] and [mipmap level] */
+ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
/** GL_ARB_bindless_texture */
struct util_dynarray SamplerHandles;
{
GLfloat X, Y; /**< position */
GLfloat Width, Height; /**< size */
- GLdouble Near, Far; /**< Depth buffer range */
+ GLfloat Near, Far; /**< Depth buffer range */
};
};
-/**
- * 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.
*
};
+/**
+ * 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.
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];
/* 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;
/** 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. */
} 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
*/
/** Subset of OutputsWritten outputs written with non-zero index. */
GLbitfield64 SecondaryOutputsWritten;
/** TEXTURE_x_BIT bitmask */
- GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+ GLbitfield16 TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
/** Bitfield of which samplers are used */
GLbitfield SamplersUsed;
/** Texture units used for shadow sampling. */
/** Which texture target is being sampled
* (TEXTURE_1D/2D/3D/etc_INDEX)
*/
- gl_texture_index SamplerTargets[MAX_SAMPLERS];
+ GLubyte SamplerTargets[MAX_SAMPLERS];
/**
* Number of samplers declared with the bindless_sampler layout
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;
};
/**
struct gl_constants
{
GLuint MaxTextureMbytes; /**< Max memory per image, in MB */
- GLuint MaxTextureLevels; /**< Max mipmap levels. */
+ GLuint MaxTextureLevels; /**< Max mipmap levels. */
GLuint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
GLuint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
GLuint MaxArrayTextureLayers; /**< Max layers in array textures */
/** GL_ARB_get_program_binary */
GLuint NumProgramBinaryFormats;
+
+ /** Is the drivers uniform storage packed or padded to 16 bytes. */
+ bool PackedDriverUniformStorage;
};
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;
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;
/**
* Level of the texture object bound to this unit.
*/
- GLuint Level;
+ GLubyte Level;
/**
* \c GL_TRUE if the whole level is bound as an array of layers, \c
* Layer of the texture object bound to this unit as specified by the
* application.
*/
- GLuint Layer;
+ GLushort Layer;
/**
- * Layer of the texture object bound to this unit, or zero if the
- * whole level is bound.
+ * Layer of the texture object bound to this unit, or zero if
+ * Layered == false.
*/
- GLuint _Layer;
+ GLushort _Layer;
/**
* Access allowed to this texture image. Either \c GL_READ_ONLY,
/**
* Mesa format corresponding to \c Format.
*/
- mesa_format _ActualFormat;
-
+ mesa_format _ActualFormat:16;
};
/**