summaryrefslogtreecommitdiff
path: root/src/mesa/main/mtypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/mtypes.h')
-rw-r--r--src/mesa/main/mtypes.h240
1 files changed, 154 insertions, 86 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index df77c6cbf9..828b0f2384 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"),
@@ -45,6 +45,12 @@
/**
+ * Special, internal token
+ */
+#define GL_SHADER_PROGRAM 0x9999
+
+
+/**
* Color channel data type.
*/
#if CHAN_BITS == 8
@@ -213,22 +219,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 +240,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 +262,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 +282,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 +301,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)
+};
/**
@@ -1829,22 +1827,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
};
@@ -1860,22 +1867,28 @@ 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 */
/** 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;
@@ -1883,6 +1896,9 @@ struct gl_program
GLuint NumParameters;
GLuint NumAttributes;
GLuint NumAddressRegs;
+ GLuint NumAluInstructions;
+ GLuint NumTexInstructions;
+ GLuint NumTexIndirections;
/*@}*/
/** Native, actual h/w counts */
/*@{*/
@@ -1891,6 +1907,9 @@ struct gl_program
GLuint NumNativeParameters;
GLuint NumNativeAttributes;
GLuint NumNativeAddressRegs;
+ GLuint NumNativeAluInstructions;
+ GLuint NumNativeTexInstructions;
+ GLuint NumNativeTexIndirections;
/*@}*/
};
@@ -1909,13 +1928,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;
};
@@ -1940,16 +1952,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 */
- GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /**< Env params */
+ /** Currently enabled and valid program (including internal programs
+ * and compiled shader programs).
+ */
+ struct gl_vertex_program *_Current;
+
+ 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;
@@ -1967,11 +1987,20 @@ 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 */
+ 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;
+
+ /** Program to emulate fixed-function texture env/combine (see above) */
+ struct gl_fragment_program *_TexEnvProgram;
#if FEATURE_MESA_program_debug
GLprogramcallbackMESA Callback;
@@ -2048,14 +2077,60 @@ struct gl_query_state
};
+
/**
- * Context state for vertex/fragment shaders.
+ * A GLSL shader object.
*/
-struct gl_shader_objects_state
+struct gl_shader
{
- struct gl2_program_intf **CurrentProgram;
- GLboolean _VertexShaderPresent;
- GLboolean _FragmentShaderPresent;
+ 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 GLSL vertex/fragment shaders.
+ */
+struct gl_shader_state
+{
+ 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 */
};
@@ -2116,7 +2191,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
@@ -2396,7 +2472,7 @@ struct gl_constants
GLuint MaxRenderbufferSize;
/* GL_ARB_vertex_shader */
GLuint MaxVertexTextureImageUnits;
- GLuint MaxVaryingFloats;
+ GLuint MaxVarying;
};
@@ -2534,7 +2610,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 */
@@ -2765,7 +2841,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 */
@@ -2837,26 +2913,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? */
@@ -2939,16 +3014,9 @@ struct __GLcontextRec
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