/*
* Mesa 3-D graphics library
- * Version: 7.7
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
#define MTYPES_H
+#include <stdint.h> /* uint32_t */
+#include <stdbool.h>
+
#include "main/glheader.h"
#include "main/config.h"
#include "glapi/glapi.h"
struct gl_program_parameter_list;
struct set;
struct set_entry;
+struct vbo_context;
/*@}*/
/** Extra draw modes beyond GL_POINTS, GL_TRIANGLE_FAN, etc */
-#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1)
-#define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2)
-#define PRIM_UNKNOWN (GL_POLYGON+3)
+#define PRIM_MAX GL_TRIANGLE_STRIP_ADJACENCY
+#define PRIM_OUTSIDE_BEGIN_END (PRIM_MAX + 1)
+#define PRIM_UNKNOWN (PRIM_MAX + 2)
VARYING_SLOT_CLIP_DIST0,
VARYING_SLOT_CLIP_DIST1,
VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */
- VARYING_SLOT_LAYER, /* Appears only as GS output */
+ VARYING_SLOT_LAYER, /* Appears as VS or GS output */
VARYING_SLOT_FACE, /* FS only */
VARYING_SLOT_PNTC, /* FS only */
VARYING_SLOT_VAR0, /* First generic varying slot */
#define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
/*@}*/
-
-/*********************************************/
+/**
+ * Bitflags for system values.
+ */
+#define SYSTEM_BIT_SAMPLE_ID BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_ID)
+#define SYSTEM_BIT_SAMPLE_POS BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_POS)
/**
* Determine if the given gl_varying_slot appears in the fragment shader.
* register is written. No FRAG_RESULT_DATAn will be written.
*/
FRAG_RESULT_COLOR = 2,
+ FRAG_RESULT_SAMPLE_MASK = 3,
/* FRAG_RESULT_DATAn are the per-render-target (GLSL gl_FragData[n]
* or ARB_fragment_program fragment.color[n]) color results. If
* any are written, FRAG_RESULT_COLOR will not be written.
*/
- FRAG_RESULT_DATA0 = 3,
+ FRAG_RESULT_DATA0 = 4,
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
} gl_frag_result;
GLboolean _ClampFragmentColor; /** < with GL_FIXED_ONLY_ARB resolved */
GLenum ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
- GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */
+ GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */
};
GLenum LineSmooth;
GLenum PolygonSmooth;
GLenum Fog;
- GLenum ClipVolumeClipping; /**< GL_EXT_clip_volume_hint */
GLenum TextureCompression; /**< GL_ARB_texture_compression */
GLenum GenerateMipmap; /**< GL_SGIS_generate_mipmap */
GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */
GLboolean SampleCoverage;
GLfloat SampleCoverageValue;
GLboolean SampleCoverageInvert;
+ GLboolean SampleShading;
+ GLfloat MinSampleShadingValue;
/* ARB_texture_multisample / GL3.2 additions */
GLboolean SampleMask;
- GLbitfield SampleMaskValue; /* GL spec defines this as an array but >32x MSAA is
- * madness
- */
+ /** The GL spec defines this as an array but >32x MSAA is madness */
+ GLbitfield SampleMaskValue;
};
GLuint Face;
/** GL_ARB_texture_multisample */
- GLuint NumSamples; /**< Sample count, or 0 for non-multisample */
- GLboolean FixedSampleLocations; /**< Same sample locations for all pixels? */
+ GLuint NumSamples; /**< Sample count, or 0 for non-multisample */
+ GLboolean FixedSampleLocations; /**< Same sample locations for all pixels? */
};
{
GLuint Name;
GLint RefCount;
+ GLchar *Label; /**< GL_KHR_debug */
GLenum WrapS; /**< S-axis texture image wrap mode */
GLenum WrapT; /**< T-axis texture image wrap mode */
*/
struct gl_texture_object
{
- _glthread_Mutex Mutex; /**< for thread safety */
- GLint RefCount; /**< reference count */
- GLuint Name; /**< the user-visible texture object ID */
- GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
+ _glthread_Mutex Mutex; /**< for thread safety */
+ GLint RefCount; /**< reference count */
+ GLuint Name; /**< the user-visible texture object ID */
+ GLchar *Label; /**< GL_KHR_debug */
+ GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
struct gl_sampler_object Sampler;
- GLenum DepthMode; /**< GL_ARB_depth_texture */
-
- 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) */
- GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */
- GLint CropRect[4]; /**< GL_OES_draw_texture */
- GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */
- GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
- GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
- GLboolean _BaseComplete; /**< Is the base texture level valid? */
- GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
- GLboolean _IsIntegerFormat; /**< Does the texture store integer values? */
- GLboolean _RenderToTexture; /**< Any rendering to this texture? */
- GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
- GLboolean Immutable; /**< GL_ARB_texture_storage */
+ GLenum DepthMode; /**< GL_ARB_depth_texture */
+
+ 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) */
+ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - p in spec) */
+ GLint CropRect[4]; /**< GL_OES_draw_texture */
+ GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */
+ GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
+ GLboolean _BaseComplete; /**< Is the base texture level valid? */
+ GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
+ GLboolean _IsIntegerFormat; /**< Does the texture store integer values? */
+ GLboolean _RenderToTexture; /**< Any rendering to this texture? */
+ GLboolean Purgeable; /**< Is the buffer purgeable under memory
+ pressure? */
+ GLboolean Immutable; /**< GL_ARB_texture_storage */
+
+ GLuint MinLevel; /**< GL_ARB_texture_view */
+ GLuint MinLayer; /**< GL_ARB_texture_view */
+ GLuint NumLevels; /**< GL_ARB_texture_view */
+ GLuint NumLayers; /**< GL_ARB_texture_view */
/** Actual texture images, indexed by [cube face] and [mipmap level] */
struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
_glthread_Mutex Mutex;
GLint RefCount;
GLuint Name;
+ GLchar *Label; /**< GL_KHR_debug */
GLenum Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */
GLsizeiptrARB Size; /**< Size of buffer storage in bytes */
GLubyte *Data; /**< Location of storage either in RAM or VRAM. */
};
+/**
+ * Vertex attribute array as seen by the client.
+ *
+ * Contains the size, type, format and normalization flag,
+ * along with the index of a vertex buffer binding point.
+ *
+ * Note that the Stride field corresponds to VERTEX_ATTRIB_ARRAY_STRIDE
+ * and is only present for backwards compatibility reasons.
+ * Rendering always uses VERTEX_BINDING_STRIDE.
+ * The gl*Pointer() functions will set VERTEX_ATTRIB_ARRAY_STRIDE
+ * and VERTEX_BINDING_STRIDE to the same value, while
+ * glBindVertexBuffer() will only set VERTEX_BINDING_STRIDE.
+ */
+struct gl_vertex_attrib_array
+{
+ GLint Size; /**< Components per element (1,2,3,4) */
+ GLenum Type; /**< Datatype: GL_FLOAT, GL_INT, etc */
+ GLenum Format; /**< Default: GL_RGBA, but may be GL_BGRA */
+ GLsizei Stride; /**< Stride as specified with gl*Pointer() */
+ const GLubyte *Ptr; /**< Points to client array data. Not used when a VBO is bound */
+ GLintptr RelativeOffset; /**< Offset of the first element relative to the binding offset */
+ GLboolean Enabled; /**< Whether the array is enabled */
+ GLboolean Normalized; /**< Fixed-point values are normalized when converted to floats */
+ GLboolean Integer; /**< Fixed-point values are not converted to floats */
+ GLuint _ElementSize; /**< Size of each element in bytes */
+ GLuint VertexBinding; /**< Vertex buffer binding */
+};
+
+
+/**
+ * This describes the buffer object used for a vertex array (or
+ * multiple vertex arrays). If BufferObj points to the default/null
+ * buffer object, then the vertex array lives in user memory and not a VBO.
+ */
+struct gl_vertex_buffer_binding
+{
+ GLintptr Offset; /**< User-specified offset */
+ GLsizei Stride; /**< User-specified stride */
+ GLuint InstanceDivisor; /**< GL_ARB_instanced_arrays */
+ struct gl_buffer_object *BufferObj; /**< GL_ARB_vertex_buffer_object */
+ GLbitfield64 _BoundArrays; /**< Arrays bound to this binding point */
+};
+
+
/**
* Collection of vertex arrays. Defined by the GL_APPLE_vertex_array_object
* extension, but a nice encapsulation in any case.
{
/** Name of the array object as received from glGenVertexArrayAPPLE. */
GLuint Name;
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount;
_glthread_Mutex Mutex;
*/
GLboolean EverBound;
+ /** Derived vertex attribute arrays */
+ struct gl_client_array _VertexAttrib[VERT_ATTRIB_MAX];
+
/** Vertex attribute arrays */
- struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
+ struct gl_vertex_attrib_array VertexAttrib[VERT_ATTRIB_MAX];
+
+ /** Vertex buffer bindings */
+ struct gl_vertex_buffer_binding VertexBinding[VERT_ATTRIB_MAX];
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
GLbitfield64 _Enabled;
* \name Primitive restart controls
*
* Primitive restart is enabled if either \c PrimitiveRestart or
- * \c PrimitiveRestartFixedIndex is set. If \c PrimitiveRestart is set,
- * then \c RestartIndex is used as the cut vertex. Otherwise ~0 is used.
+ * \c PrimitiveRestartFixedIndex is set.
*/
/*@{*/
GLboolean PrimitiveRestart;
GLboolean PrimitiveRestartFixedIndex;
GLboolean _PrimitiveRestart;
GLuint RestartIndex;
- GLuint _RestartIndex;
/*@}*/
/* GL_ARB_vertex_buffer_object */
/**
* Vertex arrays as consumed by a driver.
- * The array pointer is set up only by the VBO module. */
+ * The array pointer is set up only by the VBO module.
+ */
const struct gl_client_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
};
struct gl_transform_feedback_object
{
GLuint Name; /**< AKA the object ID */
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount;
GLboolean Active; /**< Is transform feedback enabled? */
GLboolean Paused; /**< Is transform feedback paused? */
at least once? */
GLboolean EverBound; /**< Has this object been bound? */
+ /**
+ * The shader program active when BeginTransformFeedback() was called.
+ * When active and unpaused, this equals ctx->Shader.CurrentVertexProgram.
+ */
+ struct gl_shader_program *shader_program;
+
/**
* GLES: if Active is true, remaining number of primitives which can be
* rendered without overflow. This is necessary to track because GLES
};
+/**
+ * A "performance monitor" as described in AMD_performance_monitor.
+ */
+struct gl_perf_monitor_object
+{
+ GLuint Name;
+
+ /** True if the monitor is currently active (Begin called but not End). */
+ GLboolean Active;
+
+ /**
+ * True if the monitor has ended.
+ *
+ * This is distinct from !Active because it may never have began.
+ */
+ GLboolean Ended;
+
+ /**
+ * A list of groups with currently active counters.
+ *
+ * ActiveGroups[g] == n if there are n counters active from group 'g'.
+ */
+ unsigned *ActiveGroups;
+
+ /**
+ * An array of bitsets, subscripted by group ID, then indexed by counter ID.
+ *
+ * Checking whether counter 'c' in group 'g' is active can be done via:
+ *
+ * BITSET_TEST(ActiveCounters[g], c)
+ */
+ GLuint **ActiveCounters;
+};
+
+
+union gl_perf_monitor_counter_value
+{
+ float f;
+ uint64_t u64;
+ uint32_t u32;
+};
+
+
+struct gl_perf_monitor_counter
+{
+ /** Human readable name for the counter. */
+ const char *Name;
+
+ /**
+ * Data type of the counter. Valid values are FLOAT, UNSIGNED_INT,
+ * UNSIGNED_INT64_AMD, and PERCENTAGE_AMD.
+ */
+ GLenum Type;
+
+ /** Minimum counter value. */
+ union gl_perf_monitor_counter_value Minimum;
+
+ /** Maximum counter value. */
+ union gl_perf_monitor_counter_value Maximum;
+};
+
+
+struct gl_perf_monitor_group
+{
+ /** Human readable name for the group. */
+ const char *Name;
+
+ /**
+ * Maximum number of counters in this group which can be active at the
+ * same time.
+ */
+ GLuint MaxActiveCounters;
+
+ /** Array of counters within this group. */
+ const struct gl_perf_monitor_counter *Counters;
+ GLuint NumCounters;
+};
+
+
+/**
+ * Context state for AMD_performance_monitor.
+ */
+struct gl_perf_monitor_state
+{
+ /** Array of performance monitor groups (indexed by group ID) */
+ const struct gl_perf_monitor_group *Groups;
+ GLuint NumGroups;
+
+ /** The table of all performance monitors. */
+ struct _mesa_HashTable *Monitors;
+};
+
+
/**
* Names of the various vertex/fragment program register files, etc.
*
* NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
* All values should fit in a 4-bit field.
*
- * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR,
- * PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be considered to
- * be "uniform" variables since they can only be set outside glBegin/End.
- * They're also all stored in the same Parameters array.
+ * NOTE: PROGRAM_STATE_VAR, PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be
+ * considered to be "uniform" variables since they can only be set outside
+ * glBegin/End. They're also all stored in the same Parameters array.
*/
typedef enum
{
PROGRAM_ARRAY, /**< Arrays & Matrixes */
PROGRAM_INPUT, /**< machine->Inputs[] */
PROGRAM_OUTPUT, /**< machine->Outputs[] */
- PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */
- PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */
PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */
PROGRAM_CONSTANT, /**< gl_program->Parameters[] */
PROGRAM_UNIFORM, /**< gl_program->Parameters[] */
SYSTEM_VALUE_FRONT_FACE, /**< Fragment shader only (not done yet) */
SYSTEM_VALUE_VERTEX_ID, /**< Vertex shader only */
SYSTEM_VALUE_INSTANCE_ID, /**< Vertex shader only */
+ SYSTEM_VALUE_SAMPLE_ID, /**< Fragment shader only */
+ SYSTEM_VALUE_SAMPLE_POS, /**< Fragment shader only */
SYSTEM_VALUE_MAX /**< Number of values */
} gl_system_value;
GLuint Id;
GLubyte *String; /**< Null-terminated program text */
GLint RefCount;
- GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB */
+ GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */
GLenum Format; /**< String encoding format */
struct prog_instruction *Instructions;
GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */
GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */
+ GLboolean UsesGather; /**< Does this program use gather4 at all? */
+
+ /**
+ * For vertex and geometry shaders, true if the program uses the
+ * gl_ClipDistance output. Ignored for fragment shaders.
+ */
+ GLboolean UsesClipDistanceOut;
+
/** Named parameters, constants, etc. from program text */
struct gl_program_parameter_list *Parameters;
- /** Numbered local parameters */
- GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4];
+
+ /**
+ * Local parameters used by the program.
+ *
+ * It's dynamically allocated because it is rarely used (just
+ * assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries once it's
+ * allocated.
+ */
+ GLfloat (*LocalParams)[4];
/** Map from sampler unit to texture unit (set by glUniform1i()) */
GLubyte SamplerUnits[MAX_SAMPLERS];
{
struct gl_program Base; /**< base class */
GLboolean IsPositionInvariant;
- GLboolean UsesClipDistance;
};
{
struct gl_program Base; /**< base class */
+ GLint VerticesIn;
GLint VerticesOut;
GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB,
GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */
GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */
+ GLboolean UsesEndPrimitive;
};
* uses centroid interpolation, 0 otherwise. Unused inputs are 0.
*/
GLbitfield64 IsCentroid;
+
+ /**
+ * Bitfield indicating, for each fragment shader input, 1 if that input
+ * uses sample interpolation, 0 otherwise. Unused inputs are 0.
+ */
+ GLbitfield64 IsSample;
};
*/
struct gl_shader
{
- GLenum Type; /**< GL_FRAGMENT_SHADER || GL_VERTEX_SHADER || GL_GEOMETRY_SHADER_ARB (first field!) */
+ /** GL_FRAGMENT_SHADER || GL_VERTEX_SHADER || GL_GEOMETRY_SHADER_ARB.
+ * Must be the first field.
+ */
+ GLenum Type;
GLuint Name; /**< AKA the handle */
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount; /**< Reference count */
GLboolean DeletePending;
GLboolean CompileStatus;
/*@}*/
/**
- * Number of uniform components used by this shader.
+ * Map from sampler unit to texture unit (set by glUniform1i())
+ *
+ * A sampler unit is associated with each sampler uniform by the linker.
+ * The sampler unit associated with each uniform is stored in the
+ * \c gl_uniform_storage::sampler field.
+ */
+ GLubyte SamplerUnits[MAX_SAMPLERS];
+ /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
+ gl_texture_index SamplerTargets[MAX_SAMPLERS];
+
+ /**
+ * Number of default uniform block components used by this shader.
*
* This field is only set post-linking.
*/
unsigned num_uniform_components;
+ /**
+ * Number of combined uniform components used by this shader.
+ *
+ * This field is only set post-linking. It is the sum of the uniform block
+ * sizes divided by sizeof(float), and num_uniform_compoennts.
+ */
+ unsigned num_combined_uniform_components;
+
/**
* This shader's uniform block information.
*
struct exec_list *ir;
struct glsl_symbol_table *symbols;
- /** Shaders containing built-in functions that are used for linking. */
- struct gl_shader *builtins_to_link[16];
- unsigned num_builtins_to_link;
+ bool uses_builtin_functions;
+
+ /**
+ * Geometry shader state from GLSL 1.50 layout qualifiers.
+ */
+ struct {
+ GLint VerticesOut;
+ /**
+ * GL_POINTS, GL_LINES, GL_LINES_ADJACENCY, GL_TRIANGLES, or
+ * GL_TRIANGLES_ADJACENCY, or PRIM_UNKNOWN if it's not set in this
+ * shader.
+ */
+ GLenum InputType;
+ /**
+ * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if
+ * it's not set in this shader.
+ */
+ GLenum OutputType;
+ } Geom;
};
/**
* Shader stages. Note that these will become 5 with tessellation.
- * These MUST have the same values as gallium's PIPE_SHADER_*
+ *
+ * The order must match how shaders are ordered in the pipeline.
+ * The GLSL linker assumes that if i<j, then the j-th shader is
+ * executed later than the i-th shader.
*/
typedef enum
{
MESA_SHADER_VERTEX = 0,
- MESA_SHADER_FRAGMENT = 1,
- MESA_SHADER_GEOMETRY = 2,
+ MESA_SHADER_GEOMETRY = 1,
+ MESA_SHADER_FRAGMENT = 2,
MESA_SHADER_TYPES = 3
} gl_shader_type;
+
struct gl_uniform_buffer_variable
{
char *Name;
GLboolean RowMajor;
};
-enum gl_uniform_block_packing {
+
+enum gl_uniform_block_packing
+{
ubo_packing_std140,
ubo_packing_shared,
ubo_packing_packed
};
+
struct gl_uniform_block
{
/** Declared name of the uniform block */
enum gl_uniform_block_packing _Packing;
};
+/**
+ * Structure that represents a reference to an atomic buffer from some
+ * shader program.
+ */
+struct gl_active_atomic_buffer
+{
+ /** Uniform indices of the atomic counters declared within it. */
+ GLuint *Uniforms;
+ GLuint NumUniforms;
+
+ /** Binding point index associated with it. */
+ GLuint Binding;
+
+ /** Minimum reasonable size it is expected to have. */
+ GLuint MinimumSize;
+
+ /** Shader stages making use of it. */
+ GLboolean StageReferences[MESA_SHADER_TYPES];
+};
+
/**
* A GLSL program object.
* Basically a linked collection of vertex and fragment shaders.
{
GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */
GLuint Name; /**< aka handle or ID */
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount; /**< Reference count */
GLboolean DeletePending;
/** Post-link gl_FragDepth layout for ARB_conservative_depth. */
enum gl_frag_depth_layout FragDepthLayout;
- /** Geometry shader state - copied into gl_geometry_program at link time */
+ /**
+ * Geometry shader state - copied into gl_geometry_program by
+ * _mesa_copy_linked_program_data().
+ */
struct {
+ GLint VerticesIn;
GLint VerticesOut;
GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB,
GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */
GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */
+ /**
+ * True if gl_ClipDistance is written to. Copied into
+ * gl_geometry_program by _mesa_copy_linked_program_data().
+ */
+ GLboolean UsesClipDistance;
+ GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
+ 0 if not present. */
+ GLboolean UsesEndPrimitive;
} Geom;
- /** Vertex shader state - copied into gl_vertex_program at link time */
+ /** Vertex shader state */
struct {
- GLboolean UsesClipDistance; /**< True if gl_ClipDistance is written to. */
+ /**
+ * True if gl_ClipDistance is written to. Copied into gl_vertex_program
+ * by _mesa_copy_linked_program_data().
+ */
+ GLboolean UsesClipDistance;
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
} Vert;
unsigned NumUserUniformStorage;
struct gl_uniform_storage *UniformStorage;
+ /**
+ * Size of the gl_ClipDistance array that is output from the last pipeline
+ * stage before the fragment shader.
+ */
+ unsigned LastClipDistanceArraySize;
+
struct gl_uniform_block *UniformBlocks;
unsigned NumUniformBlocks;
+ /**
+ * Scale factor for the uniform base location
+ *
+ * This is used to generate locations (returned by \c glGetUniformLocation)
+ * of uniforms. The base location of the uniform is multiplied by this
+ * value, and the array index is added.
+ *
+ * \note
+ * Must be >= 1.
+ *
+ * \sa
+ * _mesa_uniform_merge_location_offset, _mesa_uniform_split_location_offset
+ */
+ unsigned UniformLocationBaseScale;
+
/**
* Indices into the _LinkedShaders's UniformBlocks[] array for each stage
* they're used in, or -1.
*/
struct string_to_uint_map *UniformHash;
- /**
- * Map from sampler unit to texture unit (set by glUniform1i())
- *
- * A sampler unit is associated with each sampler uniform by the linker.
- * The sampler unit associated with each uniform is stored in the
- * \c gl_uniform_storage::sampler field.
- */
- GLubyte SamplerUnits[MAX_SAMPLERS];
- /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
- gl_texture_index SamplerTargets[MAX_SAMPLERS];
+ struct gl_active_atomic_buffer *AtomicBuffers;
+ unsigned NumAtomicBuffers;
GLboolean LinkStatus; /**< GL_LINK_STATUS */
GLboolean Validated;
#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */
#define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */
#define GLSL_REPORT_ERRORS 0x100 /**< Print compilation errors */
+#define GLSL_DUMP_ON_ERROR 0x200 /**< Dump shaders to stderr on compile error */
/**
GLuint MaxIfDepth; /**< Maximum nested IF blocks */
GLuint MaxUnrollIterations;
+ /**
+ * Prefer DP4 instructions (rather than MUL/MAD) for matrix * vector
+ * operations, such as position transformation.
+ */
+ GLboolean PreferDP4;
+
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
};
{
GLenum Target; /**< The query target, when active */
GLuint Id; /**< hash table ID/name */
+ GLchar *Label; /**< GL_KHR_debug */
GLuint64EXT Result; /**< the counter */
GLboolean Active; /**< inside Begin/EndQuery */
GLboolean Ready; /**< result is ready? */
{
GLenum Type; /**< GL_SYNC_FENCE */
GLuint Name; /**< Fence name */
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount; /**< Reference count */
GLboolean DeletePending; /**< Object was deleted while there were still
* live references (e.g., sync not yet finished)
/** GL_ARB_sampler_objects */
struct _mesa_HashTable *SamplerObjects;
+
+ /**
+ * Some context in this share group was affected by a GPU reset
+ *
+ * On the next call to \c glGetGraphicsResetStatus, contexts that have not
+ * been affected by a GPU reset must also return
+ * \c GL_INNOCENT_CONTEXT_RESET_ARB.
+ *
+ * Once this field becomes true, it is never reset to false.
+ */
+ bool ShareGroupReset;
};
_glthread_Mutex Mutex; /**< for thread safety */
GLuint ClassID; /**< Useful for drivers */
GLuint Name;
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount;
GLuint Width, Height;
+ GLuint Depth;
GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */
+ /**
+ * True for renderbuffers that wrap textures, giving the driver a chance to
+ * flush render caches through the FinishRenderTexture hook.
+ *
+ * Drivers may also set this on renderbuffers other than those generated by
+ * glFramebufferTexture(), though it means FinishRenderTexture() would be
+ * called without a rb->TexImage.
+ */
+ GLboolean NeedsFinishRenderTexture;
GLubyte NumSamples;
GLenum InternalFormat; /**< The user-specified format */
GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
GL_STENCIL_INDEX. */
gl_format Format; /**< The actual renderbuffer memory format */
+ /**
+ * Pointer to the texture image if this renderbuffer wraps a texture,
+ * otherwise NULL.
+ *
+ * Note that the reference on the gl_texture_object containing this
+ * TexImage is held by the gl_renderbuffer_attachment.
+ */
+ struct gl_texture_image *TexImage;
/** Delete this renderbuffer */
void (*Delete)(struct gl_context *ctx, struct gl_renderbuffer *rb);
GLuint CubeMapFace; /**< 0 .. 5, for cube map textures. */
GLuint Zoffset; /**< Slice for 3D textures, or layer for both 1D
* and 2D array textures */
+ GLboolean Layered;
};
* polygon face orientation, and polygon stipple will have to be inverted.
*/
GLuint Name;
+ GLchar *Label; /**< GL_KHR_debug */
GLint RefCount;
GLboolean DeletePending;
*/
struct gl_config Visual;
- GLboolean Initialized;
-
GLuint Width, Height; /**< size of frame buffer in pixels */
/** \name Drawing bounds (Intersection of buffer size and scissor box) */
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
struct gl_renderbuffer *_ColorReadBuffer;
+ /**
+ * The number of layers in the framebuffer, or 0 if the framebuffer is not
+ * layered. For cube maps, this value is 6. For cube map arrays, this
+ * value is the "depth" value passed to TexImage3D (always a multiple of
+ * 6).
+ */
+ GLuint NumLayers;
+
/** Delete this framebuffer */
void (*Delete)(struct gl_framebuffer *fb);
};
GLuint MaxNativeParameters;
/* For shaders */
GLuint MaxUniformComponents; /**< Usually == MaxParameters * 4 */
+
+ /**
+ * \name Per-stage input / output limits
+ *
+ * Previous to OpenGL 3.2, the intrastage data limits were advertised with
+ * a single value: GL_MAX_VARYING_COMPONENTS (GL_MAX_VARYING_VECTORS in
+ * ES). This is stored as \c gl_constants::MaxVarying.
+ *
+ * Starting with OpenGL 3.2, the limits are advertised with per-stage
+ * variables. Each stage as a certain number of outputs that it can feed
+ * to the next stage and a certain number inputs that it can consume from
+ * the previous stage.
+ *
+ * Vertex shader inputs do not participate this in this accounting.
+ * These are tracked exclusively by \c gl_program_constants::MaxAttribs.
+ *
+ * Fragment shader outputs do not participate this in this accounting.
+ * These are tracked exclusively by \c gl_constants::MaxDrawBuffers.
+ */
+ /*@{*/
+ GLuint MaxInputComponents;
+ GLuint MaxOutputComponents;
+ /*@}*/
+
/* ES 2.0 and GL_ARB_ES2_compatibility */
struct gl_precision LowFloat, MediumFloat, HighFloat;
struct gl_precision LowInt, MediumInt, HighInt;
/* GL_ARB_uniform_buffer_object */
GLuint MaxUniformBlocks;
GLuint MaxCombinedUniformComponents;
+ GLuint MaxTextureImageUnits;
+ /* GL_ARB_shader_atomic_counters */
+ GLuint MaxAtomicBuffers;
+ GLuint MaxAtomicCounters;
};
GLuint MaxArrayTextureLayers; /**< Max layers in array textures */
GLuint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */
GLuint MaxTextureCoordUnits;
- GLuint MaxTextureImageUnits;
- GLuint MaxVertexTextureImageUnits;
GLuint MaxCombinedTextureImageUnits;
- GLuint MaxGeometryTextureImageUnits;
- GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */
+ GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */
GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */
GLuint MaxTextureBufferSize; /**< GL_ARB_texture_buffer_object */
GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */
GLfloat LineWidthGranularity;
- GLuint MaxColorTableSize;
-
GLuint MaxClipPlanes;
GLuint MaxLights;
GLfloat MaxShininess; /**< GL_NV_light_max_exponent */
GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */
GLuint MaxSamples; /**< GL_ARB_framebuffer_object */
- /** Number of varying vectors between vertex and fragment shaders */
+ /** Number of varying vectors between any two shader stages. */
GLuint MaxVarying;
- GLuint MaxVertexVaryingComponents; /**< Between vert and geom shader */
- GLuint MaxGeometryVaryingComponents; /**< Between geom and frag shader */
/** @{
* GL_ARB_uniform_buffer_object
*/
GLboolean ForceGLSLExtensionsWarn;
+ /**
+ * If non-zero, forces GLSL shaders without the #version directive to behave
+ * as if they began with "#version ForceGLSLVersion".
+ */
+ GLuint ForceGLSLVersion;
+
/**
* Does the driver support real 32-bit integers? (Otherwise, integers are
* simulated via floats.)
/** GL_EXT_gpu_shader4 */
GLint MinProgramTexelOffset, MaxProgramTexelOffset;
+ /** GL_ARB_texture_gather */
+ GLuint MinProgramTextureGatherOffset;
+ GLuint MaxProgramTextureGatherOffset;
+ GLuint MaxProgramTextureGatherComponents;
+
/* GL_ARB_robustness */
GLenum ResetStrategy;
GLboolean StripTextureBorder;
/**
- * For drivers which can do a better job at eliminating unused varyings
- * and uniforms than the GLSL compiler.
+ * For drivers which can do a better job at eliminating unused uniforms
+ * than the GLSL compiler.
*
* XXX Remove these as soon as a better solution is available.
*/
- GLboolean GLSLSkipStrictMaxVaryingLimitCheck;
GLboolean GLSLSkipStrictMaxUniformLimitCheck;
/**
*/
GLboolean PrimitiveRestartInSoftware;
+ /**
+ * Always use the GetTransformFeedbackVertexCount() driver hook, rather
+ * than passing the transform feedback object to the drawing function.
+ */
+ GLboolean AlwaysUseGetTransformFeedbackVertexCount;
+
/** GL_ARB_map_buffer_alignment */
GLuint MinMapBufferAlignment;
GLint MaxColorTextureSamples;
GLint MaxDepthTextureSamples;
GLint MaxIntegerSamples;
+
+ /** GL_ARB_shader_atomic_counters */
+ GLuint MaxAtomicBufferBindings;
+ GLuint MaxAtomicBufferSize;
+ GLuint MaxCombinedAtomicBuffers;
+ GLuint MaxCombinedAtomicCounters;
+
+ /** GL_ARB_vertex_attrib_binding */
+ GLint MaxVertexAttribRelativeOffset;
+ GLint MaxVertexAttribBindings;
};
GLboolean ARB_depth_texture;
GLboolean ARB_draw_buffers_blend;
GLboolean ARB_draw_elements_base_vertex;
+ GLboolean ARB_draw_indirect;
GLboolean ARB_draw_instanced;
GLboolean ARB_fragment_coord_conventions;
GLboolean ARB_fragment_program;
GLboolean ARB_framebuffer_object;
GLboolean ARB_explicit_attrib_location;
GLboolean ARB_geometry_shader4;
+ GLboolean ARB_gpu_shader5;
GLboolean ARB_half_float_pixel;
GLboolean ARB_half_float_vertex;
GLboolean ARB_instanced_arrays;
GLboolean ARB_occlusion_query;
GLboolean ARB_occlusion_query2;
GLboolean ARB_point_sprite;
+ GLboolean ARB_sample_shading;
GLboolean ARB_seamless_cube_map;
+ GLboolean ARB_shader_atomic_counters;
GLboolean ARB_shader_bit_encoding;
- GLboolean ARB_shader_objects;
GLboolean ARB_shader_stencil_export;
GLboolean ARB_shader_texture_lod;
- GLboolean ARB_shading_language_100;
GLboolean ARB_shading_language_packing;
+ GLboolean ARB_shading_language_420pack;
GLboolean ARB_shadow;
GLboolean ARB_sync;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_float;
+ GLboolean ARB_texture_gather;
+ GLboolean ARB_texture_mirror_clamp_to_edge;
GLboolean ARB_texture_multisample;
GLboolean ARB_texture_non_power_of_two;
+ GLboolean ARB_texture_query_levels;
GLboolean ARB_texture_query_lod;
GLboolean ARB_texture_rg;
GLboolean ARB_texture_rgb10_a2ui;
- GLboolean ARB_texture_storage;
- GLboolean ARB_texture_storage_multisample;
+ GLboolean ARB_texture_view;
GLboolean ARB_timer_query;
GLboolean ARB_transform_feedback2;
GLboolean ARB_transform_feedback3;
GLboolean ARB_uniform_buffer_object;
GLboolean ARB_vertex_program;
GLboolean ARB_vertex_shader;
+ GLboolean ARB_vertex_type_10f_11f_11f_rev;
GLboolean ARB_vertex_type_2_10_10_10_rev;
GLboolean EXT_blend_color;
GLboolean EXT_blend_equation_separate;
GLboolean EXT_blend_func_separate;
GLboolean EXT_blend_minmax;
- GLboolean EXT_clip_volume_hint;
GLboolean EXT_depth_bounds_test;
GLboolean EXT_draw_buffers2;
- GLboolean EXT_fog_coord;
GLboolean EXT_framebuffer_blit;
GLboolean EXT_framebuffer_multisample;
- GLboolean EXT_framebuffer_object;
+ GLboolean EXT_framebuffer_multisample_blit_scaled;
GLboolean EXT_framebuffer_sRGB;
GLboolean EXT_gpu_program_parameters;
GLboolean EXT_gpu_shader4;
GLboolean EXT_pixel_buffer_object;
GLboolean EXT_point_parameters;
GLboolean EXT_provoking_vertex;
- GLboolean EXT_shadow_funcs;
- GLboolean EXT_secondary_color;
GLboolean EXT_separate_shader_objects;
+ GLboolean EXT_shader_integer_mix;
GLboolean EXT_stencil_two_side;
GLboolean EXT_texture3D;
GLboolean EXT_texture_array;
GLboolean EXT_vertex_array_bgra;
GLboolean OES_standard_derivatives;
/* vendor extensions */
+ GLboolean AMD_performance_monitor;
GLboolean AMD_seamless_cubemap_per_texture;
+ GLboolean AMD_vertex_shader_layer;
GLboolean APPLE_object_purgeable;
GLboolean ATI_envmap_bumpmap;
GLboolean ATI_texture_compression_3dc;
GLboolean ATI_fragment_shader;
GLboolean ATI_separate_stencil;
GLboolean MESA_pack_invert;
- GLboolean MESA_resize_buffers;
GLboolean MESA_ycbcr_texture;
- GLboolean MESA_texture_array;
- GLboolean NV_blend_square;
GLboolean NV_conditional_render;
GLboolean NV_fog_distance;
GLboolean NV_fragment_program_option;
GLboolean NV_texture_barrier;
GLboolean NV_texture_env_combine4;
GLboolean NV_texture_rectangle;
+ GLboolean NV_vdpau_interop;
GLboolean TDFX_texture_compression_FXT1;
GLboolean OES_EGL_image;
GLboolean OES_draw_texture;
struct gl_display_list
{
GLuint Name;
+ GLchar *Label; /**< GL_KHR_debug */
GLbitfield Flags; /**< DLIST_x flags */
/** The dlist commands are in a linked list of nodes */
union gl_dlist_node *Head;
/** @{
*
- * These are a mapping of the GL_ARB_debug_output enums to small enums
- * suitable for use as an array index.
+ * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums
+ * to small enums suitable for use as an array index.
*/
enum mesa_debug_source {
MESA_DEBUG_SOURCE_THIRD_PARTY,
MESA_DEBUG_SOURCE_APPLICATION,
MESA_DEBUG_SOURCE_OTHER,
- MESA_DEBUG_SOURCE_COUNT,
+ MESA_DEBUG_SOURCE_COUNT
};
enum mesa_debug_type {
MESA_DEBUG_TYPE_PORTABILITY,
MESA_DEBUG_TYPE_PERFORMANCE,
MESA_DEBUG_TYPE_OTHER,
- MESA_DEBUG_TYPE_COUNT,
+ MESA_DEBUG_TYPE_MARKER,
+ MESA_DEBUG_TYPE_PUSH_GROUP,
+ MESA_DEBUG_TYPE_POP_GROUP,
+ MESA_DEBUG_TYPE_COUNT
};
enum mesa_debug_severity {
MESA_DEBUG_SEVERITY_LOW,
MESA_DEBUG_SEVERITY_MEDIUM,
MESA_DEBUG_SEVERITY_HIGH,
- MESA_DEBUG_SEVERITY_COUNT,
+ MESA_DEBUG_SEVERITY_NOTIFICATION,
+ MESA_DEBUG_SEVERITY_COUNT
};
/** @} */
/**
* An error, warning, or other piece of debug information for an application
- * to consume via GL_ARB_debug_output.
+ * to consume via GL_ARB_debug_output/GL_KHR_debug.
*/
struct gl_debug_msg
{
struct gl_debug_state
{
- GLDEBUGPROCARB Callback;
- GLvoid *CallbackData;
+ GLDEBUGPROC Callback;
+ const void *CallbackData;
GLboolean SyncOutput;
- GLboolean Defaults[MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
- struct gl_debug_namespace Namespaces[MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
+ GLboolean DebugOutput;
+ GLboolean ARBCallback; /* Used to track if current callback is of type ARB_debug_output or KHR_debug */
+ GLboolean Defaults[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
+ struct gl_debug_namespace Namespaces[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
struct gl_debug_msg Log[MAX_DEBUG_LOGGED_MESSAGES];
+ struct gl_debug_msg DebugGroupMsgs[MAX_DEBUG_GROUP_STACK_DEPTH];
+ GLint GroupStackDepth;
GLint NumMessages;
GLint NextMsg;
GLint NextMsgLength; /* redundant, but copied here from Log[NextMsg].length
API_OPENGLES,
API_OPENGLES2,
API_OPENGL_CORE,
- API_OPENGL_LAST = API_OPENGL_CORE,
+ API_OPENGL_LAST = API_OPENGL_CORE
} gl_api;
/**
/** gl_context::RasterDiscard */
GLbitfield NewRasterizerDiscard;
+
+ /**
+ * gl_context::UniformBufferBindings
+ * gl_shader_program::UniformBlocks
+ */
+ GLbitfield NewUniformBuffer;
+
+ /**
+ * gl_context::AtomicBufferBindings
+ */
+ GLbitfield NewAtomicBuffer;
};
struct gl_uniform_buffer_binding
GLboolean AutomaticSize;
};
+/**
+ * Binding point for an atomic counter buffer object.
+ */
+struct gl_atomic_buffer_binding
+{
+ struct gl_buffer_object *BufferObject;
+ GLintptr Offset;
+ GLsizeiptr Size;
+};
+
/**
* Mesa rendering context.
*
* OpenGL state is contained in this structure.
* Think of this as a base class from which device drivers will derive
* sub classes.
- *
- * The struct gl_context typedef names this structure.
*/
struct gl_context
{
struct gl_transform_feedback_state TransformFeedback;
+ struct gl_perf_monitor_state PerfMonitor;
+
+ struct gl_buffer_object *DrawIndirectBuffer; /** < GL_ARB_draw_indirect */
+
struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */
* associated with uniform blocks by glUniformBlockBinding()'s state in the
* shader program.
*/
- struct gl_uniform_buffer_binding *UniformBufferBindings;
+ struct gl_uniform_buffer_binding
+ UniformBufferBindings[MAX_COMBINED_UNIFORM_BUFFERS];
+
+ /**
+ * Object currently associated with the GL_ATOMIC_COUNTER_BUFFER
+ * target.
+ */
+ struct gl_buffer_object *AtomicBuffer;
+
+ /**
+ * Array of atomic counter buffer binding points.
+ */
+ struct gl_atomic_buffer_binding
+ AtomicBufferBindings[MAX_COMBINED_ATOMIC_BUFFERS];
/*@}*/
GLenum ErrorValue; /**< Last error code */
- /* GL_ARB_robustness */
- GLenum ResetStatus;
-
/**
* Recognize and silence repeated error debug messages in buggy apps.
*/
const char *ErrorDebugFmtString;
GLuint ErrorDebugCount;
- /* GL_ARB_debug_output */
+ /* GL_ARB_debug_output/GL_KHR_debug */
struct gl_debug_state Debug;
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLboolean TextureFormatSupported[MESA_FORMAT_COUNT];
- /**
- * Use dp4 (rather than mul/mad) instructions for position
- * transformation?
- */
- GLboolean mvp_with_dp4;
-
GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
/**
void *swrast_context;
void *swsetup_context;
void *swtnl_context;
- void *swtnl_im;
+ struct vbo_context *vbo_context;
struct st_context *st;
void *aelt_context;
/*@}*/
+
+ /**
+ * \name NV_vdpau_interop
+ */
+ /*@{*/
+ const void *vdpDevice;
+ const void *vdpGetProcAddress;
+ struct set *vdpSurfaces;
+ /*@}*/
+
+ /**
+ * Has this context observed a GPU reset in any context in the share group?
+ *
+ * Once this field becomes true, it is never reset to false.
+ */
+ GLboolean ShareGroupReset;
};