X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmtypes.h;h=514170dbcf0c7a84fa7c37d7c0e0eb3891b28746;hb=09fbb3837b6aa5dfc6c94f41ab5443820177c569;hp=bced1a64d98585d8f5a4c5daa50f5b9de3b67d3b;hpb=d63eef4b86af02aea5b26f90de9cf3d46aee398c;p=mesa.git diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bced1a64d98..514170dbcf0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -7,9 +7,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -36,14 +36,20 @@ #include "glheader.h" -#include /* GLimports/GLexports/GLcontextModes */ +#include /* __GLcontextModes (GLvisual) */ #include "config.h" /* Hardwired parameters */ -#include "glapitable.h" -#include "glthread.h" +#include "glapi/glapitable.h" +#include "glapi/glthread.h" #include "math/m_matrix.h" /* GLmatrix */ #include "bitset.h" +/** + * Special, internal token + */ +#define GL_SHADER_PROGRAM_MESA 0x9999 + + /** * Color channel data type. */ @@ -120,6 +126,8 @@ struct gl_pixelstore_attrib; struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; +struct st_context; +struct pipe_surface; typedef struct __GLcontextRec GLcontext; typedef struct __GLcontextModesRec GLvisual; typedef struct gl_framebuffer GLframebuffer; @@ -213,22 +221,6 @@ enum #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) /*@}*/ -/** - * GLSL allows shader writers to allocate vertex result attributes (varyings) in - * single float component granularity. This is in contrast to vertex / fragment - * programs, where result attributes (actually texcoords) were allocated - * in 4-component vectors of floats granularity. - * For performance reasons, it would be optimal to stick with this scheme on a scalar - * processor. Varyings will likely be allocated as 3-component vectors, so statistically - * we win 2 floats. - * The constant VARYINGS_PER_VECTOR tells us how much of float components we pack into - * one result vector. For scalar processor it would be 1, for vector processor - 4. - * - * NOTE: Currently we pack varyings into vertex attributes. - */ -#define VARYINGS_PER_VECTOR 2 -#define VARYING_EMIT_STYLE EMIT_2F -#define MAX_VARYING_VECTORS ((MAX_VARYING_FLOATS + VARYINGS_PER_VECTOR - 1) / VARYINGS_PER_VECTOR) /** * Indexes for vertex program result attributes @@ -250,7 +242,8 @@ enum #define VERT_RESULT_BFC0 13 #define VERT_RESULT_BFC1 14 #define VERT_RESULT_EDGE 15 -#define VERT_RESULT_MAX 16 +#define VERT_RESULT_VAR0 16 /**< shader varying */ +#define VERT_RESULT_MAX (VERT_RESULT_VAR0 + MAX_VARYING) /*@}*/ @@ -271,7 +264,8 @@ enum FRAG_ATTRIB_TEX5 = 9, FRAG_ATTRIB_TEX6 = 10, FRAG_ATTRIB_TEX7 = 11, - FRAG_ATTRIB_MAX = 12 + FRAG_ATTRIB_VAR0 = 12, /**< shader varying */ + FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING) }; /** @@ -290,6 +284,10 @@ enum #define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) #define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) #define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) +#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0) + +#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U)) +#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V)) #define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ FRAG_BIT_TEX1| \ @@ -305,12 +303,14 @@ enum /** * Fragment program results */ -/*@{*/ -#define FRAG_RESULT_COLR 0 -#define FRAG_RESULT_COLH 1 -#define FRAG_RESULT_DEPR 2 -#define FRAG_RESULT_MAX 3 -/*@}*/ +enum +{ + FRAG_RESULT_COLR = 0, + FRAG_RESULT_COLH = 1, + FRAG_RESULT_DEPR = 2, + FRAG_RESULT_DATA0 = 3, + FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) +}; /** @@ -383,6 +383,13 @@ enum { BUFFER_BIT_COLOR7) +/** The pixel transfer path has three color tables: */ +/*@{*/ +#define COLORTABLE_PRECONVOLUTION 0 +#define COLORTABLE_POSTCONVOLUTION 1 +#define COLORTABLE_POSTCOLORMATRIX 2 +#define COLORTABLE_MAX 3 +/*@}*/ /** @@ -663,9 +670,7 @@ struct gl_enable_attrib GLboolean Blend; GLbitfield ClipPlanes; GLboolean ColorMaterial; - GLboolean ColorTable; /* SGI_color_table */ - GLboolean PostColorMatrixColorTable; /* SGI_color_table */ - GLboolean PostConvolutionColorTable; /* SGI_color_table */ + GLboolean ColorTable[COLORTABLE_MAX]; GLboolean Convolution1D; GLboolean Convolution2D; GLboolean Separable2D; @@ -914,7 +919,6 @@ struct gl_line_attrib GLushort StipplePattern; /**< Stipple pattern */ GLint StippleFactor; /**< Stipple repeat factor */ GLfloat Width; /**< Line width */ - GLfloat _Width; /**< Clamped Line width */ }; @@ -1016,11 +1020,10 @@ struct gl_pixel_attrib GLboolean MapColorFlag; GLboolean MapStencilFlag; - /* Color table lookup (GL_SGI_color_table) */ - /* Note: actual table is not part of this attrib group */ - GLfloat ColorTableScale[4]; - GLfloat ColorTableBias[4]; - GLboolean ColorTableEnabled; + /* There are multiple color table stages: */ + GLboolean ColorTableEnabled[COLORTABLE_MAX]; + GLfloat ColorTableScale[COLORTABLE_MAX][4]; /**< RGBA */ + GLfloat ColorTableBias[COLORTABLE_MAX][4]; /**< RGBA */ /* Convolution (GL_EXT_convolution) */ GLboolean Convolution1DEnabled; @@ -1033,23 +1036,11 @@ struct gl_pixel_attrib GLfloat PostConvolutionScale[4]; /**< RGBA */ GLfloat PostConvolutionBias[4]; /**< RGBA */ - /* Post-convolution color table */ - /* Note: actual table is not part of this attrib group */ - GLboolean PostConvolutionColorTableEnabled; - GLfloat PCCTscale[4]; /** Post Convolution Color Table scale */ - GLfloat PCCTbias[4]; /** Post Convolution Color Table bias */ - /* Color matrix (GL_SGI_color_matrix) */ /* Note: the color matrix is not part of this attrib group */ GLfloat PostColorMatrixScale[4]; /**< RGBA */ GLfloat PostColorMatrixBias[4]; /**< RGBA */ - /* Post color matrix color table */ - /* Note: actual table is not part of this attrib group */ - GLboolean PostColorMatrixColorTableEnabled; - GLfloat PCMCTscale[4]; /** Post Color Matrix Color Table scale */ - GLfloat PCMCTbias[4]; /** Post Color Matrix Color Table bias */ - /* Histogram & minmax (GL_EXT_histogram) */ /* Note: histogram and minmax data are not part of this attrib group */ GLboolean HistogramEnabled; @@ -1073,7 +1064,6 @@ struct gl_point_attrib { GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */ GLfloat Size; /**< User-specified point size */ - GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */ GLfloat Params[3]; /**< GL_EXT_point_parameters */ GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */ GLfloat Threshold; /**< GL_EXT_point_parameters */ @@ -1137,17 +1127,19 @@ struct gl_stencil_attrib }; -#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */ +#define NUM_TEXTURE_TARGETS 7 /* 1D, 2D, 3D, CUBE, RECT, 1D_STACK, and 2D_STACK */ /** * An index for each type of texture object */ /*@{*/ -#define TEXTURE_1D_INDEX 0 -#define TEXTURE_2D_INDEX 1 -#define TEXTURE_3D_INDEX 2 -#define TEXTURE_CUBE_INDEX 3 -#define TEXTURE_RECT_INDEX 4 +#define TEXTURE_1D_INDEX 0 +#define TEXTURE_2D_INDEX 1 +#define TEXTURE_3D_INDEX 2 +#define TEXTURE_CUBE_INDEX 3 +#define TEXTURE_RECT_INDEX 4 +#define TEXTURE_1D_ARRAY_INDEX 5 +#define TEXTURE_2D_ARRAY_INDEX 6 /*@}*/ /** @@ -1155,11 +1147,13 @@ struct gl_stencil_attrib * Used for Texture.Unit[]._ReallyEnabled flags. */ /*@{*/ -#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX) -#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX) -#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX) -#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX) -#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX) +#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX) +#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX) +#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX) +#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX) +#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX) +#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX) +#define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX) /*@}*/ @@ -1296,15 +1290,22 @@ struct gl_texture_format * GL_DEPTH_COMPONENT. */ GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */ - GLubyte RedBits; /**< Bits per texel component */ - GLubyte GreenBits; /**< These are just rough approximations for */ - GLubyte BlueBits; /**< compressed texture formats. */ + + /** + * Bits per texel component. These are just rough approximations + * for compressed texture formats. + */ + /*@{*/ + GLubyte RedBits; + GLubyte GreenBits; + GLubyte BlueBits; GLubyte AlphaBits; GLubyte LuminanceBits; GLubyte IntensityBits; GLubyte IndexBits; GLubyte DepthBits; GLubyte StencilBits; /**< GL_EXT_packed_depth_stencil */ + /*@}*/ GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ @@ -1326,8 +1327,6 @@ struct gl_texture_format }; -#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. @@ -1392,7 +1391,7 @@ struct gl_texture_image #define FACE_NEG_Y 3 #define FACE_POS_Z 4 #define FACE_NEG_Z 5 -#define MAX_FACES 6 +#define MAX_FACES 6 /*@}*/ @@ -1403,7 +1402,6 @@ struct gl_texture_image */ 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. */ @@ -1426,11 +1424,15 @@ struct gl_texture_object GLfloat ShadowAmbient; /**< GL_ARB_shadow_ambient */ GLenum CompareMode; /**< GL_ARB_shadow */ GLenum CompareFunc; /**< GL_ARB_shadow */ + GLenum _Function; /**< Comparison function derived from + * \c CompareOperator, \c CompareMode, and + * \c CompareFunc. + */ GLenum DepthMode; /**< GL_ARB_depth_texture */ GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */ GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ - GLboolean Complete; /**< Is texture object complete? */ + GLboolean _Complete; /**< Is texture object complete? */ /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; @@ -1497,7 +1499,7 @@ struct gl_texture_unit GLbitfield _GenBitT; GLbitfield _GenBitR; GLbitfield _GenBitQ; - GLbitfield _GenFlags; /**< bitwise or of GenBit[STRQ] */ + GLbitfield _GenFlags; /**< bitwise or of _GenBit[STRQ] */ GLfloat ObjectPlaneS[4]; GLfloat ObjectPlaneT[4]; GLfloat ObjectPlaneR[4]; @@ -1530,19 +1532,28 @@ struct gl_texture_unit struct gl_texture_object *Current3D; struct gl_texture_object *CurrentCubeMap; /**< GL_ARB_texture_cube_map */ struct gl_texture_object *CurrentRect; /**< GL_NV_texture_rectangle */ + struct gl_texture_object *Current1DArray; /**< GL_MESA_texture_array */ + struct gl_texture_object *Current2DArray; /**< GL_MESA_texture_array */ struct gl_texture_object *_Current; /**< Points to really enabled tex obj */ - struct gl_texture_object Saved1D; /**< only used by glPush/PopAttrib */ + /** These are used for glPush/PopAttrib */ + /*@{*/ + struct gl_texture_object Saved1D; struct gl_texture_object Saved2D; struct gl_texture_object Saved3D; struct gl_texture_object SavedCubeMap; struct gl_texture_object SavedRect; + struct gl_texture_object Saved1DArray; + struct gl_texture_object Saved2DArray; + /*@}*/ - /* GL_SGI_texture_color_table */ + /** GL_SGI_texture_color_table */ + /*@{*/ struct gl_color_table ColorTable; struct gl_color_table ProxyColorTable; GLboolean ColorTableEnabled; + /*@}*/ }; struct texenvprog_cache_item { @@ -1582,6 +1593,8 @@ struct gl_texture_attrib struct gl_texture_object *Proxy3D; struct gl_texture_object *ProxyCubeMap; struct gl_texture_object *ProxyRect; + struct gl_texture_object *Proxy1DArray; + struct gl_texture_object *Proxy2DArray; /** GL_EXT_shared_texture_palette */ GLboolean SharedPalette; @@ -1837,22 +1850,31 @@ struct gl_evaluators /** * 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_NAMED_PARAM, + * 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. */ enum register_file { - PROGRAM_TEMPORARY = 0, - PROGRAM_LOCAL_PARAM = 1, - PROGRAM_ENV_PARAM = 2, - PROGRAM_STATE_VAR = 3, - PROGRAM_INPUT = 4, - PROGRAM_OUTPUT = 5, - PROGRAM_NAMED_PARAM = 6, - PROGRAM_CONSTANT = 7, - PROGRAM_WRITE_ONLY = 8, - PROGRAM_ADDRESS = 9, - PROGRAM_UNDEFINED = 10, /* invalid value */ + PROGRAM_TEMPORARY = 0, /**< machine->Temporary[] */ + PROGRAM_LOCAL_PARAM = 1, /**< gl_program->LocalParams[] */ + PROGRAM_ENV_PARAM = 2, /**< gl_program->Parameters[] */ + PROGRAM_STATE_VAR = 3, /**< gl_program->Parameters[] */ + PROGRAM_INPUT = 4, /**< machine->Inputs[] */ + PROGRAM_OUTPUT = 5, /**< machine->Outputs[] */ + PROGRAM_NAMED_PARAM = 6, /**< gl_program->Parameters[] */ + PROGRAM_CONSTANT = 7, /**< gl_program->Parameters[] */ + PROGRAM_UNIFORM = 8, /**< gl_program->Parameters[] */ + PROGRAM_VARYING = 9, /**< machine->Inputs[]/Outputs[] */ + PROGRAM_WRITE_ONLY = 10, /**< A dummy, write-only register */ + PROGRAM_ADDRESS = 11, /**< machine->AddressReg */ + PROGRAM_SAMPLER = 12, /**< for shader samplers, compile-time only */ + PROGRAM_UNDEFINED = 13, /**< Invalid value */ PROGRAM_FILE_MAX }; @@ -1868,22 +1890,29 @@ struct gl_program_parameter_list; struct gl_program { GLuint Id; - GLubyte *String; /**< Null-terminated program text */ + GLubyte *String; /**< Null-terminated program text */ GLint RefCount; - GLenum Target; - GLenum Format; /**< String encoding format */ + GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_FRAGMENT_PROGRAM_NV */ + GLenum Format; /**< String encoding format */ GLboolean Resident; struct prog_instruction *Instructions; - GLbitfield InputsRead; /* Bitmask of which input regs are read */ - GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */ + GLbitfield InputsRead; /**< Bitmask of which input regs are read */ + GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */ + GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ + GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */ /** Named parameters, constants, etc. from program text */ struct gl_program_parameter_list *Parameters; /** Numbered local parameters */ GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4]; + /** Vertex/fragment shader varying vars */ + struct gl_program_parameter_list *Varying; + /** Vertex program user-defined attributes */ + struct gl_program_parameter_list *Attributes; + /** Logical counts */ /*@{*/ GLuint NumInstructions; @@ -1891,6 +1920,9 @@ struct gl_program GLuint NumParameters; GLuint NumAttributes; GLuint NumAddressRegs; + GLuint NumAluInstructions; + GLuint NumTexInstructions; + GLuint NumTexIndirections; /*@}*/ /** Native, actual h/w counts */ /*@{*/ @@ -1899,6 +1931,9 @@ struct gl_program GLuint NumNativeParameters; GLuint NumNativeAttributes; GLuint NumNativeAddressRegs; + GLuint NumNativeAluInstructions; + GLuint NumNativeTexInstructions; + GLuint NumNativeTexIndirections; /*@}*/ }; @@ -1917,13 +1952,6 @@ struct gl_vertex_program struct gl_fragment_program { struct gl_program Base; /**< base class */ - GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ - GLuint NumAluInstructions; /**< GL_ARB_fragment_program */ - GLuint NumTexInstructions; - GLuint NumTexIndirections; - GLuint NumNativeAluInstructions; /**< GL_ARB_fragment_program */ - GLuint NumNativeTexInstructions; - GLuint NumNativeTexIndirections; GLenum FogOption; GLboolean UsesKill; }; @@ -1948,16 +1976,24 @@ struct gl_vertex_program_state 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 */ + struct gl_vertex_program *Current; /**< user-bound vertex program */ + + /** Currently enabled and valid program (including internal programs + * and compiled shader programs). + */ + struct gl_vertex_program *_Current; - GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /**< Env params */ + GLfloat Parameters[MAX_PROGRAM_ENV_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]; + GLenum TrackMatrix[MAX_PROGRAM_ENV_PARAMS / 4]; + GLenum TrackMatrixTransform[MAX_PROGRAM_ENV_PARAMS / 4]; + + /** Should fixed-function T&L be implemented with a vertex prog? */ + GLboolean _MaintainTnlProgram; + + /** Program to emulate fixed-function T&L (see above) */ + struct gl_vertex_program *_TnlProgram; #if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; @@ -1975,11 +2011,22 @@ struct gl_fragment_program_state { 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 */ + GLboolean _Active; + struct gl_fragment_program *Current; /**< User-bound fragment program */ + + /** Currently enabled and valid program (including internal programs + * and compiled shader programs). + */ + struct gl_fragment_program *_Current; + + GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */ + + /** Should fixed-function texturing be implemented with a fragment prog? */ + GLboolean _MaintainTexEnvProgram; + GLboolean _UseTexEnvProgram; + + /** Program to emulate fixed-function texture env/combine (see above) */ + struct gl_fragment_program *_TexEnvProgram; #if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; @@ -2038,10 +2085,11 @@ struct gl_ati_fragment_shader_state */ struct gl_query_object { - GLuint Id; - GLuint64EXT Result; /* the counter */ - GLboolean Active; /* inside Begin/EndQuery */ - GLboolean Ready; /* result is ready */ + GLenum Target; /**< The query target, when active */ + GLuint Id; /**< hash table ID/name */ + GLuint64EXT Result; /**< the counter */ + GLboolean Active; /**< inside Begin/EndQuery */ + GLboolean Ready; /**< result is ready? */ }; @@ -2056,14 +2104,61 @@ struct gl_query_state }; + +/** + * A GLSL shader object. + */ +struct gl_shader +{ + GLenum Type; /**< GL_FRAGMENT_SHADER || GL_VERTEX_SHADER (first field!) */ + GLuint Name; /**< AKA the handle */ + GLint RefCount; /**< Reference count */ + GLboolean DeletePending; + + const GLchar *Source; /**< Source code string */ + GLboolean CompileStatus; + GLuint NumPrograms; /**< size of Programs[] array */ + struct gl_program **Programs; /**< Post-compile assembly code */ + GLchar *InfoLog; +}; + + +/** + * A GLSL program object. Basically a linked collection of "shaders". + */ +struct gl_shader_program +{ + GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */ + GLuint Name; /**< aka handle or ID */ + GLint RefCount; /**< Reference count */ + GLboolean DeletePending; + + GLuint NumShaders; /**< number of attached shaders */ + struct gl_shader **Shaders; /**< List of attached the shaders */ + + /* post-link info: */ + struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ + struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ + struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */ + struct gl_program_parameter_list *Varying; + struct gl_program_parameter_list *Attributes; /**< Vertex attributes */ + GLboolean LinkStatus; /**< GL_LINK_STATUS */ + GLboolean Validated; + GLchar *InfoLog; +}; + + /** - * Context state for vertex/fragment shaders. + * Context state for GLSL vertex/fragment shaders. */ -struct gl_shader_objects_state +struct gl_shader_state { - struct gl2_program_intf **CurrentProgram; - GLboolean _VertexShaderPresent; - GLboolean _FragmentShaderPresent; + struct gl_shader_program *CurrentProgram; /**< The user-bound program */ + /** Driver-selectable options: */ + GLboolean EmitHighLevelInstructions; /**< IF/ELSE/ENDIF vs. BRA, etc. */ + GLboolean EmitCondCodes; /**< Use condition codes? */ + GLboolean EmitComments; /**< Annotated instructions */ + void *MemPool; }; @@ -2086,6 +2181,8 @@ struct gl_shared_state struct gl_texture_object *Default3D; struct gl_texture_object *DefaultCubeMap; struct gl_texture_object *DefaultRect; + struct gl_texture_object *Default1DArray; + struct gl_texture_object *Default2DArray; /*@}*/ /** @@ -2095,12 +2192,11 @@ struct gl_shared_state * \todo Improve the granularity of locking. */ /*@{*/ - _glthread_Mutex TexMutex; /**< texobj thread safety */ - GLuint TextureStateStamp; /**< state notification for shared tex */ + _glthread_Mutex TexMutex; /**< texobj thread safety */ + GLuint TextureStateStamp; /**< state notification for shared tex */ /*@}*/ - /** * \name Vertex/fragment programs */ @@ -2124,7 +2220,8 @@ struct gl_shared_state #endif #if FEATURE_ARB_shader_objects - struct _mesa_HashTable *GL2Objects; + /** Table of both gl_shader and gl_shader_program objects */ + struct _mesa_HashTable *ShaderObjects; #endif #if FEATURE_EXT_framebuffer_object @@ -2152,6 +2249,8 @@ struct gl_shared_state */ struct gl_renderbuffer { +#define RB_MAGIC 0xaabbccdd + int Magic; /** XXX TEMPORARY DEBUG INFO */ _glthread_Mutex Mutex; /**< for thread safety */ GLuint ClassID; /**< Useful for drivers */ GLuint Name; @@ -2169,7 +2268,7 @@ struct gl_renderbuffer GLubyte IndexBits; GLubyte DepthBits; GLubyte StencilBits; - GLvoid *Data; + GLvoid *Data; /**< This may not be used by some kinds of RBs */ /* Used to wrap one renderbuffer around another: */ struct gl_renderbuffer *Wrapped; @@ -2249,17 +2348,24 @@ struct gl_renderbuffer */ struct gl_renderbuffer_attachment { - GLenum Type; /* GL_NONE or GL_TEXTURE or GL_RENDERBUFFER_EXT */ + GLenum Type; /**< \c GL_NONE or \c GL_TEXTURE or \c GL_RENDERBUFFER_EXT */ GLboolean Complete; - /* IF Type == GL_RENDERBUFFER_EXT: */ + /** + * If \c Type is \c GL_RENDERBUFFER_EXT, this stores a pointer to the + * application supplied renderbuffer object. + */ struct gl_renderbuffer *Renderbuffer; - /* IF Type == GL_TEXTURE: */ + /** + * If \c Type is \c GL_TEXTURE, this stores a pointer to the application + * supplied texture object. + */ struct gl_texture_object *Texture; - GLuint TextureLevel; - GLuint CubeMapFace; /* 0 .. 5, for cube map textures */ - GLuint Zoffset; /* for 3D textures */ + GLuint TextureLevel; /**< Attached mipmap level. */ + GLuint CubeMapFace; /**< 0 .. 5, for cube map textures. */ + GLuint Zoffset; /**< Slice for 3D textures, or layer for both 1D + * and 2D array textures */ }; @@ -2365,6 +2471,7 @@ struct gl_constants GLint MaxTextureLevels; /**< Maximum number of allowed mipmap levels. */ GLint Max3DTextureLevels; /**< Maximum number of allowed mipmap levels for 3D texture targets. */ GLint MaxCubeTextureLevels; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */ + GLint MaxArrayTextureLayers; /**< Maximum number of layers in an array texture. */ GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */ GLuint MaxTextureCoordUnits; GLuint MaxTextureImageUnits; @@ -2404,7 +2511,7 @@ struct gl_constants GLuint MaxRenderbufferSize; /* GL_ARB_vertex_shader */ GLuint MaxVertexTextureImageUnits; - GLuint MaxVaryingFloats; + GLuint MaxVarying; }; @@ -2424,6 +2531,7 @@ struct gl_extensions GLboolean ARB_depth_texture; GLboolean ARB_draw_buffers; GLboolean ARB_fragment_program; + GLboolean ARB_fragment_program_shadow; GLboolean ARB_fragment_shader; GLboolean ARB_half_float_pixel; GLboolean ARB_imaging; @@ -2513,6 +2621,7 @@ struct gl_extensions GLboolean MESA_program_debug; GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; + GLboolean MESA_texture_array; GLboolean NV_blend_square; GLboolean NV_fragment_program; GLboolean NV_light_max_exponent; @@ -2542,7 +2651,7 @@ struct gl_extensions /** * A stack of matrices (projection, modelview, color, texture, etc). */ -struct matrix_stack +struct gl_matrix_stack { GLmatrix *Top; /**< points into Stack */ GLmatrix *Stack; /**< array [MaxDepth] of GLmatrix */ @@ -2570,7 +2679,6 @@ struct matrix_stack #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 */ @@ -2774,7 +2882,7 @@ struct mesa_display_list /** * State used during display list compilation and execution. */ -struct mesa_list_state +struct gl_dlist_state { struct mesa_display_list *CallStack[MAX_LIST_NESTING]; GLuint CallDepth; /**< Current recursion calling depth */ @@ -2813,17 +2921,6 @@ struct mesa_list_state */ struct __GLcontextRec { - /** - * \name OS related interfaces. - * - * These \b must be the first members of this structure, because they are - * exposed to the outside world (i.e. GLX extension). - */ - /*@{*/ - __GLimports imports; - __GLexports exports; - /*@}*/ - /** State possibly shared with other contexts in the address space */ struct gl_shared_state *Shared; @@ -2846,26 +2943,25 @@ struct __GLcontextRec struct dd_function_table Driver; void *DriverCtx; /**< Points to device driver context/state */ - void *DriverMgrCtx; /**< Points to device driver manager (optional)*/ /** Core/Driver constants */ struct gl_constants Const; /** \name The various 4x4 matrix stacks */ /*@{*/ - struct matrix_stack ModelviewMatrixStack; - struct matrix_stack ProjectionMatrixStack; - struct matrix_stack ColorMatrixStack; - struct matrix_stack TextureMatrixStack[MAX_TEXTURE_COORD_UNITS]; - struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; - struct matrix_stack *CurrentStack; /**< Points to one of the above stacks */ + struct gl_matrix_stack ModelviewMatrixStack; + struct gl_matrix_stack ProjectionMatrixStack; + struct gl_matrix_stack ColorMatrixStack; + struct gl_matrix_stack TextureMatrixStack[MAX_TEXTURE_COORD_UNITS]; + struct gl_matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; + struct gl_matrix_stack *CurrentStack; /**< Points to one of the above stacks */ /*@}*/ /** Combined modelview and projection matrix */ GLmatrix _ModelProjectMatrix; /** \name Display lists */ - struct mesa_list_state ListState; + struct gl_dlist_state ListState; GLboolean ExecuteFlag; /**< Execute GL commands? */ GLboolean CompileFlag; /**< Compile GL commands into display list? */ @@ -2934,28 +3030,23 @@ struct __GLcontextRec struct gl_feedback Feedback; /**< Feedback */ struct gl_selection Select; /**< Selection */ - struct gl_color_table ColorTable; /**< Pre-convolution */ - struct gl_color_table ProxyColorTable; /**< Pre-convolution */ + struct gl_color_table ColorTable[COLORTABLE_MAX]; + struct gl_color_table ProxyColorTable[COLORTABLE_MAX]; +#if 0 struct gl_color_table PostConvolutionColorTable; struct gl_color_table ProxyPostConvolutionColorTable; struct gl_color_table PostColorMatrixColorTable; struct gl_color_table ProxyPostColorMatrixColorTable; +#endif struct gl_program_state Program; /**< for vertex or fragment progs */ struct gl_vertex_program_state VertexProgram; /**< GL_ARB/NV_vertex_program */ struct gl_fragment_program_state FragmentProgram; /**< GL_ARB/NV_vertex_program */ struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */ - 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 _UseTexEnvProgram; - struct gl_query_state Query; /**< GL_ARB_occlusion_query */ - struct gl_shader_objects_state ShaderObjects; /* GL_ARB_shader_objects */ + struct gl_shader_state Shader; /**< GLSL shader object state */ /*@}*/ #if FEATURE_EXT_framebuffer_object @@ -3014,7 +3105,7 @@ struct __GLcontextRec void *swsetup_context; void *swtnl_context; void *swtnl_im; - void *acache_context; + struct st_context *st; void *aelt_context; /*@}*/ };