#include "main/formats.h" /* MESA_FORMAT_COUNT */
#include "compiler/glsl/list.h"
#include "util/bitscan.h"
+#include "util/simple_mtx.h"
+#include "util/u_dynarray.h"
#ifdef __cplusplus
#endif
+/** Set a single bit */
+#define BITFIELD_BIT(b) ((GLbitfield)1 << (b))
+/** Set all bits up to excluding bit b */
+#define BITFIELD_MASK(b) \
+ ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT(b) - 1)
+/** Set count bits starting from bit b */
+#define BITFIELD_RANGE(b, count) \
+ (BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b))
+
+
/**
* \name 64-bit extension of GLbitfield.
*/
struct gl_uniform_storage;
struct prog_instruction;
struct gl_program_parameter_list;
+struct gl_shader_spirv_data;
struct set;
-struct set_entry;
struct vbo_context;
/*@}*/
BUFFER_COLOR5,
BUFFER_COLOR6,
BUFFER_COLOR7,
- BUFFER_COUNT
+ BUFFER_COUNT,
+ BUFFER_NONE = -1,
} gl_buffer_index;
/**
BUFFER_BIT_COLOR6 | \
BUFFER_BIT_COLOR7)
+/* Mask of bits for depth+stencil buffers */
+#define BUFFER_BITS_DEPTH_STENCIL (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)
+
/**
* Framebuffer configuration (aka visual / pixelformat)
* Note: some of these fields should be boolean, but it appears that
};
+/**
+ * Compressed fog mode.
+ */
+enum gl_fog_mode
+{
+ FOG_NONE,
+ FOG_LINEAR,
+ FOG_EXP,
+ FOG_EXP2,
+};
+
+
/**
* Fog attribute group (GL_FOG_BIT).
*/
{
GLboolean Enabled; /**< Fog enabled flag */
GLboolean ColorSumEnabled;
+ uint8_t _PackedMode; /**< Fog mode as 2 bits */
+ uint8_t _PackedEnabledMode; /**< Masked CompressedMode */
GLfloat ColorUnclamped[4]; /**< Fog color */
GLfloat Color[4]; /**< Fog color */
GLfloat Density; /**< Density >= 0.0 */
/* ARB_texture_multisample / GL3.2 additions */
GLboolean SampleMask;
- GLfloat SampleCoverageValue;
- GLfloat MinSampleShadingValue;
+ GLfloat SampleCoverageValue; /**< In range [0, 1] */
+ GLfloat MinSampleShadingValue; /**< In range [0, 1] */
/** The GL spec defines this as an array but >32x MSAA is madness */
GLbitfield SampleMaskValue;
GLenum FrontFace; /**< Either GL_CW or GL_CCW */
GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
- GLboolean _FrontBit; /**< 0=GL_CCW, 1=GL_CW */
GLboolean CullFlag; /**< Culling on/off flag */
GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */
GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */
GLboolean Enabled; /**< Enabled flag */
GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */
GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 2) */
- GLboolean _Enabled; /**< Enabled and stencil buffer present */
- GLboolean _WriteEnabled; /**< _Enabled and non-zero writemasks */
- GLboolean _TestTwoSide;
GLubyte _BackFace; /**< Current back stencil state (1 or 2) */
GLenum Function[3]; /**< Stencil function */
GLenum FailFunc[3]; /**< Fail function */
*/
struct gl_sampler_object
{
- mtx_t Mutex;
+ simple_mtx_t Mutex;
GLuint Name;
GLint RefCount;
GLchar *Label; /**< GL_KHR_debug */
GLenum CompareFunc; /**< GL_ARB_shadow */
GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
+
+ /** GL_ARB_bindless_texture */
+ bool HandleAllocated;
+ struct util_dynarray Handles;
};
*/
struct gl_texture_object
{
- mtx_t Mutex; /**< for thread safety */
+ simple_mtx_t Mutex; /**< for thread safety */
GLint RefCount; /**< reference count */
GLuint Name; /**< the user-visible texture object ID */
GLchar *Label; /**< GL_KHR_debug */
struct gl_sampler_object Sampler;
GLenum DepthMode; /**< GL_ARB_depth_texture */
- bool StencilSampling; /**< Should we sample stencil instead of depth? */
GLfloat Priority; /**< in [0,1] */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
GLboolean Immutable; /**< GL_ARB_texture_storage */
GLboolean _IsFloat; /**< GL_OES_float_texture */
GLboolean _IsHalfFloat; /**< GL_OES_half_float_texture */
+ 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_EXT_memory_object */
+ GLenum 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 */
GLenum ImageFormatCompatibilityType;
+
+ /** GL_ARB_bindless_texture */
+ struct util_dynarray SamplerHandles;
+ struct util_dynarray ImageHandles;
};
};
+/** Compressed TexEnv effective Combine mode */
+enum gl_tex_env_mode
+{
+ TEXENV_MODE_REPLACE, /* r = a0 */
+ TEXENV_MODE_MODULATE, /* r = a0 * a1 */
+ TEXENV_MODE_ADD, /* r = a0 + a1 */
+ TEXENV_MODE_ADD_SIGNED, /* r = a0 + a1 - 0.5 */
+ TEXENV_MODE_INTERPOLATE, /* r = a0 * a2 + a1 * (1 - a2) */
+ TEXENV_MODE_SUBTRACT, /* r = a0 - a1 */
+ TEXENV_MODE_DOT3_RGB, /* r = a0 . a1 */
+ TEXENV_MODE_DOT3_RGB_EXT, /* r = a0 . a1 */
+ TEXENV_MODE_DOT3_RGBA, /* r = a0 . a1 */
+ TEXENV_MODE_DOT3_RGBA_EXT, /* r = a0 . a1 */
+ TEXENV_MODE_MODULATE_ADD_ATI, /* r = a0 * a2 + a1 */
+ TEXENV_MODE_MODULATE_SIGNED_ADD_ATI, /* r = a0 * a2 + a1 - 0.5 */
+ TEXENV_MODE_MODULATE_SUBTRACT_ATI, /* r = a0 * a2 - a1 */
+ TEXENV_MODE_ADD_PRODUCTS_NV, /* r = a0 * a1 + a2 * a3 */
+ TEXENV_MODE_ADD_PRODUCTS_SIGNED_NV, /* r = a0 * a1 + a2 * a3 - 0.5 */
+};
+
+
+/** Compressed TexEnv Combine source */
+enum gl_tex_env_source
+{
+ TEXENV_SRC_TEXTURE0,
+ TEXENV_SRC_TEXTURE1,
+ TEXENV_SRC_TEXTURE2,
+ TEXENV_SRC_TEXTURE3,
+ TEXENV_SRC_TEXTURE4,
+ TEXENV_SRC_TEXTURE5,
+ TEXENV_SRC_TEXTURE6,
+ TEXENV_SRC_TEXTURE7,
+ TEXENV_SRC_TEXTURE,
+ TEXENV_SRC_PREVIOUS,
+ TEXENV_SRC_PRIMARY_COLOR,
+ TEXENV_SRC_CONSTANT,
+ TEXENV_SRC_ZERO,
+ TEXENV_SRC_ONE,
+};
+
+
+/** Compressed TexEnv Combine operand */
+enum gl_tex_env_operand
+{
+ TEXENV_OPR_COLOR,
+ TEXENV_OPR_ONE_MINUS_COLOR,
+ TEXENV_OPR_ALPHA,
+ TEXENV_OPR_ONE_MINUS_ALPHA,
+};
+
+
+/** Compressed TexEnv Combine argument */
+struct gl_tex_env_argument
+{
+#ifdef __GNUC__
+ __extension__ uint8_t Source:4; /**< TEXENV_SRC_x */
+ __extension__ uint8_t Operand:2; /**< TEXENV_OPR_x */
+#else
+ uint8_t Source; /**< SRC_x */
+ uint8_t Operand; /**< OPR_x */
+#endif
+};
+
+
+/***
+ * Compressed TexEnv Combine state.
+ */
+struct gl_tex_env_combine_packed
+{
+ uint32_t ModeRGB:4; /**< Effective mode for RGB as 4 bits */
+ uint32_t ModeA:4; /**< Effective mode for RGB as 4 bits */
+ uint32_t ScaleShiftRGB:2; /**< 0, 1 or 2 */
+ uint32_t ScaleShiftA:2; /**< 0, 1 or 2 */
+ uint32_t NumArgsRGB:3; /**< Number of inputs used for the RGB combiner */
+ uint32_t NumArgsA:3; /**< Number of inputs used for the A combiner */
+ /** Source arguments in a packed manner */
+ struct gl_tex_env_argument ArgsRGB[MAX_COMBINER_TERMS];
+ struct gl_tex_env_argument ArgsA[MAX_COMBINER_TERMS];
+};
+
+
/**
* TexGenEnabled flags.
*/
/** Points to highest priority, complete and enabled texture object */
struct gl_texture_object *_Current;
+ /** Current compressed TexEnv & Combine state */
+ struct gl_tex_env_combine_packed _CurrentCombinePacked;
};
*/
struct gl_buffer_object
{
- mtx_t Mutex;
+ simple_mtx_t Mutex;
GLint RefCount;
GLuint Name;
GLchar *Label; /**< GL_KHR_debug */
unsigned MinMaxCacheHitIndices;
unsigned MinMaxCacheMissIndices;
bool MinMaxCacheDirty;
+
+ bool HandleAllocated; /**< GL_ARB_bindless_texture */
};
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 */
+ GLbitfield _BoundArrays; /**< Arrays bound to this binding point */
};
/**
- * A representation of "Vertex Array Objects" (VAOs) from OpenGL 3.1+,
- * GL_ARB_vertex_array_object, or the original GL_APPLE_vertex_array_object
- * extension.
+ * A representation of "Vertex Array Objects" (VAOs) from OpenGL 3.1+ /
+ * the GL_ARB_vertex_array_object extension.
*/
struct gl_vertex_array_object
{
GLchar *Label; /**< GL_KHR_debug */
- mtx_t Mutex;
-
- /**
- * Does the VAO use ARB semantics or Apple semantics?
- *
- * There are several ways in which ARB_vertex_array_object and
- * APPLE_vertex_array_object VAOs have differing semantics. At the very
- * least,
- *
- * - ARB VAOs require that all array data be sourced from vertex buffer
- * objects, but Apple VAOs do not.
- *
- * - ARB VAOs require that names come from GenVertexArrays.
- *
- * This flag notes which behavior governs this VAO.
- */
- GLboolean ARBsemantics;
-
/**
* Has this array object been bound?
*/
struct gl_vertex_buffer_binding BufferBinding[VERT_ATTRIB_MAX];
/** Mask indicating which vertex arrays have vertex buffer associated. */
- GLbitfield64 VertexAttribBufferMask;
+ GLbitfield VertexAttribBufferMask;
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
- GLbitfield64 _Enabled;
+ GLbitfield _Enabled;
/** Mask of VERT_BIT_* values indicating changed/dirty arrays */
- GLbitfield64 NewArrays;
+ GLbitfield NewArrays;
/** The index buffer (also known as the element array buffer in OpenGL). */
struct gl_buffer_object *IndexBufferObj;
*/
struct gl_array_attrib
{
- /** Currently bound array object. See _mesa_BindVertexArrayAPPLE() */
+ /** Currently bound array object. */
struct gl_vertex_array_object *VAO;
/** The default vertex array object */
/** The last VAO accessed by a DSA function */
struct gl_vertex_array_object *LastLookedUpVAO;
- /** Array objects (GL_ARB/APPLE_vertex_array_object) */
+ /** Array objects (GL_ARB_vertex_array_object) */
struct _mesa_HashTable *Objects;
GLint ActiveTexture; /**< Client Active Texture */
/** 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. */
};
+/**
+ * A bindless sampler object.
+ */
+struct gl_bindless_sampler
+{
+ /** Texture unit (set by glUniform1()). */
+ GLubyte unit;
+
+ /** Whether this bindless sampler is bound to a unit. */
+ GLboolean bound;
+
+ /** Texture Target (TEXTURE_1D/2D/3D/etc_INDEX). */
+ gl_texture_index target;
+
+ /** Pointer to the base of the data. */
+ GLvoid *data;
+};
+
+/**
+ * A bindless image object.
+ */
+struct gl_bindless_image
+{
+ /** Image unit (set by glUniform1()). */
+ GLubyte unit;
+
+ /** Whether this bindless image is bound to a unit. */
+ GLboolean bound;
+
+ /** Access qualifier (GL_READ_WRITE, GL_READ_ONLY, GL_WRITE_ONLY) */
+ GLenum access;
+
+ /** Pointer to the base of the data. */
+ GLvoid *data;
+};
+
/**
* Names of the various vertex/fragment program register files, etc.
*
PROGRAM_BUFFER, /**< for shader buffers, compile-time only */
PROGRAM_MEMORY, /**< for shared, global and local memory */
PROGRAM_IMAGE, /**< for shader images, compile-time only */
+ PROGRAM_HW_ATOMIC, /**< for hw atomic counters, compile-time only */
PROGRAM_FILE_MAX
} gl_register_file;
/** FIXME: This must be first until we split shader_info from nir_shader */
struct shader_info info;
- mtx_t Mutex;
GLuint Id;
GLint RefCount;
GLubyte *String; /**< Null-terminated program text */
struct nir_shader *nir;
+ /* Saved and restored with metadata. Freed with ralloc. */
+ void *driver_cache_blob;
+ size_t driver_cache_blob_size;
+
bool is_arb_asm; /** Is this an ARB assembly-style program */
/** Is this program written to on disk shader cache */
*/
gl_texture_index SamplerTargets[MAX_SAMPLERS];
+ /**
+ * Number of samplers declared with the bindless_sampler layout
+ * qualifier as specified by ARB_bindless_texture.
+ */
+ GLuint NumBindlessSamplers;
+ GLboolean HasBoundBindlessSampler;
+ struct gl_bindless_sampler *BindlessSamplers;
+
+ /**
+ * Number of images declared with the bindless_image layout qualifier
+ * as specified by ARB_bindless_texture.
+ */
+ GLuint NumBindlessImages;
+ GLboolean HasBoundBindlessImage;
+ struct gl_bindless_image *BindlessImages;
+
union {
struct {
/**
struct gl_vertex_program_state
{
GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
- GLboolean _Enabled; /**< Enabled and _valid_ user program? */
GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
- /** Computed two sided lighting for fixed function/programs. */
- GLboolean _TwoSideEnabled;
+ /** Should fixed-function T&L be implemented with a vertex prog? */
+ GLboolean _MaintainTnlProgram;
+
struct gl_program *Current; /**< User-bound vertex program */
/** Currently enabled and valid vertex program (including internal
GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
- /** Should fixed-function T&L be implemented with a vertex prog? */
- GLboolean _MaintainTnlProgram;
-
/** Program to emulate fixed-function T&L (see above) */
struct gl_program *_TnlProgram;
struct gl_fragment_program_state
{
GLboolean Enabled; /**< User-set fragment program enable flag */
- GLboolean _Enabled; /**< Enabled and _valid_ user program? */
+ /** Should fixed-function texturing be implemented with a fragment prog? */
+ GLboolean _MaintainTexEnvProgram;
+
struct gl_program *Current; /**< User-bound fragment program */
/** Currently enabled and valid fragment program (including internal
GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
- /** Should fixed-function texturing be implemented with a fragment prog? */
- GLboolean _MaintainTexEnvProgram;
-
/** Program to emulate fixed-function texture env/combine (see above) */
struct gl_program *_TexEnvProgram;
GLubyte numArithInstr[2];
GLubyte regsAssigned[2];
GLubyte NumPasses; /**< 1 or 2 */
+ /** Current compile stage: 0 setup pass1, 1 arith pass1, 2 setup pass2, 3 arith pass2 */
GLubyte cur_pass;
GLubyte last_optype;
GLboolean interpinp1;
GLboolean isValid;
+ /** Array of 2 bit values for each tex unit to remember whether
+ * STR or STQ swizzle was used
+ */
GLuint swizzlerq;
struct gl_program *Program;
};
struct gl_ati_fragment_shader_state
{
GLboolean Enabled;
- GLboolean _Enabled; /**< enabled and valid shader? */
GLboolean Compiling;
GLfloat GlobalConstants[8][4];
struct ati_fragment_shader *Current;
struct glsl_symbol_table *symbols;
};
-static inline GLbitfield gl_external_samplers(struct gl_program *prog)
+
+static inline GLbitfield
+gl_external_samplers(const struct gl_program *prog)
{
GLbitfield external_samplers = 0;
GLbitfield mask = prog->SamplersUsed;
return external_samplers;
}
+
/**
* Compile status enum. compile_skipped is used to indicate the compile
* was skipped due to the shader matching one that's been seen before by
{
compile_failure = 0,
compile_success,
- compile_skipped
+ compile_skipped,
+ compiled_no_opts
};
/**
GLchar *Label; /**< GL_KHR_debug */
unsigned char sha1[20]; /**< SHA1 hash of pre-processed source */
GLboolean DeletePending;
- enum gl_compile_status CompileStatus;
bool IsES; /**< True if this shader uses GLSL ES */
+ enum gl_compile_status CompileStatus;
+
#ifdef DEBUG
unsigned SourceChecksum; /**< for debug/logging purposes */
#endif
unsigned Version; /**< GLSL version used for linking */
- struct exec_list *ir;
- struct glsl_symbol_table *symbols;
-
/**
* A bitmask of gl_advanced_blend_mode values
*/
GLbitfield BlendSupport;
+ struct exec_list *ir;
+ struct glsl_symbol_table *symbols;
+
/**
* Whether early fragment tests are enabled as defined by
* ARB_shader_image_load_store.
bool origin_upper_left;
bool pixel_center_integer;
+ /**
+ * Whether bindless_sampler/bindless_image, and respectively
+ * bound_sampler/bound_image are declared at global scope as defined by
+ * ARB_bindless_texture.
+ */
+ bool bindless_sampler;
+ bool bindless_image;
+ bool bound_sampler;
+ bool bound_image;
+
/** Global xfb_stride out qualifier if any */
GLuint TransformFeedbackBufferStride[MAX_FEEDBACK_BUFFERS];
struct gl_shader_info info;
+
+ /* ARB_gl_spirv related data */
+ struct gl_shader_spirv_data *spirv_data;
};
};
-enum gl_uniform_block_packing
-{
- ubo_packing_std140,
- ubo_packing_shared,
- ubo_packing_packed,
- ubo_packing_std430
-};
-
-
struct gl_uniform_block
{
/** Declared name of the uniform block */
/**
* Index (GL_UNIFORM_BLOCK_BINDING) into ctx->UniformBufferBindings[] to use
- * with glBindBufferBase to bind a buffer object to this uniform block. When
- * updated in the program, _NEW_BUFFER_OBJECT will be set.
+ * with glBindBufferBase to bind a buffer object to this uniform block.
*/
GLuint Binding;
* This isn't accessible through the API, but it is used while
* cross-validating uniform blocks.
*/
- enum gl_uniform_block_packing _Packing;
+ enum glsl_interface_packing _Packing;
GLboolean _RowMajor;
};
struct gl_uniform_storage *UniformStorage;
unsigned NumUniformBlocks;
- struct gl_uniform_block *UniformBlocks;
-
unsigned NumShaderStorageBlocks;
+
+ struct gl_uniform_block *UniformBlocks;
struct gl_uniform_block *ShaderStorageBlocks;
struct gl_active_atomic_buffer *AtomicBuffers;
unsigned NumUniformDataSlots;
union gl_constant_value *UniformDataSlots;
- bool cache_fallback;
+ /* Used to hold initial uniform values for program binary restores.
+ *
+ * From the ARB_get_program_binary spec:
+ *
+ * "A successful call to ProgramBinary will reset all uniform
+ * variables to their initial values. The initial value is either
+ * the value of the variable's initializer as specified in the
+ * original shader source, or 0 if no initializer was present.
+ */
+ union gl_constant_value *UniformDataDefaults;
+
+ GLboolean Validated;
/** List of all active resources after linking. */
struct gl_program_resource *ProgramResourceList;
unsigned NumProgramResourceList;
enum gl_link_status LinkStatus; /**< GL_LINK_STATUS */
- GLboolean Validated;
GLchar *InfoLog;
unsigned Version; /**< GLSL version used for linking */
#define GLSL_REPORT_ERRORS 0x40 /**< Print compilation errors */
#define GLSL_DUMP_ON_ERROR 0x80 /**< Dump shaders to stderr on compile error */
#define GLSL_CACHE_INFO 0x100 /**< Print debug information about shader cache */
+#define GLSL_CACHE_FALLBACK 0x200 /**< Force shader cache fallback paths */
/**
GLint RefCount;
- mtx_t Mutex;
-
GLchar *Label; /**< GL_KHR_debug */
/**
struct gl_shader_program *ReferencedPrograms[MESA_SHADER_STAGES];
- struct gl_program *_CurrentFragmentProgram;
-
/**
* Program used by glUniform calls.
*
{
/** Driver-selectable options: */
GLboolean EmitNoLoops;
- GLboolean EmitNoFunctions;
GLboolean EmitNoCont; /**< Emit CONT opcode? */
GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */
GLboolean EmitNoPow; /**< Emit POW opcodes? */
/** Sync object state */
struct gl_sync_object
{
- GLenum Type; /**< GL_SYNC_FENCE */
GLuint Name; /**< Fence name */
- GLchar *Label; /**< GL_KHR_debug */
GLint RefCount; /**< Reference count */
+ GLchar *Label; /**< GL_KHR_debug */
GLboolean DeletePending; /**< Object was deleted while there were still
* live references (e.g., sync not yet finished)
*/
*/
struct gl_shared_state
{
- mtx_t Mutex; /**< for thread safety */
+ simple_mtx_t Mutex; /**< for thread safety */
GLint RefCount; /**< Reference count */
struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
struct _mesa_HashTable *BitmapAtlas; /**< For optimized glBitmap text */
/** GL_ARB_sampler_objects */
struct _mesa_HashTable *SamplerObjects;
+ /* GL_ARB_bindless_texture */
+ struct hash_table_u64 *TextureHandles;
+ struct hash_table_u64 *ImageHandles;
+ mtx_t HandlesMutex; /**< For texture/image handles safety */
+
/**
* Some context in this share group was affected by a GPU reset
*
* Once this field becomes true, it is never reset to false.
*/
bool ShareGroupReset;
+
+ /** EXT_external_objects */
+ struct _mesa_HashTable *MemoryObjects;
+
+ /**
+ * Some context in this share group was affected by a disjoint
+ * operation. This operation can be anything that has effects on
+ * values of timer queries in such manner that they become invalid for
+ * performance metrics. As example gpu reset, counter overflow or gpu
+ * frequency changes.
+ */
+ bool DisjointOperation;
};
*/
struct gl_renderbuffer
{
- mtx_t Mutex; /**< for thread safety */
+ simple_mtx_t Mutex; /**< for thread safety */
GLuint ClassID; /**< Useful for drivers */
GLuint Name;
GLchar *Label; /**< GL_KHR_debug */
* called without a rb->TexImage.
*/
GLboolean NeedsFinishRenderTexture;
- GLubyte NumSamples;
+ GLubyte NumSamples; /**< zero means not multisampled */
GLenum InternalFormat; /**< The user-specified format */
GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
GL_STENCIL_INDEX. */
*/
struct gl_framebuffer
{
- mtx_t Mutex; /**< for thread safety */
+ simple_mtx_t Mutex; /**< for thread safety */
/**
* If zero, this is a window system framebuffer. If non-zero, this
* is a FBO framebuffer; note that for some devices (i.e. those with
/** Computed from ColorDraw/ReadBuffer above */
GLuint _NumColorDrawBuffers;
- GLint _ColorDrawBufferIndexes[MAX_DRAW_BUFFERS]; /**< BUFFER_x or -1 */
- GLint _ColorReadBufferIndex; /* -1 = None */
+ gl_buffer_index _ColorDrawBufferIndexes[MAX_DRAW_BUFFERS];
+ gl_buffer_index _ColorReadBufferIndex;
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
struct gl_renderbuffer *_ColorReadBuffer;
GLuint MaxShaderStorageBlocks;
};
-
/**
* Constants which may be overridden by device driver during context creation
* but are never changed after that.
*/
GLboolean AllowGLSLExtensionDirectiveMidShader;
+ /**
+ * Allow GLSL built-in variables to be redeclared verbatim
+ */
+ GLboolean AllowGLSLBuiltinVariableRedeclaration;
+
+ /**
+ * Allow GLSL interpolation qualifier mismatch across shader stages.
+ */
+ GLboolean AllowGLSLCrossStageInterpolationMismatch;
+
/**
* Allow creating a higher compat profile (version 3.1+) for apps that
* request it. Be careful when adding that driconf option because some
*/
GLboolean DisableVaryingPacking;
+ /**
+ * UBOs and SSBOs can be packed tightly by the OpenGL implementation when
+ * layout is set as shared (the default) or packed. However most Mesa drivers
+ * just use STD140 for these layouts. This flag allows drivers to use STD430
+ * for packed and shared layouts which allows arrays to be packed more
+ * tightly.
+ */
+ bool UseSTD430AsDefaultPacking;
+
/**
* Should meaningful names be generated for compiler temporary variables?
*
GLuint MaxTessPatchComponents;
GLuint MaxTessControlTotalOutputComponents;
bool LowerTessLevel; /**< Lower gl_TessLevel* from float[n] to vecn? */
- bool LowerTCSPatchVerticesIn; /**< Lower gl_PatchVerticesIn to a uniform */
- bool LowerTESPatchVerticesIn; /**< Lower gl_PatchVerticesIn to a uniform */
bool PrimitiveRestartForPatches;
bool LowerCsDerivedVariables; /**< Lower gl_GlobalInvocationID and
* gl_LocalInvocationIndex based on
/** GL_OES_primitive_bounding_box */
bool NoPrimitiveBoundingBoxOutput;
+ /** GL_ARB_sparse_buffer */
+ GLuint SparseBufferPageSize;
+
/** Used as an input for sha1 generation in the on-disk shader cache */
unsigned char *dri_config_options_sha1;
+
+ /** When drivers are OK with mapped buffers during draw and other calls. */
+ bool AllowMappedBuffersDuringExecution;
+
+ /** GL_ARB_get_program_binary */
+ GLuint NumProgramBinaryFormats;
};
GLboolean ARB_ES3_2_compatibility;
GLboolean ARB_arrays_of_arrays;
GLboolean ARB_base_instance;
+ GLboolean ARB_bindless_texture;
GLboolean ARB_blend_func_extended;
GLboolean ARB_buffer_storage;
GLboolean ARB_clear_texture;
GLboolean ARB_enhanced_layouts;
GLboolean ARB_explicit_attrib_location;
GLboolean ARB_explicit_uniform_location;
+ GLboolean ARB_gl_spirv;
GLboolean ARB_gpu_shader5;
GLboolean ARB_gpu_shader_fp64;
GLboolean ARB_gpu_shader_int64;
GLboolean ARB_occlusion_query2;
GLboolean ARB_pipeline_statistics_query;
GLboolean ARB_point_sprite;
+ GLboolean ARB_polygon_offset_clamp;
GLboolean ARB_post_depth_coverage;
GLboolean ARB_query_buffer_object;
GLboolean ARB_robust_buffer_access_behavior;
GLboolean ARB_seamless_cube_map;
GLboolean ARB_shader_atomic_counter_ops;
GLboolean ARB_shader_atomic_counters;
+ GLboolean ARB_shader_ballot;
GLboolean ARB_shader_bit_encoding;
GLboolean ARB_shader_clock;
GLboolean ARB_shader_draw_parameters;
GLboolean ARB_shader_precision;
GLboolean ARB_shader_stencil_export;
GLboolean ARB_shader_storage_buffer_object;
- GLboolean ARB_shader_subroutine;
GLboolean ARB_shader_texture_image_samples;
GLboolean ARB_shader_texture_lod;
GLboolean ARB_shader_viewport_layer_array;
GLboolean ARB_shading_language_packing;
GLboolean ARB_shading_language_420pack;
GLboolean ARB_shadow;
+ GLboolean ARB_sparse_buffer;
GLboolean ARB_stencil_texturing;
GLboolean ARB_sync;
GLboolean ARB_tessellation_shader;
GLboolean ARB_texture_env_combine;
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
+ GLboolean ARB_texture_filter_anisotropic;
GLboolean ARB_texture_float;
GLboolean ARB_texture_gather;
GLboolean ARB_texture_mirror_clamp_to_edge;
GLboolean EXT_blend_func_separate;
GLboolean EXT_blend_minmax;
GLboolean EXT_depth_bounds_test;
+ GLboolean EXT_disjoint_timer_query;
GLboolean EXT_draw_buffers2;
GLboolean EXT_framebuffer_multisample;
GLboolean EXT_framebuffer_multisample_blit_scaled;
GLboolean EXT_framebuffer_sRGB;
GLboolean EXT_gpu_program_parameters;
GLboolean EXT_gpu_shader4;
+ GLboolean EXT_memory_object;
+ GLboolean EXT_memory_object_fd;
GLboolean EXT_packed_float;
GLboolean EXT_pixel_buffer_object;
GLboolean EXT_point_parameters;
- GLboolean EXT_polygon_offset_clamp;
GLboolean EXT_provoking_vertex;
GLboolean EXT_shader_integer_mix;
GLboolean EXT_shader_samples_identical;
GLboolean EXT_texture_sRGB;
GLboolean EXT_texture_sRGB_decode;
GLboolean EXT_texture_swizzle;
+ GLboolean EXT_texture_type_2_10_10_10_REV;
GLboolean EXT_transform_feedback;
GLboolean EXT_timer_query;
GLboolean EXT_vertex_array_bgra;
GLboolean KHR_texture_compression_astc_hdr;
GLboolean KHR_texture_compression_astc_ldr;
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;
* while meta is in progress.
*/
GLubyte Version;
+ /**
+ * Force-enabled, yet unrecognized, extensions.
+ * See _mesa_one_time_init_extension_overrides()
+ */
+#define MAX_UNRECOGNIZED_EXTENSIONS 16
+ const char *unrecognized_extensions[MAX_UNRECOGNIZED_EXTENSIONS];
};
#define _NEW_TRACK_MATRIX (1u << 25) /**< gl_context::VertexProgram */
#define _NEW_PROGRAM (1u << 26) /**< New program/shader state */
#define _NEW_PROGRAM_CONSTANTS (1u << 27)
-#define _NEW_BUFFER_OBJECT (1u << 28)
+/* gap */
#define _NEW_FRAG_CLAMP (1u << 29)
/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
#define _NEW_VARYING_VP_INPUTS (1u << 31) /**< gl_context::varying_vp_inputs */
struct gl_display_list
{
GLuint Name;
- GLchar *Label; /**< GL_KHR_debug */
GLbitfield Flags; /**< DLIST_x flags */
+ GLchar *Label; /**< GL_KHR_debug */
/** The dlist commands are in a linked list of nodes */
union gl_dlist_node *Head;
};
*/
struct gl_dlist_state
{
- GLuint CallDepth; /**< Current recursion calling depth */
-
struct gl_display_list *CurrentList; /**< List currently being compiled */
union gl_dlist_node *CurrentBlock; /**< Pointer to current block of nodes */
GLuint CurrentPos; /**< Index into current block of nodes */
+ GLuint CallDepth; /**< Current recursion calling depth */
GLvertexformat ListVtxfmt;
/** gl_context::RasterDiscard */
uint64_t NewRasterizerDiscard;
+ /** gl_context::TileRasterOrder* */
+ uint64_t NewTileRasterOrder;
+
/**
* gl_context::UniformBufferBindings
* gl_shader_program::UniformBlocks
* gl_context::IntelConservativeRasterization
*/
uint64_t NewIntelConservativeRasterization;
-};
-struct gl_uniform_buffer_binding
-{
- struct gl_buffer_object *BufferObject;
- /** Start of uniform block data in the buffer */
- GLintptr Offset;
- /** Size of data allowed to be referenced from the buffer (in bytes) */
- GLsizeiptr Size;
/**
- * glBindBufferBase() indicates that the Size should be ignored and only
- * limited by the current size of the BufferObject.
+ * gl_context::Scissor::WindowRects
*/
- GLboolean AutomaticSize;
+ uint64_t NewWindowRectangles;
+
+ /** gl_context::Color::sRGBEnabled */
+ uint64_t NewFramebufferSRGB;
+
+ /** gl_context::Scissor::EnableFlags */
+ uint64_t NewScissorTest;
+
+ /** gl_context::Scissor::ScissorArray */
+ uint64_t NewScissorRect;
+
+ /** gl_context::Color::Alpha* */
+ uint64_t NewAlphaTest;
+
+ /** gl_context::Color::Blend/Dither */
+ uint64_t NewBlend;
+
+ /** gl_context::Color::BlendColor */
+ uint64_t NewBlendColor;
+
+ /** gl_context::Color::Color/Index */
+ uint64_t NewColorMask;
+
+ /** gl_context::Depth */
+ uint64_t NewDepth;
+
+ /** gl_context::Color::LogicOp/ColorLogicOp/IndexLogicOp */
+ uint64_t NewLogicOp;
+
+ /** gl_context::Multisample::Enabled */
+ uint64_t NewMultisampleEnable;
+
+ /** gl_context::Multisample::SampleAlphaTo* */
+ uint64_t NewSampleAlphaToXEnable;
+
+ /** gl_context::Multisample::SampleCoverage/SampleMaskValue */
+ uint64_t NewSampleMask;
+
+ /** gl_context::Multisample::(Min)SampleShading */
+ uint64_t NewSampleShading;
+
+ /** gl_context::Stencil */
+ uint64_t NewStencil;
+
+ /** gl_context::Transform::ClipOrigin/ClipDepthMode */
+ uint64_t NewClipControl;
+
+ /** gl_context::Transform::EyeUserPlane */
+ uint64_t NewClipPlane;
+
+ /** gl_context::Transform::ClipPlanesEnabled */
+ uint64_t NewClipPlaneEnable;
+
+ /** gl_context::Transform::DepthClamp */
+ uint64_t NewDepthClamp;
+
+ /** gl_context::Line */
+ uint64_t NewLineState;
+
+ /** gl_context::Polygon */
+ uint64_t NewPolygonState;
+
+ /** gl_context::PolygonStipple */
+ uint64_t NewPolygonStipple;
+
+ /** gl_context::ViewportArray */
+ uint64_t NewViewport;
+
+ /** Shader constants (uniforms, program parameters, state constants) */
+ uint64_t NewShaderConstants[MESA_SHADER_STAGES];
};
-struct gl_shader_storage_buffer_binding
+struct gl_buffer_binding
{
struct gl_buffer_object *BufferObject;
- /** Start of shader storage block data in the buffer */
+ /** Start of uniform block data in the buffer */
GLintptr Offset;
/** Size of data allowed to be referenced from the buffer (in bytes) */
GLsizeiptr Size;
};
-/**
- * Binding point for an atomic counter buffer object.
- */
-struct gl_atomic_buffer_binding
-{
- struct gl_buffer_object *BufferObject;
- GLintptr Offset;
- GLsizeiptr Size;
-};
-
/**
* Shader subroutines storage
*/
GLuint *IndexPtr;
};
+struct gl_texture_handle_object
+{
+ struct gl_texture_object *texObj;
+ struct gl_sampler_object *sampObj;
+ GLuint64 handle;
+};
+
+struct gl_image_handle_object
+{
+ struct gl_image_unit imgObj;
+ GLuint64 handle;
+};
+
+struct gl_memory_object
+{
+ GLuint Name; /**< hash table ID/name */
+ GLboolean Immutable; /**< denotes mutability state of parameters */
+ GLboolean Dedicated; /**< import memory from a dedicated allocation */
+};
+
/**
* Mesa rendering context.
*
* associated with uniform blocks by glUniformBlockBinding()'s state in the
* shader program.
*/
- struct gl_uniform_buffer_binding
+ struct gl_buffer_binding
UniformBufferBindings[MAX_COMBINED_UNIFORM_BUFFERS];
/**
* glBindBufferBase(). They are associated with shader storage blocks by
* glShaderStorageBlockBinding()'s state in the shader program.
*/
- struct gl_shader_storage_buffer_binding
+ struct gl_buffer_binding
ShaderStorageBufferBindings[MAX_COMBINED_SHADER_STORAGE_BUFFERS];
/**
/**
* Array of atomic counter buffer binding points.
*/
- struct gl_atomic_buffer_binding
+ struct gl_buffer_binding
AtomicBufferBindings[MAX_COMBINED_ATOMIC_BUFFERS];
/**
GLuint ErrorDebugCount;
/* GL_ARB_debug_output/GL_KHR_debug */
- mtx_t DebugMutex;
+ simple_mtx_t DebugMutex;
struct gl_debug_state *Debug;
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLboolean ViewportInitialized; /**< has viewport size been initialized? */
- GLbitfield64 varying_vp_inputs; /**< mask of VERT_BIT_* flags */
+ GLbitfield varying_vp_inputs; /**< mask of VERT_BIT_* flags */
/** \name Derived state */
GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */
GLfloat _EyeZDir[3];
- GLfloat _ModelViewInvScale;
+ GLfloat _ModelViewInvScale; /* may be for model- or eyespace lighting */
+ GLfloat _ModelViewInvScaleEyespace; /* always factor defined in spec */
GLboolean _NeedEyeCoords;
GLboolean _ForceEyeCoords;
*/
GLboolean HasConfig;
- /** software compression/decompression supported or not */
- GLboolean Mesa_DXTn;
-
GLboolean TextureFormatSupported[MESA_FORMAT_COUNT];
GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
GLboolean IntelConservativeRasterization; /**< GL_INTEL_CONSERVATIVE_RASTERIZATION */
+ /** Does glVertexAttrib(0) alias glVertex()? */
+ bool _AttribZeroAliasesVertex;
+
+ /**
+ * When set, TileRasterOrderIncreasingX/Y control the order that a tiled
+ * renderer's tiles should be excecuted, to meet the requirements of
+ * GL_MESA_tile_raster_order.
+ */
+ GLboolean TileRasterOrderFixed;
+ GLboolean TileRasterOrderIncreasingX;
+ GLboolean TileRasterOrderIncreasingY;
+
/**
* \name Hooks for module contexts.
*
GLfloat PrimitiveBoundingBox[8];
struct disk_cache *Cache;
+
+ /**
+ * \name GL_ARB_bindless_texture
+ */
+ /*@{*/
+ struct hash_table_u64 *ResidentTextureHandles;
+ struct hash_table_u64 *ResidentImageHandles;
+ /*@}*/
};
/**