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

📄 r200_context.h

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 H
📖 第 1 页 / 共 2 页
字号:
#define GRD_HORZ_GUARD_DISCARD_ADJ 4#define GRD_STATE_SIZE             5/* position changes frequently when lighting in modelpos - separate * out to new state item?   */#define LIT_CMD_0                  0#define LIT_AMBIENT_RED            1#define LIT_AMBIENT_GREEN          2#define LIT_AMBIENT_BLUE           3#define LIT_AMBIENT_ALPHA          4#define LIT_DIFFUSE_RED            5#define LIT_DIFFUSE_GREEN          6#define LIT_DIFFUSE_BLUE           7#define LIT_DIFFUSE_ALPHA          8#define LIT_SPECULAR_RED           9#define LIT_SPECULAR_GREEN         10#define LIT_SPECULAR_BLUE          11#define LIT_SPECULAR_ALPHA         12#define LIT_POSITION_X             13#define LIT_POSITION_Y             14#define LIT_POSITION_Z             15#define LIT_POSITION_W             16#define LIT_DIRECTION_X            17#define LIT_DIRECTION_Y            18#define LIT_DIRECTION_Z            19#define LIT_DIRECTION_W            20#define LIT_ATTEN_QUADRATIC        21#define LIT_ATTEN_LINEAR           22#define LIT_ATTEN_CONST            23#define LIT_ATTEN_XXX              24#define LIT_CMD_1                  25#define LIT_SPOT_DCD               26#define LIT_SPOT_DCM               27#define LIT_SPOT_EXPONENT          28#define LIT_SPOT_CUTOFF            29#define LIT_SPECULAR_THRESH        30#define LIT_RANGE_CUTOFF           31 /* ? */#define LIT_ATTEN_CONST_INV        32#define LIT_STATE_SIZE             33/* Fog */#define FOG_CMD_0      0#define FOG_R          1#define FOG_C          2#define FOG_D          3#define FOG_PAD        4#define FOG_STATE_SIZE 5/* UCP */#define UCP_CMD_0      0#define UCP_X          1#define UCP_Y          2#define UCP_Z          3#define UCP_W          4#define UCP_STATE_SIZE 5/* GLT - Global ambient */#define GLT_CMD_0      0#define GLT_RED        1#define GLT_GREEN      2#define GLT_BLUE       3#define GLT_ALPHA      4#define GLT_STATE_SIZE 5/* EYE */#define EYE_CMD_0          0#define EYE_X              1#define EYE_Y              2#define EYE_Z              3#define EYE_RESCALE_FACTOR 4#define EYE_STATE_SIZE     5/* CST - constant state */#define CST_CMD_0                             0#define CST_PP_CNTL_X                         1#define CST_CMD_1                             2#define CST_RB3D_DEPTHXY_OFFSET               3#define CST_CMD_2                             4#define CST_RE_AUX_SCISSOR_CNTL               5#define CST_CMD_3                             6#define CST_RE_SCISSOR_TL_0                   7#define CST_RE_SCISSOR_BR_0                   8#define CST_CMD_4                             9#define CST_SE_VAP_CNTL_STATUS                10#define CST_CMD_5                             11#define CST_RE_POINTSIZE                      12#define CST_CMD_6                             13#define CST_SE_TCL_INPUT_VTX_0                14#define CST_SE_TCL_INPUT_VTX_1                15#define CST_SE_TCL_INPUT_VTX_2                16#define CST_SE_TCL_INPUT_VTX_3                17#define CST_STATE_SIZE                        18#define PRF_CMD_0         0#define PRF_PP_TRI_PERF   1#define PRF_PP_PERF_CNTL  2#define PRF_STATE_SIZE    3struct r200_hw_state {   /* Head of the linked list of state atoms. */   struct r200_state_atom atomlist;   /* Hardware state, stored as cmdbuf commands:      *   -- Need to doublebuffer for    *           - reviving state after loss of context    *           - eliding noop statechange loops? (except line stipple count)    */   struct r200_state_atom ctx;   struct r200_state_atom set;   struct r200_state_atom vte;   struct r200_state_atom lin;   struct r200_state_atom msk;   struct r200_state_atom vpt;   struct r200_state_atom vap;   struct r200_state_atom vtx;   struct r200_state_atom tcl;   struct r200_state_atom msl;   struct r200_state_atom tcg;   struct r200_state_atom msc;   struct r200_state_atom cst;   struct r200_state_atom tam;   struct r200_state_atom tf;   struct r200_state_atom tex[6];   struct r200_state_atom cube[6];   struct r200_state_atom zbs;   struct r200_state_atom mtl[2];   struct r200_state_atom mat[9];   struct r200_state_atom lit[8]; /* includes vec, scl commands */   struct r200_state_atom ucp[6];   struct r200_state_atom pix[6]; /* pixshader stages */   struct r200_state_atom eye; /* eye pos */   struct r200_state_atom grd; /* guard band clipping */   struct r200_state_atom fog;   struct r200_state_atom glt;   struct r200_state_atom prf;   struct r200_state_atom afs[2];   struct r200_state_atom pvs;   struct r200_state_atom vpi[2];   struct r200_state_atom vpp[2];   struct r200_state_atom atf;   struct r200_state_atom spr;   struct r200_state_atom ptp;   int max_state_size;	/* Number of bytes necessary for a full state emit. */   GLboolean is_dirty, all_dirty;};struct r200_state {   /* Derived state for internal purposes:    */   struct r200_colorbuffer_state color;   struct r200_depthbuffer_state depth;#if 00   struct r200_pixel_state pixel;#endif   struct r200_scissor_state scissor;   struct r200_stencilbuffer_state stencil;   struct r200_stipple_state stipple;   struct r200_texture_state texture;   GLuint envneeded;};/* Need refcounting on dma buffers: */struct r200_dma_buffer {   int refcount;		/* the number of retained regions in buf */   drmBufPtr buf;};#define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset +		\			(rvb)->address - rmesa->dma.buf0_address +	\			(rvb)->start)/* A retained region, eg vertices for indexed vertices. */struct r200_dma_region {   struct r200_dma_buffer *buf;   char *address;		/* == buf->address */   int start, end, ptr;		/* offsets from start of buf */   int aos_start;   int aos_stride;   int aos_size;};struct r200_dma {   /* Active dma region.  Allocations for vertices and retained    * regions come from here.  Also used for emitting random vertices,    * these may be flushed by calling flush_current();    */   struct r200_dma_region current;      void (*flush)( r200ContextPtr );   char *buf0_address;		/* start of buf[0], for index calcs */   GLuint nr_released_bufs;	/* flush after so many buffers released */};struct r200_dri_mirror {   __DRIcontextPrivate	*context;	/* DRI context */   __DRIscreenPrivate	*screen;	/* DRI screen */   __DRIdrawablePrivate	*drawable;	/* DRI drawable bound to this ctx */   __DRIdrawablePrivate	*readable;	/* DRI readable bound to this ctx */   drm_context_t hwContext;   drm_hw_lock_t *hwLock;   int fd;   int drmMinor;};#define R200_CMD_BUF_SZ  (16*1024) struct r200_store {   GLuint statenr;   GLuint primnr;   char cmd_buf[R200_CMD_BUF_SZ];   int cmd_used;      int elts_start;};/* r200_tcl.c */struct r200_tcl_info {   GLuint hw_primitive;/* hw can handle 12 components max */   struct r200_dma_region *aos_components[12];   GLuint nr_aos_components;   GLuint *Elts;   struct r200_dma_region indexed_verts;   struct r200_dma_region vertex_data[15];};/* r200_swtcl.c */struct r200_swtcl_info {   GLuint RenderIndex;      /**    * Size of a hardware vertex.  This is calculated when \c ::vertex_attrs is    * installed in the Mesa state vector.    */   GLuint vertex_size;   /**    * Attributes instructing the Mesa TCL pipeline where / how to put vertex    * data in the hardware buffer.    */   struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];   /**    * Number of elements of \c ::vertex_attrs that are actually used.    */   GLuint vertex_attr_count;   /**    * Cached pointer to the buffer where Mesa will store vertex data.    */   GLubyte *verts;   /* Fallback rasterization functions    */   r200_point_func draw_point;   r200_line_func draw_line;   r200_tri_func draw_tri;   GLuint hw_primitive;   GLenum render_primitive;   GLuint numverts;   /**    * Offset of the 4UB color data within a hardware (swtcl) vertex.    */   GLuint coloroffset;   /**    * Offset of the 3UB specular color data within a hardware (swtcl) vertex.    */   GLuint specoffset;   /**    * Should Mesa project vertex data or will the hardware do it?    */   GLboolean needproj;   struct r200_dma_region indexed_verts;};struct r200_ioctl {   GLuint vertex_offset;   GLuint vertex_size;};#define R200_MAX_PRIMS 64struct r200_prim {   GLuint start;   GLuint end;   GLuint prim;};   /* A maximum total of 29 elements per vertex:  3 floats for position, 3    * floats for normal, 4 floats for color, 4 bytes for secondary color,    * 3 floats for each texture unit (18 floats total).    *     * we maybe need add. 4 to prevent segfault if someone specifies    * GL_TEXTURE6/GL_TEXTURE7 (esp. for the codegen-path) (FIXME: )    *     * The position data is never actually stored here, so 3 elements could be    * trimmed out of the buffer.    */#define R200_MAX_VERTEX_SIZE ((3*6)+11)struct r200_context {   GLcontext *glCtx;			/* Mesa context */   /* Driver and hardware state management    */   struct r200_hw_state hw;   struct r200_state state;   struct r200_vertex_program *curr_vp_hw;   /* Texture object bookkeeping    */   unsigned              nr_heaps;   driTexHeap          * texture_heaps[ RADEON_NR_TEX_HEAPS ];   driTextureObject      swapped;   int                   texture_depth;   float                 initialMaxAnisotropy;   /* Rasterization and vertex state:    */   GLuint TclFallback;   GLuint Fallback;   GLuint NewGLState;   DECLARE_RENDERINPUTS(tnl_index_bitset);	/* index of bits for last tnl_install_attrs */   /* Vertex buffers    */   struct r200_ioctl ioctl;   struct r200_dma dma;   struct r200_store store;   /* A full state emit as of the first state emit in the main store, in case    * the context is lost.    */   struct r200_store backup_store;   /* Page flipping    */   GLuint doPageFlip;   /* Busy waiting    */   GLuint do_usleeps;   GLuint do_irqs;   GLuint irqsEmitted;   drm_radeon_irq_wait_t iw;   /* Clientdata textures;    */   GLuint prefer_gart_client_texturing;   /* Drawable, cliprect and scissor information    */   GLuint numClipRects;			/* Cliprects for the draw buffer */   drm_clip_rect_t *pClipRects;   unsigned int lastStamp;   GLboolean lost_context;   GLboolean save_on_next_emit;   radeonScreenPtr r200Screen;	/* Screen private DRI data */   drm_radeon_sarea_t *sarea;		/* Private SAREA data */   /* TCL stuff    */   GLmatrix TexGenMatrix[R200_MAX_TEXTURE_UNITS];   GLboolean recheck_texgen[R200_MAX_TEXTURE_UNITS];   GLboolean TexGenNeedNormals[R200_MAX_TEXTURE_UNITS];   GLuint TexMatEnabled;   GLuint TexMatCompSel;   GLuint TexGenEnabled;   GLuint TexGenCompSel;   GLmatrix tmpmat;   /* buffer swap    */   int64_t swap_ust;   int64_t swap_missed_ust;   GLuint swap_count;   GLuint swap_missed_count;   /* r200_tcl.c    */   struct r200_tcl_info tcl;   /* r200_swtcl.c    */   struct r200_swtcl_info swtcl;   /* Mirrors of some DRI state    */   struct r200_dri_mirror dri;   /* Configuration cache    */   driOptionCache optionCache;   GLboolean using_hyperz;   GLboolean texmicrotile;  struct ati_fragment_shader *afs_loaded;};#define R200_CONTEXT(ctx)		((r200ContextPtr)(ctx->DriverCtx))static INLINE GLuint r200PackColor( GLuint cpp,					GLubyte r, GLubyte g,					GLubyte b, GLubyte a ){   switch ( cpp ) {   case 2:      return PACK_COLOR_565( r, g, b );   case 4:      return PACK_COLOR_8888( a, r, g, b );   default:      return 0;   }}extern void r200DestroyContext( __DRIcontextPrivate *driContextPriv );extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,				    __DRIcontextPrivate *driContextPriv,				    void *sharedContextPrivate);extern void r200SwapBuffers( __DRIdrawablePrivate *dPriv );extern void r200CopySubBuffer( __DRIdrawablePrivate * dPriv,			       int x, int y, int w, int h );extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv,				  __DRIdrawablePrivate *driDrawPriv,				  __DRIdrawablePrivate *driReadPriv );extern GLboolean r200UnbindContext( __DRIcontextPrivate *driContextPriv );/* ================================================================ * Debugging: */#define DO_DEBUG		1#if DO_DEBUGextern int R200_DEBUG;#else#define R200_DEBUG		0#endif#define DEBUG_TEXTURE	0x001#define DEBUG_STATE	0x002#define DEBUG_IOCTL	0x004#define DEBUG_PRIMS	0x008#define DEBUG_VERTS	0x010#define DEBUG_FALLBACKS	0x020#define DEBUG_VFMT	0x040#define DEBUG_CODEGEN	0x080#define DEBUG_VERBOSE	0x100#define DEBUG_DRI       0x200#define DEBUG_DMA       0x400#define DEBUG_SANITY    0x800#define DEBUG_SYNC      0x1000#define DEBUG_PIXEL     0x2000#define DEBUG_MEMORY    0x4000#endif /* __R200_CONTEXT_H__ */

⌨️ 快捷键说明

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