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

📄 t_context.h

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 H
📖 第 1 页 / 共 2 页
字号:
				  const GLubyte *v );typedef void (*tnl_insert_func)( const struct tnl_clipspace_attr *a, 				 GLubyte *v, 				 const GLfloat *in );typedef void (*tnl_emit_func)( GLcontext *ctx, 			       GLuint count, 			       GLubyte *dest );/** * Describes how to convert/move a vertex attribute from a vertex array * to a vertex structure. */struct tnl_clipspace_attr{   GLuint attrib;          /* which vertex attrib (0=position, etc) */   GLuint format;   GLuint vertoffset;      /* position of the attrib in the vertex struct */   GLuint vertattrsize;    /* size of the attribute in bytes */   GLubyte *inputptr;   GLuint inputstride;   GLuint inputsize;   const tnl_insert_func *insert;   tnl_insert_func emit;   tnl_extract_func extract;   const GLfloat *vp;   /* NDC->Viewport mapping matrix */};typedef void (*tnl_points_func)( GLcontext *ctx, GLuint first, GLuint last );typedef void (*tnl_line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );typedef void (*tnl_triangle_func)( GLcontext *ctx,				   GLuint v1, GLuint v2, GLuint v3 );typedef void (*tnl_quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,			       GLuint v3, GLuint v4 );typedef void (*tnl_render_func)( GLcontext *ctx, GLuint start, GLuint count,				 GLuint flags );typedef void (*tnl_interp_func)( GLcontext *ctx,				 GLfloat t, GLuint dst, GLuint out, GLuint in,				 GLboolean force_boundary );typedef void (*tnl_copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );typedef void (*tnl_setup_func)( GLcontext *ctx,				GLuint start, GLuint end,				GLuint new_inputs);struct tnl_attr_type {   GLuint format;   GLuint size;   GLuint stride;   GLuint offset;};struct tnl_clipspace_fastpath {   GLuint vertex_size;   GLuint attr_count;   GLboolean match_strides;   struct tnl_attr_type *attr;   tnl_emit_func func;   struct tnl_clipspace_fastpath *next;};/** * Used to describe conversion of vertex arrays to vertex structures. * I.e. Structure of arrays to arrays of structs. */struct tnl_clipspace{   GLboolean need_extras;      GLuint new_inputs;   GLubyte *vertex_buf;   GLuint vertex_size;   GLuint max_vertex_size;   struct tnl_clipspace_attr attr[_TNL_ATTRIB_MAX];   GLuint attr_count;   tnl_emit_func emit;   tnl_interp_func interp;   tnl_copy_pv_func copy_pv;   /* Parameters and constants for codegen:    */   GLboolean need_viewport;   GLfloat vp_scale[4];		   GLfloat vp_xlate[4];   GLfloat chan_scale[4];   GLfloat identity[4];   struct tnl_clipspace_fastpath *fastpath;      void (*codegen_emit)( GLcontext *ctx );};struct tnl_cache_item {   GLuint hash;   void *key;   struct gl_vertex_program *prog;   struct tnl_cache_item *next;};struct tnl_cache {   struct tnl_cache_item **items;   GLuint size, n_items;};struct tnl_device_driver{   /***    *** TNL Pipeline    ***/   void (*RunPipeline)(GLcontext *ctx);   /* Replaces PipelineStart/PipelineFinish -- intended to allow    * drivers to wrap _tnl_run_pipeline() with code to validate state    * and grab/release hardware locks.      */   void (*NotifyMaterialChange)(GLcontext *ctx);   /* Alert tnl-aware drivers of changes to material.    */   void (*NotifyInputChanges)(GLcontext *ctx, GLuint bitmask);   /* Alert tnl-aware drivers of changes to size and stride of input    * arrays.    */   /***    *** Rendering -- These functions called only from t_vb_render.c    ***/   struct   {      void (*Start)(GLcontext *ctx);      void (*Finish)(GLcontext *ctx);      /* Called before and after all rendering operations, including DrawPixels,       * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.       * These are a suitable place for grabbing/releasing hardware locks.       */      void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode);      /* Called between RenderStart() and RenderFinish() to indicate the       * type of primitive we're about to draw.  Mode will be one of the       * modes accepted by glBegin().       */      tnl_interp_func Interp;      /* The interp function is called by the clipping routines when we need       * to generate an interpolated vertex.  All pertinant vertex ancilliary       * data should be computed by interpolating between the 'in' and 'out'       * vertices.       */      tnl_copy_pv_func CopyPV;      /* The copy function is used to make a copy of a vertex.  All pertinant       * vertex attributes should be copied.       */      void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );      /* Render a polygon with <n> vertices whose indexes are in the <elts>       * array.       */      void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );      /* Render a line between the two vertices given by indexes v0 and v1. */      tnl_points_func           Points; /* must now respect vb->elts */      tnl_line_func             Line;      tnl_triangle_func         Triangle;      tnl_quad_func             Quad;      /* These functions are called in order to render points, lines,       * triangles and quads.  These are only called via the T&L module.       */      tnl_render_func          *PrimTabVerts;      tnl_render_func          *PrimTabElts;      /* Render whole unclipped primitives (points, lines, linestrips,       * lineloops, etc).  The tables are indexed by the GL enum of the       * primitive to be rendered.  RenderTabVerts is used for non-indexed       * arrays of vertices.  RenderTabElts is used for indexed arrays of       * vertices.       */      void (*ResetLineStipple)( GLcontext *ctx );      /* Reset the hardware's line stipple counter.       */      tnl_setup_func BuildVertices;      /* This function is called whenever new vertices are required for       * rendering.  The vertices in question are those n such that start       * <= n < end.  The new_inputs parameter indicates those fields of       * the vertex which need to be updated, if only a partial repair of       * the vertex is required.       *       * This function is called only from _tnl_render_stage in tnl/t_render.c.       */            GLboolean (*Multipass)( GLcontext *ctx, GLuint passno );      /* Driver may request additional render passes by returning GL_TRUE       * when this function is called.  This function will be called       * after the first pass, and passes will be made until the function       * returns GL_FALSE.  If no function is registered, only one pass       * is made.       *       * This function will be first invoked with passno == 1.       */   } Render;};#define DECLARE_RENDERINPUTS(name) BITSET64_DECLARE(name, _TNL_ATTRIB_MAX)#define RENDERINPUTS_COPY BITSET64_COPY#define RENDERINPUTS_EQUAL BITSET64_EQUAL#define RENDERINPUTS_ZERO BITSET64_ZERO#define RENDERINPUTS_ONES BITSET64_ONES#define RENDERINPUTS_TEST BITSET64_TEST#define RENDERINPUTS_SET BITSET64_SET#define RENDERINPUTS_CLEAR BITSET64_CLEAR#define RENDERINPUTS_TEST_RANGE BITSET64_TEST_RANGE#define RENDERINPUTS_SET_RANGE BITSET64_SET_RANGE#define RENDERINPUTS_CLEAR_RANGE BITSET64_CLEAR_RANGE/** * Context state for T&L context. */typedef struct{   /* Driver interface.    */   struct tnl_device_driver Driver;   /* Pipeline    */   struct tnl_pipeline pipeline;   struct vertex_buffer vb;   /* Clipspace/ndc/window vertex managment:    */   struct tnl_clipspace clipspace;   /* Probably need a better configuration mechanism:    */   GLboolean NeedNdcCoords;   GLboolean AllowVertexFog;   GLboolean AllowPixelFog;   GLboolean _DoVertexFog;  /* eval fog function at each vertex? */   DECLARE_RENDERINPUTS(render_inputs_bitset);   GLvector4f tmp_inputs[VERT_ATTRIB_MAX];   /* Temp storage for t_draw.c:     */   GLubyte *block[VERT_ATTRIB_MAX];   GLuint nr_blocks;   /* Cache of fixed-function-replacing vertex programs:    */   struct tnl_cache *vp_cache;} TNLcontext;#define TNL_CONTEXT(ctx) ((TNLcontext *)((ctx)->swtnl_context))#define TYPE_IDX(t) ((t) & 0xf)#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1      /* 0xa + 1 */#endif

⌨️ 快捷键说明

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