#include "compiler/shader_info.h"
#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"
struct gl_uniform_storage;
struct prog_instruction;
struct gl_program_parameter_list;
+struct gl_shader_spirv_data;
struct set;
struct vbo_context;
/*@}*/
/* ARB_multisample / SGIS_multisample */
GLint sampleBuffers;
- GLint samples;
+ GLuint samples;
/* SGIX_pbuffer / GLX 1.3 */
GLint maxPbufferWidth;
* \name Bit flags used for updating material values.
*/
/*@{*/
-#define MAT_ATTRIB_FRONT_AMBIENT 0
+#define MAT_ATTRIB_FRONT_AMBIENT 0
#define MAT_ATTRIB_BACK_AMBIENT 1
-#define MAT_ATTRIB_FRONT_DIFFUSE 2
+#define MAT_ATTRIB_FRONT_DIFFUSE 2
#define MAT_ATTRIB_BACK_DIFFUSE 3
-#define MAT_ATTRIB_FRONT_SPECULAR 4
+#define MAT_ATTRIB_FRONT_SPECULAR 4
#define MAT_ATTRIB_BACK_SPECULAR 5
#define MAT_ATTRIB_FRONT_EMISSION 6
#define MAT_ATTRIB_BACK_EMISSION 7
#define MAT_ATTRIB_BACK_INDEXES 11
#define MAT_ATTRIB_MAX 12
-#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f))
-#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f))
-#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f))
-#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f))
+#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f))
+#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f))
+#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f))
+#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f))
#define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f))
-#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f))
-
-#define MAT_INDEX_AMBIENT 0
-#define MAT_INDEX_DIFFUSE 1
-#define MAT_INDEX_SPECULAR 2
+#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f))
#define MAT_BIT_FRONT_AMBIENT (1<<MAT_ATTRIB_FRONT_AMBIENT)
#define MAT_BIT_BACK_AMBIENT (1<<MAT_ATTRIB_BACK_AMBIENT)
#define MAT_BIT_BACK_INDEXES (1<<MAT_ATTRIB_BACK_INDEXES)
-#define FRONT_MATERIAL_BITS (MAT_BIT_FRONT_EMISSION | \
- MAT_BIT_FRONT_AMBIENT | \
- MAT_BIT_FRONT_DIFFUSE | \
- MAT_BIT_FRONT_SPECULAR | \
- MAT_BIT_FRONT_SHININESS | \
- MAT_BIT_FRONT_INDEXES)
+#define FRONT_MATERIAL_BITS (MAT_BIT_FRONT_EMISSION | \
+ MAT_BIT_FRONT_AMBIENT | \
+ MAT_BIT_FRONT_DIFFUSE | \
+ MAT_BIT_FRONT_SPECULAR | \
+ MAT_BIT_FRONT_SHININESS | \
+ MAT_BIT_FRONT_INDEXES)
-#define BACK_MATERIAL_BITS (MAT_BIT_BACK_EMISSION | \
- MAT_BIT_BACK_AMBIENT | \
- MAT_BIT_BACK_DIFFUSE | \
- MAT_BIT_BACK_SPECULAR | \
- MAT_BIT_BACK_SHININESS | \
- MAT_BIT_BACK_INDEXES)
+#define BACK_MATERIAL_BITS (MAT_BIT_BACK_EMISSION | \
+ MAT_BIT_BACK_AMBIENT | \
+ MAT_BIT_BACK_DIFFUSE | \
+ MAT_BIT_BACK_SPECULAR | \
+ MAT_BIT_BACK_SHININESS | \
+ MAT_BIT_BACK_INDEXES)
-#define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
+#define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
/*@}*/
GLfloat QuadraticAttenuation;
GLboolean Enabled; /**< On/off flag */
- /**
+ /**
* \name Derived fields
*/
/*@{*/
GLboolean LocalViewer; /**< Local (or infinite) view point? */
GLboolean TwoSide; /**< Two (or one) sided lighting? */
GLenum ColorControl; /**< either GL_SINGLE_COLOR
- * or GL_SEPARATE_SPECULAR_COLOR */
+ or GL_SEPARATE_SPECULAR_COLOR */
};
GLuint ui[4];
};
+/**
+ * Remapped color logical operations
+ *
+ * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants
+ * directly, everything wants this mapping of color logical operations.
+ *
+ * Fun fact: These values are just the bit-reverse of the low-nibble of the GL
+ * enumerant values (i.e., `GL_NOOP & 0x0f` is `b0101' while
+ * \c COLOR_LOGICOP_NOOP is `b1010`).
+ *
+ * Fun fact #2: These values are just an encoding of the operation as a table
+ * of bit values. The result of the logic op is:
+ *
+ * result_bit = (logic_op >> (2 * src_bit + dst_bit)) & 1
+ *
+ * For the GL enums, the result is:
+ *
+ * result_bit = logic_op & (1 << (2 * src_bit + dst_bit))
+ */
+enum PACKED gl_logicop_mode {
+ COLOR_LOGICOP_CLEAR = 0,
+ COLOR_LOGICOP_NOR = 1,
+ COLOR_LOGICOP_AND_INVERTED = 2,
+ COLOR_LOGICOP_COPY_INVERTED = 3,
+ COLOR_LOGICOP_AND_REVERSE = 4,
+ COLOR_LOGICOP_INVERT = 5,
+ COLOR_LOGICOP_XOR = 6,
+ COLOR_LOGICOP_NAND = 7,
+ COLOR_LOGICOP_AND = 8,
+ COLOR_LOGICOP_EQUIV = 9,
+ COLOR_LOGICOP_NOOP = 10,
+ COLOR_LOGICOP_OR_INVERTED = 11,
+ COLOR_LOGICOP_COPY = 12,
+ COLOR_LOGICOP_OR_REVERSE = 13,
+ COLOR_LOGICOP_OR = 14,
+ COLOR_LOGICOP_SET = 15
+};
/**
* Color buffer attribute group (GL_COLOR_BUFFER_BIT).
GLenum DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */
- /**
+ /**
* \name alpha testing
*/
/*@{*/
GLclampf AlphaRef; /**< Alpha reference value */
/*@}*/
- /**
+ /**
* \name Blending
*/
/*@{*/
bool BlendCoherent;
/*@}*/
- /**
+ /**
* \name Logic op
*/
/*@{*/
GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */
GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */
GLenum LogicOp; /**< Logic operator */
+ enum gl_logicop_mode _LogicOp;
/*@}*/
/**
* \name Current vertex attributes (color, texcoords, etc).
* \note Values are valid only after FLUSH_VERTICES has been called.
- * \note Index and Edgeflag current values are stored as floats in the
+ * \note Index and Edgeflag current values are stored as floats in the
* SIX and SEVEN attribute slots.
* \note We need double storage for 64-bit vertex attributes
*/
struct gl_eval_attrib
{
/**
- * \name Enable bits
+ * \name Enable bits
*/
/*@{*/
GLboolean Map1Color4;
GLboolean Map2Vertex4;
GLboolean AutoNormal;
/*@}*/
-
+
/**
* \name Map Grid endpoints and divisions and calculated du values
*/
};
-/**
+/**
* Hint attribute group (GL_HINT_BIT).
- *
+ *
* Values are always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE.
*/
struct gl_hint_attrib
GLboolean _ClampVertexColor;
GLenum ClampVertexColor; /**< GL_TRUE, GL_FALSE, GL_FIXED_ONLY */
- /**
- * Derived state for optimizations:
+ /**
+ * Derived state for optimizations:
*/
/*@{*/
GLbitfield _EnabledLights; /**< bitmask containing enabled lights */
- GLboolean _NeedEyeCoords;
+ GLboolean _NeedEyeCoords;
GLboolean _NeedVertices; /**< Use fast shader? */
GLfloat _BaseColor[2][3];
GLint X, Y; /**< Lower left corner of box */
GLsizei Width, Height; /**< Size of box */
};
+
+
struct gl_scissor_attrib
{
GLbitfield EnableFlags; /**< Scissor test enabled? */
#define TEXGEN_REFLECTION_MAP_NV 0x8
#define TEXGEN_NORMAL_MAP_NV 0x10
-#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
- TEXGEN_REFLECTION_MAP_NV | \
- TEXGEN_NORMAL_MAP_NV)
-#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
- TEXGEN_REFLECTION_MAP_NV | \
- TEXGEN_NORMAL_MAP_NV | \
- TEXGEN_EYE_LINEAR)
+#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV | \
+ TEXGEN_NORMAL_MAP_NV)
+#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV | \
+ TEXGEN_NORMAL_MAP_NV | \
+ TEXGEN_EYE_LINEAR)
/*@}*/
/** Current sampler object (GL_ARB_sampler_objects) */
struct gl_sampler_object *Sampler;
- /**
- * \name GL_EXT_texture_env_combine
+ /**
+ * \name GL_EXT_texture_env_combine
*/
struct gl_tex_env_combine_state Combine;
};
-typedef enum {
+typedef enum
+{
MAP_USER,
MAP_INTERNAL,
-
MAP_COUNT
} gl_map_buffer_index;
/**
* Fields describing a mapped buffer range.
*/
-struct gl_buffer_mapping {
+struct gl_buffer_mapping
+{
GLbitfield AccessFlags; /**< Mask of GL_MAP_x_BIT flags */
GLvoid *Pointer; /**< User-space address of mapping */
GLintptr Offset; /**< Mapped offset */
/**
* Usages we've seen for a buffer object.
*/
-typedef enum {
+typedef enum
+{
USAGE_UNIFORM_BUFFER = 0x1,
USAGE_TEXTURE_BUFFER = 0x2,
USAGE_ATOMIC_COUNTER_BUFFER = 0x4,
/**
* Derived vertex attribute arrays
*
- * This is a legacy data structure created from gl_vertex_attrib_array and
+ * This is a legacy data structure created from gl_array_attributes and
* gl_vertex_buffer_binding, for compatibility with existing driver code.
*/
struct gl_vertex_array _VertexAttrib[VERT_ATTRIB_MAX];
};
-/** Used to signal when transitioning from one kind of drawing method
+/**
+ * Used to signal when transitioning from one kind of drawing method
* to another.
*/
-typedef enum {
+typedef enum
+{
DRAW_NONE, /**< Initial value only */
DRAW_BEGIN_END,
DRAW_DISPLAY_LIST,
DRAW_ARRAYS
} gl_draw_method;
+
/**
* Enum for the OpenGL APIs we know about and may support.
*
API_OPENGL_LAST = API_OPENGL_CORE
} gl_api;
+
/**
* Vertex array state
*/
*/
struct gl_evaluators
{
- /**
+ /**
* \name 1-D maps
*/
/*@{*/
struct gl_1d_map Map1Texture4;
/*@}*/
- /**
- * \name 2-D maps
+ /**
+ * \name 2-D maps
*/
/*@{*/
struct gl_2d_map Map2Vertex3;
GLvoid *data;
};
+
/**
* A bindless image object.
*/
GLvoid *data;
};
+
/**
* Names of the various vertex/fragment program register files, etc.
*
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;
};
};
-static inline GLbitfield
-gl_external_samplers(const struct gl_program *prog)
-{
- GLbitfield external_samplers = 0;
- GLbitfield mask = prog->SamplersUsed;
-
- while (mask) {
- int idx = u_bit_scan(&mask);
- if (prog->sh.SamplerTargets[idx] == TEXTURE_EXTERNAL_INDEX)
- external_samplers |= (1 << idx);
- }
-
- 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
GLuint TransformFeedbackBufferStride[MAX_FEEDBACK_BUFFERS];
struct gl_shader_info info;
+
+ /* ARB_gl_spirv related data */
+ struct gl_shader_spirv_data *spirv_data;
};
* #extension ARB_fragment_coord_conventions: enable
*/
GLboolean ARB_fragment_coord_conventions_enable;
-};
+};
#define GLSL_DUMP 0x1 /**< Dump shaders to stdout */
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)
- */
+ * live references (e.g., sync not yet finished)
+ */
GLenum SyncCondition;
GLbitfield Flags; /**< Flags passed to glFenceSync */
GLuint StatusFlag:1; /**< Has the sync object been signaled? */
/**
* \name Thread safety and statechange notification for texture
- * objects.
+ * objects.
*
* \todo Improve the granularity of locking.
*/
/** 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;
};
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
/** When drivers are OK with mapped buffers during draw and other calls. */
bool AllowMappedBuffersDuringExecution;
+
+ /** GL_ARB_get_program_binary */
+ GLuint NumProgramBinaryFormats;
};
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 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;
/**
- * \name Bits for image transfer operations
+ * \name Bits for image transfer operations
* \sa __struct gl_contextRec::ImageTransferState.
*/
/*@{*/
/** Pixel Transfer ops */
-#define IMAGE_BITS (IMAGE_SCALE_BIAS_BIT | \
- IMAGE_SHIFT_OFFSET_BIT | \
- IMAGE_MAP_COLOR_BIT)
+#define IMAGE_BITS (IMAGE_SCALE_BIAS_BIT | \
+ IMAGE_SHIFT_OFFSET_BIT | \
+ IMAGE_MAP_COLOR_BIT)
+
/**
- * \name Bits to indicate what state has changed.
+ * \name Bits to indicate what state has changed.
*/
/*@{*/
#define _NEW_MODELVIEW (1u << 0) /**< gl_context::ModelView */
#include "dd.h"
-/**
- * Display list flags.
- * Strictly this is a tnl-private concept, but it doesn't seem
- * worthwhile adding a tnl private structure just to hold this one bit
- * of information:
- */
-#define DLIST_DANGLING_REFS 0x1
-
-
/** Opaque declaration of display list payload data type */
union gl_dlist_node;
/**
- * Provide a location where information about a display list can be
- * collected. Could be extended with driverPrivate structures,
- * etc. in the future.
+ * Per-display list information.
*/
struct gl_display_list
{
GLubyte ActiveAttribSize[VERT_ATTRIB_MAX];
GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4];
-
+
GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX];
GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4];
* to small enums suitable for use as an array index.
*/
-enum mesa_debug_source {
+enum mesa_debug_source
+{
MESA_DEBUG_SOURCE_API,
MESA_DEBUG_SOURCE_WINDOW_SYSTEM,
MESA_DEBUG_SOURCE_SHADER_COMPILER,
MESA_DEBUG_SOURCE_COUNT
};
-enum mesa_debug_type {
+enum mesa_debug_type
+{
MESA_DEBUG_TYPE_ERROR,
MESA_DEBUG_TYPE_DEPRECATED,
MESA_DEBUG_TYPE_UNDEFINED,
MESA_DEBUG_TYPE_COUNT
};
-enum mesa_debug_severity {
+enum mesa_debug_severity
+{
MESA_DEBUG_SEVERITY_LOW,
MESA_DEBUG_SEVERITY_MEDIUM,
MESA_DEBUG_SEVERITY_HIGH,
/*@}*/
/** \name Renderer attribute groups
- *
+ *
* We define a struct for each attribute group to make pushing and popping
* attributes easy. Also it's a good organization.
*/
GLfloat _ModelViewInvScale; /* may be for model- or eyespace lighting */
GLfloat _ModelViewInvScaleEyespace; /* always factor defined in spec */
GLboolean _NeedEyeCoords;
- GLboolean _ForceEyeCoords;
+ GLboolean _ForceEyeCoords;
GLuint TextureStateTimestamp; /**< detect changes to shared state */
GLboolean TileRasterOrderIncreasingY;
/**
- * \name Hooks for module contexts.
+ * \name Hooks for module contexts.
*
* These will eventually live in the driver or elsewhere.
*/