⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_context.h

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * mesa 3-D graphics library * Version:  6.5 * * Copyright (C) 1999-2006  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"), * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. *//** * \file t_context.h * \brief TnL module datatypes and definitions. * \author Keith Whitwell *//** * \mainpage The TNL-module * * TNL stands for "transform and lighting", i.e. this module implements * a pipeline that receives as input a buffer of vertices and does all * necessary transformations (rotations, clipping, vertex shader etc.) * and passes then the output to the rasterizer. * * The tnl_pipeline contains the array of all stages, which should be * applied. Each stage is a black-box, which is described by an * tnl_pipeline_stage. The function ::_tnl_run_pipeline applies all the * stages to the vertex_buffer TNLcontext::vb, where the vertex data * is stored. The last stage in the pipeline is the rasterizer. * */#ifndef _T_CONTEXT_H#define _T_CONTEXT_H#include "main/glheader.h"#include "main/mtypes.h"#include "math/m_matrix.h"#include "math/m_vector.h"#include "math/m_xform.h"#include "vbo/vbo.h"#define MAX_PIPELINE_STAGES     30/* * Note: The first attributes match the VERT_ATTRIB_* definitions * in mtypes.h.  However, the tnl module has additional attributes * for materials, color indexes, edge flags, etc. *//* Although it's nice to use these as bit indexes in a DWORD flag, we * could manage without if necessary.  Another limit currently is the * number of bits allocated for these numbers in places like vertex * program instruction formats and register layouts. *//* The bit space exhaustion is a fact now, done by _TNL_ATTRIB_ATTRIBUTE* for * GLSL vertex shader which cannot be aliased with conventional vertex attribs. * Compacting _TNL_ATTRIB_MAT_* attribs would not work, they would not give * as many free bits (11 plus already 1 free bit) as _TNL_ATTRIB_ATTRIBUTE* * attribs want (16). */enum {	_TNL_ATTRIB_POS = 0,	_TNL_ATTRIB_WEIGHT = 1,	_TNL_ATTRIB_NORMAL = 2,	_TNL_ATTRIB_COLOR0 = 3,	_TNL_ATTRIB_COLOR1 = 4,	_TNL_ATTRIB_FOG = 5,	_TNL_ATTRIB_COLOR_INDEX = 6,	_TNL_ATTRIB_EDGEFLAG = 7,	_TNL_ATTRIB_TEX0 = 8,	_TNL_ATTRIB_TEX1 = 9,	_TNL_ATTRIB_TEX2 = 10,	_TNL_ATTRIB_TEX3 = 11,	_TNL_ATTRIB_TEX4 = 12,	_TNL_ATTRIB_TEX5 = 13,	_TNL_ATTRIB_TEX6 = 14,	_TNL_ATTRIB_TEX7 = 15,	_TNL_ATTRIB_GENERIC0 = 16, /* doesn't really exist! */	_TNL_ATTRIB_GENERIC1 = 17,	_TNL_ATTRIB_GENERIC2 = 18,	_TNL_ATTRIB_GENERIC3 = 19,	_TNL_ATTRIB_GENERIC4 = 20,	_TNL_ATTRIB_GENERIC5 = 21,	_TNL_ATTRIB_GENERIC6 = 22,	_TNL_ATTRIB_GENERIC7 = 23,	_TNL_ATTRIB_GENERIC8 = 24,	_TNL_ATTRIB_GENERIC9 = 25,	_TNL_ATTRIB_GENERIC10 = 26,	_TNL_ATTRIB_GENERIC11 = 27,	_TNL_ATTRIB_GENERIC12 = 28,	_TNL_ATTRIB_GENERIC13 = 29,	_TNL_ATTRIB_GENERIC14 = 30,	_TNL_ATTRIB_GENERIC15 = 31,	/* These alias with the generics, but they are not active	 * concurrently, so it's not a problem.  The TNL module	 * doesn't have to do anything about this as this is how they	 * are passed into the _draw_prims callback.	 *	 * When we generate fixed-function replacement programs (in	 * t_vp_build.c currently), they refer to the appropriate	 * generic attribute in order to pick up per-vertex material	 * data.	 */	_TNL_ATTRIB_MAT_FRONT_AMBIENT = 16,	_TNL_ATTRIB_MAT_BACK_AMBIENT = 17,	_TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18,	_TNL_ATTRIB_MAT_BACK_DIFFUSE = 19,	_TNL_ATTRIB_MAT_FRONT_SPECULAR = 20,	_TNL_ATTRIB_MAT_BACK_SPECULAR = 21,	_TNL_ATTRIB_MAT_FRONT_EMISSION = 22,	_TNL_ATTRIB_MAT_BACK_EMISSION = 23,	_TNL_ATTRIB_MAT_FRONT_SHININESS = 24,	_TNL_ATTRIB_MAT_BACK_SHININESS = 25,	_TNL_ATTRIB_MAT_FRONT_INDEXES = 26,	_TNL_ATTRIB_MAT_BACK_INDEXES = 27,	/* This is really a VERT_RESULT, not an attrib.  Need to fix	 * tnl to understand the difference.	 */	_TNL_ATTRIB_POINTSIZE = 16,	_TNL_ATTRIB_MAX = 32} ;#define _TNL_ATTRIB_TEX(u)       (_TNL_ATTRIB_TEX0 + (u))#define _TNL_ATTRIB_GENERIC(n) (_TNL_ATTRIB_GENERIC0 + (n))/* special index used for handing invalid glVertexAttribute() indices */#define _TNL_ATTRIB_ERROR    (_TNL_ATTRIB_GENERIC15 + 1)/** * Handy attribute ranges: */#define _TNL_FIRST_PROG      _TNL_ATTRIB_WEIGHT#define _TNL_LAST_PROG       _TNL_ATTRIB_TEX7#define _TNL_FIRST_TEX       _TNL_ATTRIB_TEX0#define _TNL_LAST_TEX        _TNL_ATTRIB_TEX7#define _TNL_FIRST_GENERIC _TNL_ATTRIB_GENERIC0#define _TNL_LAST_GENERIC  _TNL_ATTRIB_GENERIC15#define _TNL_FIRST_MAT       _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC0 */#define _TNL_LAST_MAT        _TNL_ATTRIB_MAT_BACK_INDEXES  /* GENERIC11 *//* Number of available generic attributes */#define _TNL_NUM_GENERIC 16/* Number of attributes used for evaluators */#define _TNL_NUM_EVAL 16#define PRIM_BEGIN     0x10#define PRIM_END       0x20#define PRIM_MODE_MASK 0x0fstatic INLINE GLuint _tnl_translate_prim( const struct _mesa_prim *prim ){   GLuint flag;   flag = prim->mode;   if (prim->begin) flag |= PRIM_BEGIN;   if (prim->end) flag |= PRIM_END;   return flag;}/** * Contains the current state of a running pipeline. */struct vertex_buffer{   GLuint Size;  /**< Max vertices per vertex buffer, constant */   /* Constant over the pipeline.    */   GLuint Count;  /**< Number of vertices currently in buffer */   /* Pointers to current data.    * XXX some of these fields alias AttribPtr below and should be removed    * such as NormalPtr, TexCoordPtr, FogCoordPtr, etc.    */   GLuint      *Elts;		                   GLvector4f  *ObjPtr;		                /* _TNL_BIT_POS */   GLvector4f  *EyePtr;		                /* _TNL_BIT_POS */   GLvector4f  *ClipPtr;	                /* _TNL_BIT_POS */   GLvector4f  *NdcPtr;                         /* _TNL_BIT_POS */   GLubyte     ClipOrMask;	                /* _TNL_BIT_POS */   GLubyte     ClipAndMask;	                /* _TNL_BIT_POS */   GLubyte     *ClipMask;		        /* _TNL_BIT_POS */   GLvector4f  *NormalPtr;	                /* _TNL_BIT_NORMAL */   GLfloat     *NormalLengthPtr;	        /* _TNL_BIT_NORMAL */   GLboolean   *EdgeFlag;	                /* _TNL_BIT_EDGEFLAG */   GLvector4f  *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */   GLvector4f  *IndexPtr[2];	                /* _TNL_BIT_INDEX */   GLvector4f  *ColorPtr[2];	                /* _TNL_BIT_COLOR0 */   GLvector4f  *SecondaryColorPtr[2];           /* _TNL_BIT_COLOR1 */   GLvector4f  *FogCoordPtr;	                /* _TNL_BIT_FOG */   const struct _mesa_prim  *Primitive;	                 GLuint      PrimitiveCount;	         /* Inputs to the vertex program stage */   GLvector4f *AttribPtr[_TNL_ATTRIB_MAX];      /* GL_NV_vertex_program */};/** * Describes an individual operation on the pipeline. */struct tnl_pipeline_stage{   const char *name;   /* Private data for the pipeline stage:    */   void *privatePtr;   /* Allocate private data    */   GLboolean (*create)( GLcontext *ctx, struct tnl_pipeline_stage * );   /* Free private data.    */   void (*destroy)( struct tnl_pipeline_stage * );   /* Called on any statechange or input array size change or    * input array change to/from zero stride.    */   void (*validate)( GLcontext *ctx, struct tnl_pipeline_stage * );   /* 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 tnl_pipeline_stage * );};/** Contains the array of all pipeline stages. * The default values are defined at the end of t_pipeline.c  */struct tnl_pipeline {      GLuint last_attrib_stride[_TNL_ATTRIB_MAX];   GLuint last_attrib_size[_TNL_ATTRIB_MAX];   GLuint input_changes;   GLuint new_state;   struct tnl_pipeline_stage stages[MAX_PIPELINE_STAGES+1];   GLuint nr_stages;};struct tnl_clipspace;struct tnl_clipspace_attr;typedef void (*tnl_extract_func)( const struct tnl_clipspace_attr *a, 				  GLfloat *out, 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -