#include "main/formats.h" /* MESA_FORMAT_COUNT */
-/**
- * Color channel data type.
- */
-#if CHAN_BITS == 8
- typedef GLubyte GLchan;
-#define CHAN_MAX 255
-#define CHAN_MAXF 255.0F
-#define CHAN_TYPE GL_UNSIGNED_BYTE
-#elif CHAN_BITS == 16
- typedef GLushort GLchan;
-#define CHAN_MAX 65535
-#define CHAN_MAXF 65535.0F
-#define CHAN_TYPE GL_UNSIGNED_SHORT
-#elif CHAN_BITS == 32
- typedef GLfloat GLchan;
-#define CHAN_MAX 1.0
-#define CHAN_MAXF 1.0F
-#define CHAN_TYPE GL_FLOAT
-#else
-#error "illegal number of color channel bits"
-#endif
-
-
/**
* Stencil buffer data type.
*/
/**
- * Indexes for vertex program result attributes
+ * Indexes for vertex program result attributes. Note that
+ * _mesa_vert_result_to_frag_attrib() and _mesa_frag_attrib_to_vert_result() make
+ * assumptions about the layout of this enum.
*/
typedef enum
{
/**
- * Indexes for fragment program input attributes.
+ * Indexes for fragment program input attributes. Note that
+ * _mesa_vert_result_to_frag_attrib() and frag_attrib_to_vert_result() make
+ * assumptions about the layout of this enum.
*/
typedef enum
{
FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
} gl_frag_attrib;
+
+/**
+ * Convert from a gl_vert_result value to the corresponding gl_frag_attrib.
+ *
+ * VERT_RESULT_HPOS is converted to FRAG_ATTRIB_WPOS.
+ *
+ * gl_vert_result values which have no corresponding gl_frag_attrib
+ * (VERT_RESULT_PSIZ, VERT_RESULT_BFC0, VERT_RESULT_BFC1, and
+ * VERT_RESULT_EDGE) are converted to a value of -1.
+ */
+static INLINE int
+_mesa_vert_result_to_frag_attrib(gl_vert_result vert_result)
+{
+ if (vert_result >= VERT_RESULT_VAR0)
+ return vert_result - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0;
+ else if (vert_result <= VERT_RESULT_TEX7)
+ return vert_result;
+ else
+ return -1;
+}
+
+
+/**
+ * Convert from a gl_frag_attrib value to the corresponding gl_vert_result.
+ *
+ * FRAG_ATTRIB_WPOS is converted to VERT_RESULT_HPOS.
+ *
+ * gl_frag_attrib values which have no corresponding gl_vert_result
+ * (FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC) are converted to a value of -1.
+ */
+static INLINE int
+_mesa_frag_attrib_to_vert_result(gl_frag_attrib frag_attrib)
+{
+ if (frag_attrib <= FRAG_ATTRIB_TEX7)
+ return frag_attrib;
+ else if (frag_attrib >= FRAG_ATTRIB_VAR0)
+ return frag_attrib - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0;
+ else
+ return -1;
+}
+
+
/**
* Bitflags for fragment program input attributes.
*/
};
-/**
- * Data structure for color tables
- */
-struct gl_color_table
-{
- GLenum InternalFormat; /**< The user-specified format */
- GLenum _BaseFormat; /**< GL_ALPHA, GL_RGBA, GL_RGB, etc */
- GLuint Size; /**< number of entries in table */
- GLfloat *TableF; /**< Color table, floating point values */
- GLubyte *TableUB; /**< Color table, ubyte values */
- GLubyte RedSize;
- GLubyte GreenSize;
- GLubyte BlueSize;
- GLubyte AlphaSize;
- GLubyte LuminanceSize;
- GLubyte IntensitySize;
-};
-
-
/**
* \name Bit flags used for updating material values.
*/
};
+/**
+ * Used for storing clear color, texture border color, etc.
+ * The float values are typically unclamped.
+ */
+union gl_color_union
+{
+ GLfloat f[4];
+ GLint i[4];
+ GLuint ui[4];
+};
+
+
/**
* Color buffer attribute group (GL_COLOR_BUFFER_BIT).
*/
struct gl_colorbuffer_attrib
{
- GLuint ClearIndex; /**< Index to use for glClear */
- GLfloat ClearColorUnclamped[4]; /**< Color to use for glClear*/
- GLclampf ClearColor[4]; /**< Color to use for glClear */
-
- GLuint IndexMask; /**< Color index write mask */
- GLubyte ColorMask[MAX_DRAW_BUFFERS][4];/**< Each flag is 0xff or 0x0 */
+ GLuint ClearIndex; /**< Index for glClear */
+ union gl_color_union ClearColor; /**< Color for glClear, unclamped */
+ GLuint IndexMask; /**< Color index write mask */
+ GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; /**< Each flag is 0xff or 0x0 */
GLenum DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */
/*@{*/
GLbitfield BlendEnabled; /**< Per-buffer blend enable flags */
- /* NOTE: this does _not_ depend on fragment clamping or any other clamping control,
- * only on the fixed-pointness of the render target.
+ /* NOTE: this does _not_ depend on fragment clamping or any other clamping
+ * control, only on the fixed-pointness of the render target.
* The query does however depend on fragment color clamping.
*/
GLfloat BlendColorUnclamped[4]; /**< Blending color */
GLenum LogicOp; /**< Logic operator */
GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */
GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */
- GLboolean _LogicOpEnabled; /**< RGBA logic op + EXT_blend_logic_op enabled flag */
/*@}*/
GLboolean DitherFlag; /**< Dither enable flag */
#define ENABLE_TEXMAT(unit) (1 << (unit))
-/**
- * Texel fetch function prototype. We use texel fetch functions to
- * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
- * texture images. These functions help to isolate us from the gritty
- * details of all the various texture image encodings.
- *
- * \param texImage texture image.
- * \param col texel column.
- * \param row texel row.
- * \param img texel image level/layer.
- * \param texelOut output texel (up to 4 GLchans)
- */
-typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLchan *texelOut );
-
-/**
- * As above, but returns floats.
- * Used for depth component images and for upcoming signed/float
- * texture images.
- */
-typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLfloat *texelOut );
-
-
-typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- const void *texel);
-
-
/**
* Texture image state. Describes the dimensions of a texture image,
* the texel format and pointers to Texel Fetch functions.
GLint InternalFormat; /**< Internal format as given by the user */
GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE, GL_LUMINANCE_ALPHA,
- * GL_INTENSITY, GL_COLOR_INDEX,
- * GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT
- * only. Used for choosing TexEnv arithmetic.
+ * GL_INTENSITY, GL_DEPTH_COMPONENT or
+ * GL_DEPTH_STENCIL_EXT only. Used for
+ * choosing TexEnv arithmetic.
*/
gl_format TexFormat; /**< The actual texture memory format */
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
struct gl_texture_object *TexObject; /**< Pointer back to parent object */
-
- FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */
- FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */
+ GLuint Level; /**< Which mipmap level am I? */
+ /** Cube map face: index into gl_texture_object::Image[] array */
+ GLuint Face;
GLuint RowStride; /**< Padded width in units of texels */
GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
GLenum WrapR; /**< R-axis texture image wrap mode */
GLenum MinFilter; /**< minification filter */
GLenum MagFilter; /**< magnification filter */
- union {
- GLfloat f[4];
- GLuint ui[4];
- GLint i[4];
- } BorderColor; /**< Interpreted according to texture format */
+ 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 LodBias; /**< OpenGL 1.4 */
/**
* Texture object state. Contains the array of mipmap images, border color,
- * wrap modes, filter modes, shadow/texcompare state, and the per-texture
- * color palette.
+ * wrap modes, filter modes, and shadow/texcompare state.
*/
struct gl_texture_object
{
struct gl_buffer_object *BufferObject;
GLenum BufferObjectFormat;
- /** GL_EXT_paletted_texture */
- struct gl_color_table Palette;
-
/**
* \name For device driver.
* Note: instead of attaching driver data to this pointer, it's preferable
/** GL_ARB_seamless_cubemap */
GLboolean CubeMapSeamless;
- /** GL_EXT_shared_texture_palette */
- GLboolean SharedPalette;
- struct gl_color_table Palette;
-
/** Texture units/samplers used by vertex or fragment texturing */
GLbitfield _EnabledUnits;
*/
struct gl_shader_program *ActiveProgram;
- void *MemPool;
-
GLbitfield Flags; /**< Mask of GLSL_x flags */
};
/** Driver-selectable options: */
GLboolean EmitCondCodes; /**< Use condition codes? */
GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */
- /**
- * Attempts to flatten all ir_if (OPCODE_IF) for GPUs that can't
- * support control flow.
- */
- GLboolean EmitNoIfs;
GLboolean EmitNoLoops;
GLboolean EmitNoFunctions;
GLboolean EmitNoCont; /**< Emit CONT opcode? */
GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */
/*@}*/
+ GLuint MaxIfDepth; /**< Maximum nested IF blocks */
GLuint MaxUnrollIterations;
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */
+ /**
+ * Does the driver support real 32-bit integers? (Otherwise, integers are
+ * simulated via floats.)
+ */
+ GLboolean NativeIntegers;
+
+ /**
+ * If the driver supports real 32-bit integers, what integer value should be
+ * used for boolean true in uniform uploads? (Usually 1 or ~0.)
+ */
+ GLuint UniformBooleanTrue;
+
/** Which texture units support GL_ATI_envmap_bumpmap as targets */
GLbitfield SupportedBumpUnits;
GLboolean EXT_blend_color;
GLboolean EXT_blend_equation_separate;
GLboolean EXT_blend_func_separate;
- GLboolean EXT_blend_logic_op;
GLboolean EXT_blend_minmax;
GLboolean EXT_blend_subtract;
GLboolean EXT_clip_volume_hint;
GLboolean EXT_gpu_program_parameters;
GLboolean EXT_gpu_shader4;
GLboolean EXT_multi_draw_arrays;
- GLboolean EXT_paletted_texture;
GLboolean EXT_packed_depth_stencil;
GLboolean EXT_packed_float;
GLboolean EXT_packed_pixels;
GLboolean EXT_secondary_color;
GLboolean EXT_separate_shader_objects;
GLboolean EXT_separate_specular_color;
- GLboolean EXT_shared_texture_palette;
GLboolean EXT_stencil_wrap;
GLboolean EXT_stencil_two_side;
GLboolean EXT_subtexture;