VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
VERT_ATTRIB_COLOR_INDEX = 6,
- VERT_ATTRIB_SEVEN = 7,
+ VERT_ATTRIB_EDGEFLAG = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
VERT_ATTRIB_TEX2 = 10,
#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
-#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG)
#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
{
GLenum InternalFormat; /**< The user-specified format */
GLenum _BaseFormat; /**< GL_ALPHA, GL_RGBA, GL_RGB, etc */
- GLuint Size; /**< number of entries (rows) in table */
- GLvoid *Table; /**< points to data of <Type> */
- GLenum Type; /**< GL_UNSIGNED_BYTE or GL_FLOAT */
+ 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;
/**
* \name Current vertex attributes.
* \note Values are valid only after FLUSH_VERTICES has been called.
+ * \note Index and Edgeflag current values are stored as floats in the
+ * SIX and SEVEN attribute slots.
*/
/*@{*/
GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
- GLfloat Index; /**< Current color index */
- GLboolean EdgeFlag; /**< Current edge flag */
/*@}*/
/**
GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */
GLbitfield ColorMaterialBitmask; /**< bitmask formed from Face and Mode */
GLboolean ColorMaterialEnabled;
+ GLenum ClampVertexColor;
struct gl_light EnabledList; /**< List sentinel */
GLint col, GLint row, GLint img,
const void *texel);
+
/**
- * TexImage store function. This is called by the glTex[Sub]Image
- * functions and is responsible for converting the user-specified texture
- * image into a specific (hardware) image format.
+ * This macro defines the (many) parameters to the texstore functions.
+ * \param dims either 1 or 2 or 3
+ * \param baseInternalFormat user-specified base internal format
+ * \param dstFormat destination Mesa texture format
+ * \param dstAddr destination image address
+ * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
+ * \param dstRowStride destination image row stride, in bytes
+ * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels
+ * \param srcWidth/Height/Depth source image size, in pixels
+ * \param srcFormat incoming image format
+ * \param srcType incoming image data type
+ * \param srcAddr source image address
+ * \param srcPacking source image packing parameters
*/
-typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking);
+#define TEXSTORE_PARAMS \
+ GLcontext *ctx, GLuint dims, \
+ GLenum baseInternalFormat, \
+ const struct gl_texture_format *dstFormat, \
+ GLvoid *dstAddr, \
+ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
+ GLint dstRowStride, const GLuint *dstImageOffsets, \
+ GLint srcWidth, GLint srcHeight, GLint srcDepth, \
+ GLenum srcFormat, GLenum srcType, \
+ const GLvoid *srcAddr, \
+ const struct gl_pixelstore_attrib *srcPacking
+
+/**
+ * Texture image storage function.
+ */
+typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
+
/**
* Texture format record
};
+#define MAX_3D_TEXTURE_SIZE (1 << (MAX_3D_TEXTURE_LEVELS - 1))
+
/**
* Texture image state. Describes the dimensions of a texture image,
* the texel format and pointers to Texel Fetch functions.
GLuint Width; /**< = 2^WidthLog2 + 2*Border */
GLuint Height; /**< = 2^HeightLog2 + 2*Border */
GLuint Depth; /**< = 2^DepthLog2 + 2*Border */
- GLuint RowStride; /**< == Width unless IsClientData and padded */
- GLuint ImageStride; /**< Stride between images, in texels */
GLuint Width2; /**< = Width - 2*Border */
GLuint Height2; /**< = Height - 2*Border */
GLuint Depth2; /**< = Depth - 2*Border */
GLfloat WidthScale; /**< used for mipmap LOD computation */
GLfloat HeightScale; /**< used for mipmap LOD computation */
GLfloat DepthScale; /**< used for mipmap LOD computation */
- GLvoid *Data; /**< Image data, accessed via FetchTexel() */
GLboolean IsClientData; /**< Data owned by client? */
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
GLboolean IsCompressed; /**< GL_ARB_texture_compression */
GLuint CompressedSize; /**< GL_ARB_texture_compression */
+ GLuint RowStride; /**< == Width unless IsClientData and padded */
+ GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
+ each 2D slice in 'Data', in texels */
+ GLvoid *Data; /**< Image data, accessed via FetchTexel() */
+
/**
* \name For device driver:
*/
GLboolean ColorTableEnabled;
};
-struct texenvprog_cache {
+struct texenvprog_cache_item {
GLuint hash;
void *key;
- void *data;
- struct texenvprog_cache *next;
+ struct gl_fragment_program *data;
+ struct texenvprog_cache_item *next;
+};
+
+struct texenvprog_cache {
+ struct texenvprog_cache_item **items;
+ GLuint size, n_items;
+ GLcontext *ctx;
};
/**
struct gl_color_table Palette;
/** Cached texenv fragment programs */
- struct texenvprog_cache *env_fp_cache;
+ struct texenvprog_cache env_fp_cache;
};
};
-#define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */
-
/**
* Client vertex array attributes
GLsizei Stride; /**< user-specified stride */
GLsizei StrideB; /**< actual stride in bytes */
const GLubyte *Ptr; /**< Points to array data */
- GLbitfield Enabled; /**< one of the _NEW_ARRAY_ bits */
+ GLboolean Enabled; /**< Enabled flag is a boolean */
GLboolean Normalized; /**< GL_ARB_vertex_program */
/**< GL_ARB_vertex_buffer_object */
struct gl_buffer_object *BufferObj;
GLuint _MaxElement;
-
- GLbitfield Flags;
};
/**
- * Vertex array state
+ * Collection of vertex arrays. Defined by the GL_APPLE_vertex_array_object
+ * extension, but a nice encapsulation in any case.
*/
-struct gl_array_attrib
+struct gl_array_object
{
+ /** Name of the array object as received from glGenVertexArrayAPPLE. */
+ GLuint Name;
+
/** Conventional vertex arrays */
/*@{*/
struct gl_client_array Vertex;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
- struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
+ struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
/*@}*/
- /** Generic arrays for vertex programs/shaders; */
+ /** Generic arrays for vertex programs/shaders */
struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
+ /** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */
+ GLbitfield _Enabled;
+};
+
+
+/**
+ * Vertex array state
+ */
+struct gl_array_attrib
+{
+ struct gl_array_object *ArrayObj;
+ struct gl_array_object *DefaultArrayObj;
+
GLint ActiveTexture; /**< Client Active Texture */
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
- GLbitfield _Enabled; /**< mask of _NEW_ARRAY_* values */
GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */
#if FEATURE_ARB_vertex_buffer_object
};
-/**
- * State used during execution of fragment programs.
- */
-struct fp_machine
-{
- GLfloat Temporaries[MAX_NV_FRAGMENT_PROGRAM_TEMPS][4];
- GLfloat Inputs[MAX_NV_FRAGMENT_PROGRAM_INPUTS][4];
- GLfloat Outputs[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS][4];
- GLuint CondCodes[4];
-};
-
-
/**
* Names of the various vertex/fragment program register files, etc.
* NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
PROGRAM_CONSTANT = 7,
PROGRAM_WRITE_ONLY = 8,
PROGRAM_ADDRESS = 9,
- PROGRAM_UNDEFINED = 15 /* invalid value */
+ PROGRAM_UNDEFINED = 10, /* invalid value */
+ PROGRAM_FILE_MAX
};
/** Vertex and fragment instructions */
struct prog_instruction;
-struct program_parameter_list;
+struct gl_program_parameter_list;
/**
* Base class for any kind of program object
*/
-struct program
+struct gl_program
{
GLuint Id;
GLubyte *String; /**< Null-terminated program text */
GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */
/** Named parameters, constants, etc. from program text */
- struct program_parameter_list *Parameters;
+ struct gl_program_parameter_list *Parameters;
/** Numbered local parameters */
GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4];
/** Vertex program object */
-struct vertex_program
+struct gl_vertex_program
{
- struct program Base; /* base class */
- GLboolean IsNVProgram; /* GL_NV_vertex_program ? */
- GLboolean IsPositionInvariant; /* GL_ARB_vertex_program / GL_NV_vertex_program1_1 */
- void *TnlData; /* should probably use Base.DriverData */
+ struct gl_program Base; /**< base class */
+ GLboolean IsNVProgram; /**< is this a GL_NV_vertex_program program? */
+ GLboolean IsPositionInvariant;
+ void *TnlData; /**< should probably use Base.DriverData */
};
/** Fragment program object */
-struct fragment_program
+struct gl_fragment_program
{
- struct program Base; /**< base class */
+ struct gl_program Base; /**< base class */
GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */
GLuint NumAluInstructions; /**< GL_ARB_fragment_program */
GLuint NumTexInstructions;
/**
- * State vars for GL_ARB/GL_NV_vertex_program
+ * Context state for vertex programs.
*/
struct gl_vertex_program_state
{
- GLboolean Enabled; /**< GL_VERTEX_PROGRAM_ARB/NV */
- GLboolean _Enabled; /**< Enabled and valid program? */
- GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
- GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
- struct vertex_program *Current; /**< ptr to currently bound program */
- struct vertex_program *_Current; /**< ptr to currently bound
- program, including internal
- (t_vp_build.c) programs */
+ GLboolean Enabled; /**< GL_VERTEX_PROGRAM_ARB/NV */
+ GLboolean _Enabled; /**< Enabled and valid program? */
+ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
+ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
+ struct gl_vertex_program *Current; /**< ptr to currently bound program */
+ const struct gl_vertex_program *_Current; /**< ptr to currently bound
+ program, including internal
+ (t_vp_build.c) programs */
+ GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /**< Env params */
+
+ /* For GL_NV_vertex_program only: */
GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
- GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /* Env params */
- /* Only used during program execution (may be moved someday): */
- GLfloat Temporaries[MAX_NV_VERTEX_PROGRAM_TEMPS][4];
- GLfloat Inputs[MAX_NV_VERTEX_PROGRAM_INPUTS][4];
- GLuint InputsSize[MAX_NV_VERTEX_PROGRAM_INPUTS];
- GLfloat Outputs[MAX_NV_VERTEX_PROGRAM_OUTPUTS][4];
- GLint AddressReg[4];
-
#if FEATURE_MESA_program_debug
GLprogramcallbackMESA Callback;
GLvoid *CallbackData;
/**
- * Context state for GL_ARB/NV_fragment_program
+ * Context state for fragment programs.
*/
struct gl_fragment_program_state
{
- GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */
- GLboolean _Enabled; /* Enabled and valid program? */
- GLboolean _Active;
- struct fragment_program *Current; /* ptr to currently bound program */
- struct fragment_program *_Current; /* ptr to currently active program
- (including internal programs) */
- struct fp_machine Machine; /* machine state */
- GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */
+ GLboolean Enabled; /**< User-set fragment program enable flag */
+ GLboolean _Enabled; /**< Fragment program enabled and valid? */
+ GLboolean _Active; /**< Is a user program or internal program active? */
+ struct gl_fragment_program *Current; /**< User-bound program */
+ const struct gl_fragment_program *_Current; /**< currently active program
+ (including internal programs) */
+ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /**< Env params */
#if FEATURE_MESA_program_debug
GLprogramcallbackMESA Callback;
struct atifs_instruction;
struct atifs_setupinst;
-/**
- * State for executing ATI fragment shader.
- */
-struct atifs_machine
-{
- GLfloat Registers[6][4]; /** six temporary registers */
- GLfloat PrevPassRegisters[6][4];
- GLfloat Inputs[2][4]; /** Primary, secondary input colors */
-};
-
-
/**
* ATI fragment shader
*/
GLboolean _Enabled; /** enabled and valid shader? */
GLboolean Compiling;
GLfloat GlobalConstants[8][4];
- struct atifs_machine Machine; /* machine state */
struct ati_fragment_shader *Current;
};
struct gl_texture_object *DefaultRect;
/*@}*/
+ /**
+ * \name Thread safety and statechange notification for texture
+ * objects.
+ *
+ * \todo Improve the granularity of locking.
+ */
+ /*@{*/
+ _glthread_Mutex TexMutex; /**< texobj thread safety */
+ GLuint TextureStateStamp; /**< state notification for shared tex */
+ /*@}*/
+
+
+
/**
* \name Vertex/fragment programs
*/
/*@{*/
struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */
#if FEATURE_ARB_vertex_program
- struct program *DefaultVertexProgram;
+ struct gl_program *DefaultVertexProgram;
#endif
#if FEATURE_ARB_fragment_program
- struct program *DefaultFragmentProgram;
+ struct gl_program *DefaultFragmentProgram;
#endif
/*@}*/
struct _mesa_HashTable *BufferObjects;
#endif
+#if FEATURE_ARB_shader_objects
struct _mesa_HashTable *GL2Objects;
+#endif
#if FEATURE_EXT_framebuffer_object
struct _mesa_HashTable *RenderBuffers;
struct _mesa_HashTable *FrameBuffers;
#endif
+ /** Objects associated with the GL_APPLE_vertex_array_object extension. */
+ struct _mesa_HashTable *ArrayObjects;
+
void *DriverData; /**< Device driver shared state */
};
_glthread_Mutex Mutex; /**< for thread safety */
GLuint Name; /* if zero, this is a window system framebuffer */
GLint RefCount;
+ GLboolean DeletePending;
GLvisual Visual; /**< The framebuffer's visual.
Immutable if this is a window system buffer.
GLuint MaxNativeTemps;
GLuint MaxNativeAddressRegs; /* vertex program only, for now */
GLuint MaxNativeParameters;
+ /* For shaders */
+ GLuint MaxUniformComponents;
};
/* GL_EXT_framebuffer_object */
GLuint MaxColorAttachments;
GLuint MaxRenderbufferSize;
+ /* GL_ARB_vertex_shader */
+ GLuint MaxVertexTextureImageUnits;
+ GLuint MaxVaryingFloats;
};
GLboolean ARB_point_sprite;
GLboolean ARB_shader_objects;
GLboolean ARB_shading_language_100;
+ GLboolean ARB_shading_language_120;
GLboolean ARB_shadow;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_compression;
GLboolean EXT_framebuffer_object;
GLboolean EXT_fog_coord;
GLboolean EXT_framebuffer_blit;
+ GLboolean EXT_gpu_program_parameters;
GLboolean EXT_histogram;
GLboolean EXT_multi_draw_arrays;
GLboolean EXT_paletted_texture;
GLboolean EXT_texture_filter_anisotropic;
GLboolean EXT_texture_lod_bias;
GLboolean EXT_texture_mirror_clamp;
+ GLboolean EXT_texture_sRGB;
GLboolean EXT_timer_query;
GLboolean EXT_vertex_array;
GLboolean EXT_vertex_array_set;
/* vendor extensions */
GLboolean APPLE_client_storage;
GLboolean APPLE_packed_pixels;
+ GLboolean APPLE_vertex_array_object;
GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3;
GLboolean ATI_fragment_shader;
+ GLboolean ATI_separate_stencil;
GLboolean IBM_rasterpos_clip;
GLboolean IBM_multimode_draw_arrays;
GLboolean MESA_pack_invert;
#define IMAGE_HISTOGRAM_BIT 0x200
#define IMAGE_MIN_MAX_BIT 0x400
#define IMAGE_CLAMP_BIT 0x800 /* extra */
+#define IMAGE_RED_TO_LUMINANCE 0x1000
/** Pixel Transfer ops up to convolution */
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX
-#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
+#define _NEW_ARRAY_EDGEFLAG VERT_BIT_EDGEFLAG
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
-#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
+#define _NEW_ARRAY_ATTRIB_0 VERT_BIT_GENERIC0 /* start at bit 16 */
#define _NEW_ARRAY_ALL 0xffffffff
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
_NEW_TEXTURE | \
_NEW_POINT | \
+ _NEW_PROGRAM | \
_NEW_MODELVIEW)
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
struct gl_fragment_program_state FragmentProgram; /**< GL_ARB/NV_vertex_program */
struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */
- struct fragment_program *_TexEnvProgram; /**< Texture state as fragment program */
- struct vertex_program *_TnlProgram; /**< Fixed func TNL state as vertex program */
+ struct gl_fragment_program *_TexEnvProgram; /**< Texture state as fragment program */
+ struct gl_vertex_program *_TnlProgram; /**< Fixed func TNL state as vertex program */
GLboolean _MaintainTnlProgram;
GLboolean _MaintainTexEnvProgram;
GLboolean _ForceEyeCoords;
GLenum _CurrentProgram; /* currently executing program */
+ GLuint TextureStateTimestamp; /* detect changes to shared state */
+
struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */
struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */
/**@}*/