📄 radeon_context.h
字号:
/**************************************************************************Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and VA Linux Systems Inc., Fremont, California.Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.The Weather Channel (TM) funded Tungsten Graphics to develop theinitial release of the Radeon 8500 driver under the XFree86 license.This notice must be preserved.All Rights Reserved.Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:The above copyright notice and this permission notice (including thenext paragraph) shall be included in all copies or substantialportions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIONWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**************************************************************************//* * Authors: * Gareth Hughes <gareth@valinux.com> * Keith Whitwell <keith@tungstengraphics.com> * Kevin E. Martin <martin@valinux.com> * Nicolai Haehnle <prefect_@gmx.net> */#ifndef __RADEON_CONTEXT_H__#define __RADEON_CONTEXT_H__#include "tnl/t_vertex.h"#include "dri_util.h"#include "drm.h"#include "radeon_drm.h"#include "texmem.h"#include "macros.h"#include "mtypes.h"#include "colormac.h"struct radeon_context;typedef struct radeon_context radeonContextRec;typedef struct radeon_context *radeonContextPtr;/* This union is used to avoid warnings/miscompilation with float to uint32_t casts due to strict-aliasing */typedef union { GLfloat f; uint32_t ui32;} float_ui32_type;#include "radeon_lock.h"#include "radeon_screen.h"#include "mm.h"#include "math/m_vector.h"#define TEX_0 0x1#define TEX_1 0x2#define TEX_2 0x4#define TEX_ALL 0x7/* Rasterizing fallbacks *//* See correponding strings in r200_swtcl.c */#define RADEON_FALLBACK_TEXTURE 0x0001#define RADEON_FALLBACK_DRAW_BUFFER 0x0002#define RADEON_FALLBACK_STENCIL 0x0004#define RADEON_FALLBACK_RENDER_MODE 0x0008#define RADEON_FALLBACK_BLEND_EQ 0x0010#define RADEON_FALLBACK_BLEND_FUNC 0x0020#define RADEON_FALLBACK_DISABLE 0x0040#define RADEON_FALLBACK_BORDER_MODE 0x0080/* The blit width for texture uploads */#define BLIT_WIDTH_BYTES 1024/* Use the templated vertex format: */#define COLOR_IS_RGBA#define TAG(x) radeon##x#include "tnl_dd/t_dd_vertex.h"#undef TAGtypedef void (*radeon_tri_func) (radeonContextPtr, radeonVertex *, radeonVertex *, radeonVertex *);typedef void (*radeon_line_func) (radeonContextPtr, radeonVertex *, radeonVertex *);typedef void (*radeon_point_func) (radeonContextPtr, radeonVertex *);struct radeon_colorbuffer_state { GLuint clear; int roundEnable;};struct radeon_depthbuffer_state { GLuint clear; GLfloat scale;};struct radeon_scissor_state { drm_clip_rect_t rect; GLboolean enabled; GLuint numClipRects; /* Cliprects active */ GLuint numAllocedClipRects; /* Cliprects available */ drm_clip_rect_t *pClipRects;};struct radeon_stencilbuffer_state { GLboolean hwBuffer; GLuint clear; /* rb3d_stencilrefmask value */};struct radeon_stipple_state { GLuint mask[32];};/* used for both tcl_vtx and vc_frmt tex bits (they are identical) */#define RADEON_ST_BIT(unit) \(unit == 0 ? RADEON_CP_VC_FRMT_ST0 : (RADEON_CP_VC_FRMT_ST1 >> 2) << (2 * unit))#define RADEON_Q_BIT(unit) \(unit == 0 ? RADEON_CP_VC_FRMT_Q0 : (RADEON_CP_VC_FRMT_Q1 >> 2) << (2 * unit))typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr;/* Texture object in locally shared texture space. */struct radeon_tex_obj { driTextureObject base; GLuint bufAddr; /* Offset to start of locally shared texture block */ GLuint dirty_state; /* Flags (1 per texunit) for whether or not this texobj has dirty hardware state (pp_*) that needs to be brought into the texunit. */ drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS]; /* Six, for the cube faces */ GLboolean image_override; /* Image overridden by GLX_EXT_tfp */ GLuint pp_txfilter; /* hardware register values */ GLuint pp_txformat; GLuint pp_txoffset; /* Image location in texmem. All cube faces follow. */ GLuint pp_txsize; /* npot only */ GLuint pp_txpitch; /* npot only */ GLuint pp_border_color; GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */ GLboolean border_fallback; GLuint tile_bits; /* hw texture tile bits used on this texture */};struct radeon_texture_env_state { radeonTexObjPtr texobj; GLenum format; GLenum envMode;};struct radeon_texture_state { struct radeon_texture_env_state unit[RADEON_MAX_TEXTURE_UNITS];};struct radeon_state_atom { struct radeon_state_atom *next, *prev; const char *name; /* for debug */ int cmd_size; /* size in bytes */ GLuint is_tcl; int *cmd; /* one or more cmd's */ int *lastcmd; /* one or more cmd's */ GLboolean dirty; /* dirty-mark in emit_state_list */ GLboolean(*check) (GLcontext *); /* is this state active? */};/* Trying to keep these relatively short as the variables are becoming * extravagently long. Drop the driver name prefix off the front of * everything - I think we know which driver we're in by now, and keep the * prefix to 3 letters unless absolutely impossible. */#define CTX_CMD_0 0#define CTX_PP_MISC 1#define CTX_PP_FOG_COLOR 2#define CTX_RE_SOLID_COLOR 3#define CTX_RB3D_BLENDCNTL 4#define CTX_RB3D_DEPTHOFFSET 5#define CTX_RB3D_DEPTHPITCH 6#define CTX_RB3D_ZSTENCILCNTL 7#define CTX_CMD_1 8#define CTX_PP_CNTL 9#define CTX_RB3D_CNTL 10#define CTX_RB3D_COLOROFFSET 11#define CTX_CMD_2 12#define CTX_RB3D_COLORPITCH 13#define CTX_STATE_SIZE 14#define SET_CMD_0 0#define SET_SE_CNTL 1#define SET_SE_COORDFMT 2#define SET_CMD_1 3#define SET_SE_CNTL_STATUS 4#define SET_STATE_SIZE 5#define LIN_CMD_0 0#define LIN_RE_LINE_PATTERN 1#define LIN_RE_LINE_STATE 2#define LIN_CMD_1 3#define LIN_SE_LINE_WIDTH 4#define LIN_STATE_SIZE 5#define MSK_CMD_0 0#define MSK_RB3D_STENCILREFMASK 1#define MSK_RB3D_ROPCNTL 2#define MSK_RB3D_PLANEMASK 3#define MSK_STATE_SIZE 4#define VPT_CMD_0 0#define VPT_SE_VPORT_XSCALE 1#define VPT_SE_VPORT_XOFFSET 2#define VPT_SE_VPORT_YSCALE 3#define VPT_SE_VPORT_YOFFSET 4#define VPT_SE_VPORT_ZSCALE 5#define VPT_SE_VPORT_ZOFFSET 6#define VPT_STATE_SIZE 7#define MSC_CMD_0 0#define MSC_RE_MISC 1#define MSC_STATE_SIZE 2#define TEX_CMD_0 0#define TEX_PP_TXFILTER 1#define TEX_PP_TXFORMAT 2#define TEX_PP_TXOFFSET 3#define TEX_PP_TXCBLEND 4#define TEX_PP_TXABLEND 5#define TEX_PP_TFACTOR 6#define TEX_CMD_1 7#define TEX_PP_BORDER_COLOR 8#define TEX_STATE_SIZE 9#define TXR_CMD_0 0 /* rectangle textures */#define TXR_PP_TEX_SIZE 1 /* 0x1d04, 0x1d0c for NPOT! */#define TXR_PP_TEX_PITCH 2 /* 0x1d08, 0x1d10 for NPOT! */#define TXR_STATE_SIZE 3#define CUBE_CMD_0 0#define CUBE_PP_CUBIC_FACES 1#define CUBE_CMD_1 2#define CUBE_PP_CUBIC_OFFSET_0 3#define CUBE_PP_CUBIC_OFFSET_1 4#define CUBE_PP_CUBIC_OFFSET_2 5#define CUBE_PP_CUBIC_OFFSET_3 6#define CUBE_PP_CUBIC_OFFSET_4 7#define CUBE_STATE_SIZE 8#define ZBS_CMD_0 0#define ZBS_SE_ZBIAS_FACTOR 1#define ZBS_SE_ZBIAS_CONSTANT 2#define ZBS_STATE_SIZE 3#define TCL_CMD_0 0#define TCL_OUTPUT_VTXFMT 1#define TCL_OUTPUT_VTXSEL 2#define TCL_MATRIX_SELECT_0 3#define TCL_MATRIX_SELECT_1 4#define TCL_UCP_VERT_BLEND_CTL 5#define TCL_TEXTURE_PROC_CTL 6#define TCL_LIGHT_MODEL_CTL 7#define TCL_PER_LIGHT_CTL_0 8#define TCL_PER_LIGHT_CTL_1 9#define TCL_PER_LIGHT_CTL_2 10#define TCL_PER_LIGHT_CTL_3 11#define TCL_STATE_SIZE 12#define MTL_CMD_0 0#define MTL_EMMISSIVE_RED 1#define MTL_EMMISSIVE_GREEN 2#define MTL_EMMISSIVE_BLUE 3#define MTL_EMMISSIVE_ALPHA 4#define MTL_AMBIENT_RED 5#define MTL_AMBIENT_GREEN 6#define MTL_AMBIENT_BLUE 7#define MTL_AMBIENT_ALPHA 8#define MTL_DIFFUSE_RED 9#define MTL_DIFFUSE_GREEN 10#define MTL_DIFFUSE_BLUE 11#define MTL_DIFFUSE_ALPHA 12#define MTL_SPECULAR_RED 13#define MTL_SPECULAR_GREEN 14#define MTL_SPECULAR_BLUE 15#define MTL_SPECULAR_ALPHA 16#define MTL_SHININESS 17#define MTL_STATE_SIZE 18#define VTX_CMD_0 0#define VTX_SE_COORD_FMT 1#define VTX_STATE_SIZE 2#define MAT_CMD_0 0#define MAT_ELT_0 1#define MAT_STATE_SIZE 17#define GRD_CMD_0 0#define GRD_VERT_GUARD_CLIP_ADJ 1#define GRD_VERT_GUARD_DISCARD_ADJ 2#define GRD_HORZ_GUARD_CLIP_ADJ 3#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_EXPONENT 27#define LIT_SPOT_CUTOFF 28#define LIT_SPECULAR_THRESH 29#define LIT_RANGE_CUTOFF 30 /* ? */#define LIT_ATTEN_CONST_INV 31#define LIT_STATE_SIZE 32/* 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -