2001-02-15 01:33:52 +00:00
|
|
|
/* $Id: t_context.h,v 1.14 2001/02/15 01:33:52 keithw Exp $ */
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Mesa 3-D graphics library
|
|
|
|
* Version: 3.5
|
2000-11-22 07:32:16 +00:00
|
|
|
*
|
2000-11-16 21:05:34 +00:00
|
|
|
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
2000-11-22 07:32:16 +00:00
|
|
|
*
|
2000-11-16 21:05:34 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2000-11-22 07:32:16 +00:00
|
|
|
*
|
2000-11-16 21:05:34 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
2000-11-22 07:32:16 +00:00
|
|
|
*
|
2000-11-16 21:05:34 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2000-12-26 05:09:27 +00:00
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Keith Whitwell <keithw@valinux.com>
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _T_CONTEXT_H
|
|
|
|
#define _T_CONTEXT_H
|
|
|
|
|
|
|
|
#include "glheader.h"
|
2000-11-22 07:32:16 +00:00
|
|
|
#include "mtypes.h"
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
#include "math/m_matrix.h"
|
|
|
|
#include "math/m_vector.h"
|
|
|
|
#include "math/m_xform.h"
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
#define MAX_PIPELINE_STAGES 30
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Numbers for sizing immediate structs.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
#define IMM_MAX_COPIED_VERTS 3
|
|
|
|
#define IMM_MAXDATA (216 + IMM_MAX_COPIED_VERTS)
|
|
|
|
#define IMM_SIZE (IMM_MAXDATA + MAX_CLIPPED_VERTICES)
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Values for IM->BeginState
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
#define VERT_BEGIN_0 0x1 /* glBegin (if initially inside beg/end) */
|
|
|
|
#define VERT_BEGIN_1 0x2 /* glBegin (if initially outside beg/end) */
|
|
|
|
#define VERT_ERROR_0 0x4 /* invalid_operation in initial state 0 */
|
|
|
|
#define VERT_ERROR_1 0x8 /* invalid_operation in initial state 1 */
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
|
|
|
|
/* Flags to be added to the primitive enum in VB->Primitive.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */
|
|
|
|
#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */
|
|
|
|
#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */
|
|
|
|
#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */
|
|
|
|
#define PRIM_LAST 0x800 /* No more prims in the VB */
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Flags that describe the inputs and outputs of pipeline stages, and
|
|
|
|
* the contents of a vertex-cassette.
|
2000-11-16 21:05:34 +00:00
|
|
|
*
|
2000-12-26 05:09:27 +00:00
|
|
|
* 5 spare flags, rearrangement of eval flags can secure at least 3
|
|
|
|
* more.
|
|
|
|
*/
|
|
|
|
#define VERT_OBJ _NEW_ARRAY_VERTEX
|
|
|
|
#define VERT_RGBA _NEW_ARRAY_COLOR
|
|
|
|
#define VERT_NORM _NEW_ARRAY_NORMAL
|
|
|
|
#define VERT_INDEX _NEW_ARRAY_INDEX
|
|
|
|
#define VERT_EDGE _NEW_ARRAY_EDGEFLAG
|
|
|
|
#define VERT_SPEC_RGB _NEW_ARRAY_SECONDARYCOLOR
|
|
|
|
#define VERT_FOG_COORD _NEW_ARRAY_FOGCOORD
|
|
|
|
#define VERT_TEX0 _NEW_ARRAY_TEXCOORD_0
|
|
|
|
#define VERT_TEX1 _NEW_ARRAY_TEXCOORD_1
|
|
|
|
#define VERT_TEX2 _NEW_ARRAY_TEXCOORD_2
|
|
|
|
#define VERT_TEX3 _NEW_ARRAY_TEXCOORD_3
|
|
|
|
#define VERT_TEX4 _NEW_ARRAY_TEXCOORD_4
|
|
|
|
#define VERT_TEX5 _NEW_ARRAY_TEXCOORD_5
|
|
|
|
#define VERT_TEX6 _NEW_ARRAY_TEXCOORD_6
|
|
|
|
#define VERT_TEX7 _NEW_ARRAY_TEXCOORD_7
|
|
|
|
#define VERT_EVAL_C1 0x8000 /* imm only */
|
|
|
|
#define VERT_EVAL_C2 0x10000 /* imm only */
|
|
|
|
#define VERT_EVAL_P1 0x20000 /* imm only */
|
|
|
|
#define VERT_EVAL_P2 0x40000 /* imm only */
|
|
|
|
#define VERT_OBJ_3 0x80000 /* imm only */
|
|
|
|
#define VERT_OBJ_4 0x100000 /* imm only */
|
|
|
|
#define VERT_MATERIAL 0x200000 /* imm only, but tested in vb code */
|
|
|
|
#define VERT_ELT 0x400000 /* imm only */
|
|
|
|
#define VERT_BEGIN 0x800000 /* imm only, but tested in vb code */
|
|
|
|
#define VERT_END 0x1000000 /* imm only, but tested in vb code */
|
|
|
|
#define VERT_END_VB 0x2000000 /* imm only, but tested in vb code */
|
|
|
|
#define VERT_POINT_SIZE 0x4000000 /* vb only, could reuse a bit */
|
|
|
|
#define VERT_EYE VERT_BEGIN /* vb only, reuse imm bit */
|
|
|
|
#define VERT_CLIP VERT_END /* vb only, reuse imm bit*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Flags for IM->TexCoordSize. Enough flags for 16 units.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
#define TEX_0_SIZE_3 0x1
|
2001-01-14 06:14:21 +00:00
|
|
|
#define TEX_0_SIZE_4 0x1001
|
2000-12-26 05:09:27 +00:00
|
|
|
#define TEX_SIZE_3(unit) (TEX_0_SIZE_3<<unit)
|
|
|
|
#define TEX_SIZE_4(unit) (TEX_0_SIZE_4<<unit)
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Shorthands.
|
|
|
|
*/
|
|
|
|
#define VERT_EVAL_ANY (VERT_EVAL_C1|VERT_EVAL_P1| \
|
|
|
|
VERT_EVAL_C2|VERT_EVAL_P2)
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
#define VERT_OBJ_23 (VERT_OBJ_3|VERT_OBJ)
|
2000-11-16 21:05:34 +00:00
|
|
|
#define VERT_OBJ_234 (VERT_OBJ_4|VERT_OBJ_23)
|
|
|
|
|
2000-11-24 15:21:59 +00:00
|
|
|
#define VERT_TEX0_SHIFT 11
|
2000-12-26 05:09:27 +00:00
|
|
|
|
2000-11-24 15:21:59 +00:00
|
|
|
#define VERT_TEX(i) (VERT_TEX0 << i)
|
2000-12-26 05:09:27 +00:00
|
|
|
|
2000-11-24 15:21:59 +00:00
|
|
|
#define VERT_TEX_ANY (VERT_TEX0 | \
|
|
|
|
VERT_TEX1 | \
|
|
|
|
VERT_TEX2 | \
|
|
|
|
VERT_TEX3 | \
|
|
|
|
VERT_TEX4 | \
|
|
|
|
VERT_TEX5 | \
|
|
|
|
VERT_TEX6 | \
|
2000-12-26 05:09:27 +00:00
|
|
|
VERT_TEX7)
|
|
|
|
|
|
|
|
#define VERT_FIXUP (VERT_TEX_ANY | \
|
|
|
|
VERT_RGBA | \
|
|
|
|
VERT_SPEC_RGB | \
|
|
|
|
VERT_FOG_COORD | \
|
|
|
|
VERT_INDEX | \
|
|
|
|
VERT_EDGE | \
|
|
|
|
VERT_NORM)
|
2000-11-24 15:21:59 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
#define VERT_CURRENT_DATA (VERT_FIXUP | \
|
|
|
|
VERT_MATERIAL)
|
|
|
|
|
|
|
|
#define VERT_DATA (VERT_TEX_ANY | \
|
2000-11-24 15:21:59 +00:00
|
|
|
VERT_RGBA | \
|
|
|
|
VERT_SPEC_RGB | \
|
|
|
|
VERT_FOG_COORD | \
|
|
|
|
VERT_INDEX | \
|
|
|
|
VERT_EDGE | \
|
2000-12-26 05:09:27 +00:00
|
|
|
VERT_NORM | \
|
|
|
|
VERT_OBJ | \
|
|
|
|
VERT_MATERIAL | \
|
|
|
|
VERT_ELT | \
|
|
|
|
VERT_EVAL_ANY)
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* KW: Represents everything that can take place between a begin and
|
2000-12-26 05:09:27 +00:00
|
|
|
* end, and can represent multiple begin/end pairs. Can be used to
|
|
|
|
* losslessly encode this information in display lists.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-11-22 07:32:16 +00:00
|
|
|
struct immediate
|
|
|
|
{
|
2000-12-26 05:09:27 +00:00
|
|
|
struct __GLcontextRec *backref;
|
2000-11-16 21:05:34 +00:00
|
|
|
GLuint id, ref_count;
|
|
|
|
|
|
|
|
/* This must be saved when immediates are shared in display lists.
|
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint CopyStart, Start, Count;
|
2000-11-16 21:05:34 +00:00
|
|
|
GLuint LastData; /* count or count+1 */
|
2000-11-24 10:25:05 +00:00
|
|
|
GLuint AndFlag, OrFlag;
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint TexSize; /* keep track of texcoord sizes */
|
2000-11-24 10:25:05 +00:00
|
|
|
GLuint BeginState, SavedBeginState;
|
2000-11-16 21:05:34 +00:00
|
|
|
GLuint LastPrimitive;
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint ArrayEltFlags; /* precalc'ed for glArrayElt */
|
|
|
|
GLuint ArrayEltIncr;
|
2000-11-16 21:05:34 +00:00
|
|
|
GLuint ArrayEltFlush;
|
|
|
|
GLuint FlushElt;
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint MaxTextureUnits; /* precalc'ed for glMultiTexCoordARB */
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Temporary values created when vertices are copied into the
|
|
|
|
* first 3 slots of the struct:
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint CopyOrFlag;
|
|
|
|
GLuint CopyAndFlag;
|
|
|
|
GLuint CopyTexSize;
|
|
|
|
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* allocate storage for these on demand:
|
|
|
|
*/
|
|
|
|
struct gl_material (*Material)[2];
|
|
|
|
GLuint *MaterialMask;
|
2001-02-15 01:33:52 +00:00
|
|
|
GLuint LastMaterial;
|
|
|
|
GLuint MaterialOrMask;
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4];
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint Primitive[IMM_SIZE]; /* BEGIN/END */
|
|
|
|
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
|
|
|
|
GLuint Flag[IMM_SIZE]; /* VERT_* flags */
|
|
|
|
GLchan Color[IMM_SIZE][4];
|
|
|
|
GLfloat Obj[IMM_SIZE][4];
|
|
|
|
GLfloat Normal[IMM_SIZE][3];
|
|
|
|
GLfloat TexCoord0[IMM_SIZE][4]; /* just VERT_TEX0 */
|
|
|
|
GLuint Elt[IMM_SIZE];
|
|
|
|
GLubyte EdgeFlag[IMM_SIZE];
|
|
|
|
GLuint Index[IMM_SIZE];
|
2001-01-24 00:04:58 +00:00
|
|
|
GLchan SecondaryColor[IMM_SIZE][4];
|
2000-12-26 05:09:27 +00:00
|
|
|
GLfloat FogCoord[IMM_SIZE];
|
|
|
|
};
|
2000-11-22 07:32:16 +00:00
|
|
|
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
struct vertex_arrays
|
|
|
|
{
|
|
|
|
GLvector4f Obj;
|
|
|
|
GLvector3f Normal;
|
2001-01-24 00:04:58 +00:00
|
|
|
#if CHAN_TYPE == GL_UNSIGNED_BYTE
|
2000-12-26 05:09:27 +00:00
|
|
|
GLvector4ub Color;
|
2001-01-24 00:04:58 +00:00
|
|
|
GLvector4ub SecondaryColor;
|
|
|
|
#elif CHAN_TYPE == GL_UNSIGNED_SHORT
|
|
|
|
GLvector4us Color;
|
|
|
|
GLvector4us SecondaryColor;
|
|
|
|
#elif CHAN_TYPE == GL_FLOAT
|
|
|
|
GLvector4f Color;
|
|
|
|
GLvector4f SecondaryColor;
|
|
|
|
#endif
|
2000-12-26 05:09:27 +00:00
|
|
|
GLvector1ui Index;
|
|
|
|
GLvector1ub EdgeFlag;
|
|
|
|
GLvector4f TexCoord[MAX_TEXTURE_UNITS];
|
|
|
|
GLvector1ui Elt;
|
|
|
|
GLvector1f FogCoord;
|
2000-11-16 21:05:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
typedef struct gl_material GLmaterial;
|
|
|
|
|
|
|
|
/* Contains the current state of a running pipeline.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
|
|
|
typedef struct vertex_buffer
|
|
|
|
{
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Constant over life of the vertex_buffer.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint Size;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Constant over the pipeline.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint Count; /* for everything except Elts */
|
|
|
|
GLuint FirstClipped; /* temp verts for clipping */
|
|
|
|
GLuint FirstPrimitive; /* usually zero */
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Pointers to current data.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint *Elts; /* VERT_ELT */
|
|
|
|
GLvector4f *ObjPtr; /* VERT_OBJ */
|
|
|
|
GLvector4f *EyePtr; /* VERT_EYE */
|
|
|
|
GLvector4f *ClipPtr; /* VERT_CLIP */
|
|
|
|
GLvector4f *ProjectedClipPtr; /* VERT_CLIP (2) */
|
|
|
|
GLubyte ClipOrMask; /* VERT_CLIP (3) */
|
|
|
|
GLubyte *ClipMask; /* VERT_CLIP (4) */
|
|
|
|
GLvector3f *NormalPtr; /* VERT_NORM */
|
2001-01-05 02:26:48 +00:00
|
|
|
GLboolean *EdgeFlag; /* VERT_EDGE */
|
2000-12-26 05:09:27 +00:00
|
|
|
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
|
|
|
|
GLvector1ui *IndexPtr[2]; /* VERT_INDEX */
|
2001-01-24 00:04:58 +00:00
|
|
|
|
|
|
|
#if CHAN_TYPE == GL_UNSIGNED_BYTE
|
2000-12-26 05:09:27 +00:00
|
|
|
GLvector4ub *ColorPtr[2]; /* VERT_RGBA */
|
2001-01-24 00:04:58 +00:00
|
|
|
GLvector4ub *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */
|
|
|
|
#elif CHAN_TYPE == GL_UNSIGNED_SHORT
|
|
|
|
GLvector4us *ColorPtr[2]; /* VERT_RGBA */
|
|
|
|
GLvector4us *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */
|
|
|
|
#elif CHAN_TYPE == GL_FLOAT
|
|
|
|
GLvector4f *ColorPtr[2]; /* VERT_RGBA */
|
|
|
|
GLvector4f *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */
|
|
|
|
#endif
|
2000-12-26 05:09:27 +00:00
|
|
|
GLvector1f *FogCoordPtr; /* VERT_FOG_COORD */
|
|
|
|
GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */
|
|
|
|
GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */
|
|
|
|
GLuint *MaterialMask; /* VERT_MATERIAL, optional */
|
|
|
|
GLuint *Flag; /* VERT_* flags, optional */
|
|
|
|
GLuint *Primitive; /* GL_(mode)|PRIM_* flags */
|
|
|
|
GLuint *PrimitiveLength; /* integers */
|
|
|
|
|
|
|
|
|
|
|
|
GLuint importable_data;
|
|
|
|
void (*import_data)( GLcontext *ctx, GLuint flags, GLuint vecflags );
|
|
|
|
/* Callback to the provider of the untransformed input for the
|
|
|
|
* render stage (or other stages) to call if they need to write into
|
|
|
|
* write-protected arrays, or fixup the stride on input arrays.
|
|
|
|
*
|
|
|
|
* This is currently only necessary for client arrays that make it
|
|
|
|
* as far down the pipeline as the render stage.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint LastClipped;
|
2001-01-05 02:26:48 +00:00
|
|
|
/* Private data from _tnl_render_stage that has no business being
|
|
|
|
* in this struct.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-11-22 07:32:16 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
} TNLvertexbuffer;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Describes an individual operation on the pipeline.
|
|
|
|
*/
|
|
|
|
struct gl_pipeline_stage {
|
|
|
|
const char *name;
|
|
|
|
GLuint check_state; /* All state referenced in check() --
|
|
|
|
* When is the pipeline_stage struct
|
|
|
|
* itself invalidated? Must be
|
|
|
|
* constant.
|
|
|
|
*/
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Usually constant or set by the 'check' callback:
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint run_state; /* All state referenced in run() --
|
|
|
|
* When is the cached output of the
|
|
|
|
* stage invalidated?
|
|
|
|
*/
|
|
|
|
|
|
|
|
GLboolean active; /* True if runnable in current state */
|
|
|
|
GLuint inputs; /* VERT_* inputs to the stage */
|
|
|
|
GLuint outputs; /* VERT_* outputs of the stage */
|
|
|
|
|
|
|
|
/* Set in _tnl_run_pipeline():
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint changed_inputs; /* Generated value -- inputs to the
|
|
|
|
* stage that have changed since last
|
|
|
|
* call to 'run'.
|
|
|
|
*/
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Private data for the pipeline stage:
|
|
|
|
*/
|
|
|
|
void *private;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Free private data. May not be null.
|
|
|
|
*/
|
|
|
|
void (*destroy)( struct gl_pipeline_stage * );
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Called from _tnl_validate_pipeline(). Must update all fields in
|
|
|
|
* the pipeline_stage struct for the current state.
|
|
|
|
*/
|
2000-11-16 21:05:34 +00:00
|
|
|
void (*check)( GLcontext *ctx, struct gl_pipeline_stage * );
|
2000-12-26 05:09:27 +00:00
|
|
|
|
|
|
|
/* Called from _tnl_run_pipeline(). The stage.changed_inputs value
|
|
|
|
* encodes all inputs to thee struct which have changed. If
|
|
|
|
* non-zero, recompute all affected outputs of the stage, otherwise
|
|
|
|
* execute any 'sideeffects' of the stage.
|
|
|
|
*
|
|
|
|
* Return value: GL_TRUE - keep going
|
|
|
|
* GL_FALSE - finished pipeline
|
|
|
|
*/
|
|
|
|
GLboolean (*run)( GLcontext *ctx, struct gl_pipeline_stage * );
|
2000-11-16 21:05:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct gl_pipeline {
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint build_state_trigger; /* state changes which require build */
|
|
|
|
GLuint build_state_changes; /* state changes since last build */
|
|
|
|
GLuint run_state_changes; /* state changes since last run */
|
|
|
|
GLuint run_input_changes; /* VERT_* changes since last run */
|
|
|
|
GLuint inputs; /* VERT_* inputs to pipeline */
|
|
|
|
struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES];
|
|
|
|
GLuint nr_stages;
|
2000-11-16 21:05:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
struct tnl_eval_store {
|
|
|
|
GLuint EvalMap1Flags;
|
|
|
|
GLuint EvalMap2Flags;
|
|
|
|
GLuint EvalNewState;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-27 22:30:29 +00:00
|
|
|
GLfloat Coord[IMM_SIZE][4];
|
2000-12-26 05:09:27 +00:00
|
|
|
GLfloat Obj[IMM_SIZE][4];
|
|
|
|
GLfloat TexCoord[IMM_SIZE][4];
|
|
|
|
GLfloat Normal[IMM_SIZE][3];
|
|
|
|
GLchan Color[IMM_SIZE][4];
|
|
|
|
GLuint Index[IMM_SIZE];
|
|
|
|
GLuint Flag[IMM_SIZE];
|
|
|
|
GLuint Elts[IMM_SIZE];
|
2000-11-24 10:25:05 +00:00
|
|
|
};
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
typedef struct {
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Track whether the module is active.
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
GLboolean bound_exec;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
/* Display list extensions
|
|
|
|
*/
|
|
|
|
GLuint opcode_vertex_cassette;
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Pipeline
|
2000-11-16 21:05:34 +00:00
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
struct gl_pipeline pipeline;
|
|
|
|
struct vertex_buffer vb;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* GLvectors for binding to vb:
|
|
|
|
*/
|
|
|
|
struct vertex_arrays imm_inputs;
|
|
|
|
struct vertex_arrays array_inputs;
|
|
|
|
GLuint *tmp_primitive;
|
|
|
|
GLuint *tmp_primitive_length;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Set when executing an internally generated immediate.
|
|
|
|
*/
|
|
|
|
GLboolean ReplayHardBeginEnd;
|
|
|
|
GLenum CurrentPrimitive;
|
2000-11-24 10:25:05 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Note which vertices need copying over succesive immediates.
|
|
|
|
* Will add save versions to precompute vertex copying where
|
|
|
|
* possible.
|
|
|
|
*/
|
|
|
|
struct immediate *ExecCopySource;
|
|
|
|
GLuint ExecCopyCount;
|
|
|
|
GLuint ExecCopyElts[IMM_MAX_COPIED_VERTS];
|
|
|
|
GLuint ExecCopyTexSize;
|
|
|
|
GLuint ExecParity;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint DlistPrimitive;
|
|
|
|
GLuint DlistPrimitiveLength;
|
|
|
|
GLuint DlistLastPrimitive;
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2001-01-13 05:48:25 +00:00
|
|
|
/* Probably need a better configuration mechanism:
|
|
|
|
*/
|
|
|
|
GLboolean NeedProjCoords;
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Derived state and storage for _tnl_eval_vb:
|
|
|
|
*/
|
|
|
|
struct tnl_eval_store eval;
|
2000-11-24 10:25:05 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
/* Functions to be plugged into dispatch when tnl is active.
|
|
|
|
*/
|
2000-11-24 10:25:05 +00:00
|
|
|
GLvertexformat vtxfmt;
|
|
|
|
|
2000-11-16 21:05:34 +00:00
|
|
|
} TNLcontext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define TNL_CONTEXT(ctx) ((TNLcontext *)(ctx->swtnl_context))
|
|
|
|
#define TNL_CURRENT_IM(ctx) ((struct immediate *)(ctx->swtnl_im))
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
#define TYPE_IDX(t) ((t) & 0xf)
|
|
|
|
#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */
|
2000-11-16 21:05:34 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
extern void _tnl_MakeCurrent( GLcontext *ctx,
|
|
|
|
GLframebuffer *drawBuffer,
|
|
|
|
GLframebuffer *readBuffer );
|
2000-11-16 21:05:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macros for fetching current input buffer.
|
|
|
|
*/
|
|
|
|
#ifdef THREADS
|
|
|
|
#define GET_IMMEDIATE struct immediate *IM = TNL_CURRENT_IM(((GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())))
|
|
|
|
#define SET_IMMEDIATE(ctx, im) ctx->swtnl_im = (void *)im
|
|
|
|
#else
|
2000-11-24 10:25:05 +00:00
|
|
|
extern struct immediate *_tnl_CurrentInput;
|
|
|
|
#define GET_IMMEDIATE struct immediate *IM = _tnl_CurrentInput
|
2000-11-16 21:05:34 +00:00
|
|
|
#define SET_IMMEDIATE(ctx, im) \
|
|
|
|
do { \
|
2000-11-20 13:39:36 +00:00
|
|
|
ctx->swtnl_im = (void *)im; \
|
2000-11-24 10:25:05 +00:00
|
|
|
_tnl_CurrentInput = im; \
|
2000-11-16 21:05:34 +00:00
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
|
2000-11-16 21:05:34 +00:00
|
|
|
#endif
|