1fa225cbcSrjs/************************************************************************** 2fa225cbcSrjs * 3fa225cbcSrjs * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 4fa225cbcSrjs * All Rights Reserved. 5fa225cbcSrjs * 6fa225cbcSrjs * Permission is hereby granted, free of charge, to any person obtaining a 7fa225cbcSrjs * copy of this software and associated documentation files (the 8fa225cbcSrjs * "Software"), to deal in the Software without restriction, including 9fa225cbcSrjs * without limitation the rights to use, copy, modify, merge, publish, 10fa225cbcSrjs * distribute, sub license, and/or sell copies of the Software, and to 11fa225cbcSrjs * permit persons to whom the Software is furnished to do so, subject to 12fa225cbcSrjs * the following conditions: 13fa225cbcSrjs * 14fa225cbcSrjs * The above copyright notice and this permission notice (including the 15fa225cbcSrjs * next paragraph) shall be included in all copies or substantial portions 16fa225cbcSrjs * of the Software. 17fa225cbcSrjs * 18fa225cbcSrjs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19fa225cbcSrjs * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20fa225cbcSrjs * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21fa225cbcSrjs * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22fa225cbcSrjs * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23fa225cbcSrjs * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24fa225cbcSrjs * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25fa225cbcSrjs * 26fa225cbcSrjs **************************************************************************/ 27fa225cbcSrjs 28fa225cbcSrjs 29fa225cbcSrjs#ifndef _I830_REG_H_ 30fa225cbcSrjs#define _I830_REG_H_ 31fa225cbcSrjs 32fa225cbcSrjs#define I830_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value) 33fa225cbcSrjs 34fa225cbcSrjs#define CMD_3D (0x3<<29) 35fa225cbcSrjs 36fa225cbcSrjs#define PRIM3D_INLINE (CMD_3D | (0x1f<<24)) 37fa225cbcSrjs#define PRIM3D_TRILIST (0x0<<18) 38fa225cbcSrjs#define PRIM3D_TRISTRIP (0x1<<18) 39fa225cbcSrjs#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) 40fa225cbcSrjs#define PRIM3D_TRIFAN (0x3<<18) 41fa225cbcSrjs#define PRIM3D_POLY (0x4<<18) 42fa225cbcSrjs#define PRIM3D_LINELIST (0x5<<18) 43fa225cbcSrjs#define PRIM3D_LINESTRIP (0x6<<18) 44fa225cbcSrjs#define PRIM3D_RECTLIST (0x7<<18) 45fa225cbcSrjs#define PRIM3D_POINTLIST (0x8<<18) 46fa225cbcSrjs#define PRIM3D_DIB (0x9<<18) 47fa225cbcSrjs#define PRIM3D_CLEAR_RECT (0xa<<18) 48fa225cbcSrjs#define PRIM3D_ZONE_INIT (0xd<<18) 49fa225cbcSrjs#define PRIM3D_MASK (0x1f<<18) 50fa225cbcSrjs 51fa225cbcSrjs#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24)) 52fa225cbcSrjs#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16) 53fa225cbcSrjs#define AA_LINE_ECAAR_WIDTH_0_5 0 54fa225cbcSrjs#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14) 55fa225cbcSrjs#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14) 56fa225cbcSrjs#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14) 57fa225cbcSrjs#define AA_LINE_REGION_WIDTH_ENABLE (1<<8) 58fa225cbcSrjs#define AA_LINE_REGION_WIDTH_0_5 0 59fa225cbcSrjs#define AA_LINE_REGION_WIDTH_1_0 (1<<6) 60fa225cbcSrjs#define AA_LINE_REGION_WIDTH_2_0 (2<<6) 61fa225cbcSrjs#define AA_LINE_REGION_WIDTH_4_0 (3<<6) 62fa225cbcSrjs#define AA_LINE_ENABLE ((1<<1) | 1) 63fa225cbcSrjs#define AA_LINE_DISABLE (1<<1) 64fa225cbcSrjs 65fa225cbcSrjs#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1) 66fa225cbcSrjs/* Dword 1 */ 67fa225cbcSrjs#define BUF_3D_ID_COLOR_BACK (0x3<<24) 68fa225cbcSrjs#define BUF_3D_ID_DEPTH (0x7<<24) 69fa225cbcSrjs#define BUF_3D_USE_FENCE (1<<23) 70fa225cbcSrjs#define BUF_3D_TILED_SURFACE (1<<22) 71fa225cbcSrjs#define BUF_3D_TILE_WALK_X 0 72fa225cbcSrjs#define BUF_3D_TILE_WALK_Y (1<<21) 73fa225cbcSrjs#define BUF_3D_PITCH(x) (((x)/4)<<2) 74fa225cbcSrjs/* Dword 2 */ 75fa225cbcSrjs#define BUF_3D_ADDR(x) ((x) & ~0x3) 76fa225cbcSrjs 77fa225cbcSrjs 78fa225cbcSrjs#define _3DSTATE_COLOR_FACTOR_CMD (CMD_3D | (0x1d<<24) | (0x1<<16)) 79fa225cbcSrjs 80fa225cbcSrjs#define _3DSTATE_COLOR_FACTOR_N_CMD(stage) (CMD_3D | (0x1d<<24) | \ 81fa225cbcSrjs ((0x90+(stage))<<16)) 82fa225cbcSrjs 83fa225cbcSrjs#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16)) 84fa225cbcSrjs 85fa225cbcSrjs#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16)) 86fa225cbcSrjs 87fa225cbcSrjs#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16)) 88fa225cbcSrjs 89fa225cbcSrjs#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16)) 90fa225cbcSrjs 91fa225cbcSrjs 92fa225cbcSrjs#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16)) 93fa225cbcSrjs/* Dword 1 */ 94fa225cbcSrjs#define DSTORG_HORT_BIAS(x) ((x)<<20) 95fa225cbcSrjs#define DSTORG_VERT_BIAS(x) ((x)<<16) 96fa225cbcSrjs#define COLOR_4_2_2_CHNL_WRT_ALL 0 97fa225cbcSrjs#define COLOR_4_2_2_CHNL_WRT_Y (1<<12) 98fa225cbcSrjs#define COLOR_4_2_2_CHNL_WRT_CR (2<<12) 99fa225cbcSrjs#define COLOR_4_2_2_CHNL_WRT_CB (3<<12) 100fa225cbcSrjs#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12) 101fa225cbcSrjs#define COLR_BUF_8BIT 0 102fa225cbcSrjs#define COLR_BUF_RGB555 (1<<8) 103fa225cbcSrjs#define COLR_BUF_RGB565 (2<<8) 104fa225cbcSrjs#define COLR_BUF_ARGB8888 (3<<8) 105fa225cbcSrjs#define COLR_BUF_ARGB4444 (8<<8) 106fa225cbcSrjs#define COLR_BUF_ARGB1555 (9<<8) 107fa225cbcSrjs#define DEPTH_IS_Z 0 108fa225cbcSrjs#define DEPTH_IS_W (1<<6) 109fa225cbcSrjs#define DEPTH_FRMT_16_FIXED 0 110fa225cbcSrjs#define DEPTH_FRMT_16_FLOAT (1<<2) 111fa225cbcSrjs#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2) 112fa225cbcSrjs#define DEPTH_FRMT_24_FLOAT_8_OTHER (3<<2) 113fa225cbcSrjs#define VERT_LINE_STRIDE_1 (1<<1) 114fa225cbcSrjs#define VERT_LINE_STRIDE_0 0 115fa225cbcSrjs#define VERT_LINE_STRIDE_OFS_1 1 116fa225cbcSrjs#define VERT_LINE_STRIDE_OFS_0 0 117fa225cbcSrjs 118fa225cbcSrjs 119fa225cbcSrjs#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3) 120fa225cbcSrjs/* Dword 1 */ 121fa225cbcSrjs#define DRAW_RECT_DIS_DEPTH_OFS (1<<30) 122fa225cbcSrjs#define DRAW_DITHER_OFS_X(x) ((x)<<26) 123fa225cbcSrjs#define DRAW_DITHER_OFS_Y(x) ((x)<<24) 124fa225cbcSrjs/* Dword 2 */ 125fa225cbcSrjs#define DRAW_YMIN(x) ((x)<<16) 126fa225cbcSrjs#define DRAW_XMIN(x) (x) 127fa225cbcSrjs/* Dword 3 */ 128fa225cbcSrjs#define DRAW_YMAX(x) ((x)<<16) 129fa225cbcSrjs#define DRAW_XMAX(x) (x) 130fa225cbcSrjs/* Dword 4 */ 131fa225cbcSrjs#define DRAW_YORG(x) ((x)<<16) 132fa225cbcSrjs#define DRAW_XORG(x) (x) 133fa225cbcSrjs 134fa225cbcSrjs 135fa225cbcSrjs#define _3DSTATE_ENABLES_1_CMD (CMD_3D|(0x3<<24)) 136fa225cbcSrjs#define ENABLE_LOGIC_OP_MASK ((1<<23)|(1<<22)) 137fa225cbcSrjs#define ENABLE_LOGIC_OP ((1<<23)|(1<<22)) 138fa225cbcSrjs#define DISABLE_LOGIC_OP (1<<23) 139fa225cbcSrjs#define ENABLE_STENCIL_TEST ((1<<21)|(1<<20)) 140fa225cbcSrjs#define DISABLE_STENCIL_TEST (1<<21) 141fa225cbcSrjs#define ENABLE_DEPTH_BIAS ((1<<11)|(1<<10)) 142fa225cbcSrjs#define DISABLE_DEPTH_BIAS (1<<11) 143fa225cbcSrjs#define ENABLE_SPEC_ADD_MASK ((1<<9)|(1<<8)) 144fa225cbcSrjs#define ENABLE_SPEC_ADD ((1<<9)|(1<<8)) 145fa225cbcSrjs#define DISABLE_SPEC_ADD (1<<9) 146fa225cbcSrjs#define ENABLE_DIS_FOG_MASK ((1<<7)|(1<<6)) 147fa225cbcSrjs#define ENABLE_FOG ((1<<7)|(1<<6)) 148fa225cbcSrjs#define DISABLE_FOG (1<<7) 149fa225cbcSrjs#define ENABLE_DIS_ALPHA_TEST_MASK ((1<<5)|(1<<4)) 150fa225cbcSrjs#define ENABLE_ALPHA_TEST ((1<<5)|(1<<4)) 151fa225cbcSrjs#define DISABLE_ALPHA_TEST (1<<5) 152fa225cbcSrjs#define ENABLE_DIS_CBLEND_MASK ((1<<3)|(1<<2)) 153fa225cbcSrjs#define ENABLE_COLOR_BLEND ((1<<3)|(1<<2)) 154fa225cbcSrjs#define DISABLE_COLOR_BLEND (1<<3) 155fa225cbcSrjs#define ENABLE_DIS_DEPTH_TEST_MASK ((1<<1)|1) 156fa225cbcSrjs#define ENABLE_DEPTH_TEST ((1<<1)|1) 157fa225cbcSrjs#define DISABLE_DEPTH_TEST (1<<1) 158fa225cbcSrjs 159fa225cbcSrjs/* _3DSTATE_ENABLES_2, p138 */ 160fa225cbcSrjs#define _3DSTATE_ENABLES_2_CMD (CMD_3D|(0x4<<24)) 161fa225cbcSrjs#define ENABLE_STENCIL_WRITE ((1<<21)|(1<<20)) 162fa225cbcSrjs#define DISABLE_STENCIL_WRITE (1<<21) 163fa225cbcSrjs#define ENABLE_TEX_CACHE ((1<<17)|(1<<16)) 164fa225cbcSrjs#define DISABLE_TEX_CACHE (1<<17) 165fa225cbcSrjs#define ENABLE_DITHER ((1<<9)|(1<<8)) 166fa225cbcSrjs#define DISABLE_DITHER (1<<9) 167fa225cbcSrjs#define ENABLE_COLOR_MASK (1<<10) 168fa225cbcSrjs#define WRITEMASK_ALPHA (1<<7) 169fa225cbcSrjs#define WRITEMASK_ALPHA_SHIFT 7 170fa225cbcSrjs#define WRITEMASK_RED (1<<6) 171fa225cbcSrjs#define WRITEMASK_RED_SHIFT 6 172fa225cbcSrjs#define WRITEMASK_GREEN (1<<5) 173fa225cbcSrjs#define WRITEMASK_GREEN_SHIFT 5 174fa225cbcSrjs#define WRITEMASK_BLUE (1<<4) 175fa225cbcSrjs#define WRITEMASK_BLUE_SHIFT 4 176fa225cbcSrjs#define WRITEMASK_MASK ((1<<4)|(1<<5)|(1<<6)|(1<<7)) 177fa225cbcSrjs#define ENABLE_COLOR_WRITE ((1<<3)|(1<<2)) 178fa225cbcSrjs#define DISABLE_COLOR_WRITE (1<<3) 179fa225cbcSrjs#define ENABLE_DIS_DEPTH_WRITE_MASK 0x3 180fa225cbcSrjs#define ENABLE_DEPTH_WRITE ((1<<1)|1) 181fa225cbcSrjs#define DISABLE_DEPTH_WRITE (1<<1) 182fa225cbcSrjs 183fa225cbcSrjs/* _3DSTATE_FOG_COLOR, p139 */ 184fa225cbcSrjs#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24)) 185fa225cbcSrjs#define FOG_COLOR_RED(x) ((x)<<16) 186fa225cbcSrjs#define FOG_COLOR_GREEN(x) ((x)<<8) 187fa225cbcSrjs#define FOG_COLOR_BLUE(x) (x) 188fa225cbcSrjs 189fa225cbcSrjs/* _3DSTATE_FOG_MODE, p140 */ 190fa225cbcSrjs#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2) 191fa225cbcSrjs/* Dword 1 */ 192fa225cbcSrjs#define FOGFUNC_ENABLE (1<<31) 193fa225cbcSrjs#define FOGFUNC_VERTEX 0 194fa225cbcSrjs#define FOGFUNC_PIXEL_EXP (1<<28) 195fa225cbcSrjs#define FOGFUNC_PIXEL_EXP2 (2<<28) 196fa225cbcSrjs#define FOGFUNC_PIXEL_LINEAR (3<<28) 197fa225cbcSrjs#define FOGSRC_INDEX_Z (1<<27) 198fa225cbcSrjs#define FOGSRC_INDEX_W ((1<<27)|(1<<25)) 199fa225cbcSrjs#define FOG_LINEAR_CONST (1<<24) 200fa225cbcSrjs#define FOG_CONST_1(x) ((x)<<4) 201fa225cbcSrjs#define ENABLE_FOG_DENSITY (1<<23) 202fa225cbcSrjs/* Dword 2 */ 203fa225cbcSrjs#define FOG_CONST_2(x) (x) 204fa225cbcSrjs/* Dword 3 */ 205fa225cbcSrjs#define FOG_DENSITY(x) (x) 206fa225cbcSrjs 207fa225cbcSrjs/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p142 */ 208fa225cbcSrjs#define _3DSTATE_INDPT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24)) 209fa225cbcSrjs#define ENABLE_INDPT_ALPHA_BLEND ((1<<23)|(1<<22)) 210fa225cbcSrjs#define DISABLE_INDPT_ALPHA_BLEND (1<<23) 211fa225cbcSrjs#define ALPHA_BLENDFUNC_MASK 0x3f0000 212fa225cbcSrjs#define ENABLE_ALPHA_BLENDFUNC (1<<21) 213fa225cbcSrjs#define ABLENDFUNC_ADD 0 214fa225cbcSrjs#define ABLENDFUNC_SUB (1<<16) 215fa225cbcSrjs#define ABLENDFUNC_RVSE_SUB (2<<16) 216fa225cbcSrjs#define ABLENDFUNC_MIN (3<<16) 217fa225cbcSrjs#define ABLENDFUNC_MAX (4<<16) 218fa225cbcSrjs#define SRC_DST_ABLEND_MASK 0xfff 219fa225cbcSrjs#define ENABLE_SRC_ABLEND_FACTOR (1<<11) 220fa225cbcSrjs#define SRC_ABLEND_FACT(x) ((x)<<6) 221fa225cbcSrjs#define ENABLE_DST_ABLEND_FACTOR (1<<5) 222fa225cbcSrjs#define DST_ABLEND_FACT(x) (x) 223fa225cbcSrjs 224fa225cbcSrjs#define BLENDFACTOR_ZERO 0x01 225fa225cbcSrjs#define BLENDFACTOR_ONE 0x02 226fa225cbcSrjs#define BLENDFACTOR_SRC_COLR 0x03 227fa225cbcSrjs#define BLENDFACTOR_INV_SRC_COLR 0x04 228fa225cbcSrjs#define BLENDFACTOR_SRC_ALPHA 0x05 229fa225cbcSrjs#define BLENDFACTOR_INV_SRC_ALPHA 0x06 230fa225cbcSrjs#define BLENDFACTOR_DST_ALPHA 0x07 231fa225cbcSrjs#define BLENDFACTOR_INV_DST_ALPHA 0x08 232fa225cbcSrjs#define BLENDFACTOR_DST_COLR 0x09 233fa225cbcSrjs#define BLENDFACTOR_INV_DST_COLR 0x0a 234fa225cbcSrjs#define BLENDFACTOR_SRC_ALPHA_SATURATE 0x0b 235fa225cbcSrjs#define BLENDFACTOR_CONST_COLOR 0x0c 236fa225cbcSrjs#define BLENDFACTOR_INV_CONST_COLOR 0x0d 237fa225cbcSrjs#define BLENDFACTOR_CONST_ALPHA 0x0e 238fa225cbcSrjs#define BLENDFACTOR_INV_CONST_ALPHA 0x0f 239fa225cbcSrjs#define BLENDFACTOR_MASK 0x0f 240fa225cbcSrjs 241fa225cbcSrjs/* _3DSTATE_MAP_BLEND_ARG, p152 */ 242fa225cbcSrjs#define _3DSTATE_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20)) 243fa225cbcSrjs 244fa225cbcSrjs#define TEXPIPE_COLOR 0 245fa225cbcSrjs#define TEXPIPE_ALPHA (1<<18) 246fa225cbcSrjs#define TEXPIPE_KILL (2<<18) 247fa225cbcSrjs#define TEXBLEND_ARG0 0 248fa225cbcSrjs#define TEXBLEND_ARG1 (1<<15) 249fa225cbcSrjs#define TEXBLEND_ARG2 (2<<15) 250fa225cbcSrjs#define TEXBLEND_ARG3 (3<<15) 251fa225cbcSrjs#define TEXBLENDARG_MODIFY_PARMS (1<<6) 252fa225cbcSrjs#define TEXBLENDARG_REPLICATE_ALPHA (1<<5) 253fa225cbcSrjs#define TEXBLENDARG_INV_ARG (1<<4) 254fa225cbcSrjs#define TEXBLENDARG_ONE 0 255fa225cbcSrjs#define TEXBLENDARG_FACTOR 0x01 256fa225cbcSrjs#define TEXBLENDARG_ACCUM 0x02 257fa225cbcSrjs#define TEXBLENDARG_DIFFUSE 0x03 258fa225cbcSrjs#define TEXBLENDARG_SPEC 0x04 259fa225cbcSrjs#define TEXBLENDARG_CURRENT 0x05 260fa225cbcSrjs#define TEXBLENDARG_TEXEL0 0x06 261fa225cbcSrjs#define TEXBLENDARG_TEXEL1 0x07 262fa225cbcSrjs#define TEXBLENDARG_TEXEL2 0x08 263fa225cbcSrjs#define TEXBLENDARG_TEXEL3 0x09 264fa225cbcSrjs#define TEXBLENDARG_FACTOR_N 0x0e 265fa225cbcSrjs 266fa225cbcSrjs/* _3DSTATE_MAP_BLEND_OP, p155 */ 267fa225cbcSrjs#define _3DSTATE_MAP_BLEND_OP_CMD(stage) (CMD_3D|(0x0d<<24)|((stage)<<20)) 268fa225cbcSrjs#if 0 269fa225cbcSrjs# define TEXPIPE_COLOR 0 270fa225cbcSrjs# define TEXPIPE_ALPHA (1<<18) 271fa225cbcSrjs# define TEXPIPE_KILL (2<<18) 272fa225cbcSrjs#endif 273fa225cbcSrjs#define ENABLE_TEXOUTPUT_WRT_SEL (1<<17) 274fa225cbcSrjs#define TEXOP_OUTPUT_CURRENT 0 275fa225cbcSrjs#define TEXOP_OUTPUT_ACCUM (1<<15) 276fa225cbcSrjs#define ENABLE_TEX_CNTRL_STAGE ((1<<12)|(1<<11)) 277fa225cbcSrjs#define DISABLE_TEX_CNTRL_STAGE (1<<12) 278fa225cbcSrjs#define TEXOP_SCALE_SHIFT 9 279fa225cbcSrjs#define TEXOP_SCALE_1X (0 << TEXOP_SCALE_SHIFT) 280fa225cbcSrjs#define TEXOP_SCALE_2X (1 << TEXOP_SCALE_SHIFT) 281fa225cbcSrjs#define TEXOP_SCALE_4X (2 << TEXOP_SCALE_SHIFT) 282fa225cbcSrjs#define TEXOP_MODIFY_PARMS (1<<8) 283fa225cbcSrjs#define TEXOP_LAST_STAGE (1<<7) 284fa225cbcSrjs#define TEXBLENDOP_KILLPIXEL 0x02 285fa225cbcSrjs#define TEXBLENDOP_ARG1 0x01 286fa225cbcSrjs#define TEXBLENDOP_ARG2 0x02 287fa225cbcSrjs#define TEXBLENDOP_MODULATE 0x03 288fa225cbcSrjs#define TEXBLENDOP_ADD 0x06 289fa225cbcSrjs#define TEXBLENDOP_ADDSIGNED 0x07 290fa225cbcSrjs#define TEXBLENDOP_BLEND 0x08 291fa225cbcSrjs#define TEXBLENDOP_BLEND_AND_ADD 0x09 292fa225cbcSrjs#define TEXBLENDOP_SUBTRACT 0x0a 293fa225cbcSrjs#define TEXBLENDOP_DOT3 0x0b 294fa225cbcSrjs#define TEXBLENDOP_DOT4 0x0c 295fa225cbcSrjs#define TEXBLENDOP_MODULATE_AND_ADD 0x0d 296fa225cbcSrjs#define TEXBLENDOP_MODULATE_2X_AND_ADD 0x0e 297fa225cbcSrjs#define TEXBLENDOP_MODULATE_4X_AND_ADD 0x0f 298fa225cbcSrjs 299fa225cbcSrjs/* _3DSTATE_MAP_BUMP_TABLE, p160 TODO */ 300fa225cbcSrjs/* _3DSTATE_MAP_COLOR_CHROMA_KEY, p161 TODO */ 301fa225cbcSrjs 302fa225cbcSrjs#define _3DSTATE_MAP_COORD_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8c<<16)) 303fa225cbcSrjs#define DISABLE_TEX_TRANSFORM (1<<28) 304fa225cbcSrjs#define TEXTURE_SET(x) (x<<29) 305fa225cbcSrjs 306fa225cbcSrjs#define _3DSTATE_VERTEX_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8b<<16)) 307fa225cbcSrjs#define DISABLE_VIEWPORT_TRANSFORM (1<<31) 308fa225cbcSrjs#define DISABLE_PERSPECTIVE_DIVIDE (1<<29) 309fa225cbcSrjs 310fa225cbcSrjs 311fa225cbcSrjs/* _3DSTATE_MAP_COORD_SET_BINDINGS, p162 */ 312fa225cbcSrjs#define _3DSTATE_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16)) 313fa225cbcSrjs#define TEXBIND_MASK3 ((1<<15)|(1<<14)|(1<<13)|(1<<12)) 314fa225cbcSrjs#define TEXBIND_MASK2 ((1<<11)|(1<<10)|(1<<9)|(1<<8)) 315fa225cbcSrjs#define TEXBIND_MASK1 ((1<<7)|(1<<6)|(1<<5)|(1<<4)) 316fa225cbcSrjs#define TEXBIND_MASK0 ((1<<3)|(1<<2)|(1<<1)|1) 317fa225cbcSrjs 318fa225cbcSrjs#define TEXBIND_SET3(x) ((x)<<12) 319fa225cbcSrjs#define TEXBIND_SET2(x) ((x)<<8) 320fa225cbcSrjs#define TEXBIND_SET1(x) ((x)<<4) 321fa225cbcSrjs#define TEXBIND_SET0(x) (x) 322fa225cbcSrjs 323fa225cbcSrjs#define TEXCOORDSRC_KEEP 0 324fa225cbcSrjs#define TEXCOORDSRC_DEFAULT 0x01 325fa225cbcSrjs#define TEXCOORDSRC_VTXSET_0 0x08 326fa225cbcSrjs#define TEXCOORDSRC_VTXSET_1 0x09 327fa225cbcSrjs#define TEXCOORDSRC_VTXSET_2 0x0a 328fa225cbcSrjs#define TEXCOORDSRC_VTXSET_3 0x0b 329fa225cbcSrjs#define TEXCOORDSRC_VTXSET_4 0x0c 330fa225cbcSrjs#define TEXCOORDSRC_VTXSET_5 0x0d 331fa225cbcSrjs#define TEXCOORDSRC_VTXSET_6 0x0e 332fa225cbcSrjs#define TEXCOORDSRC_VTXSET_7 0x0f 333fa225cbcSrjs 334fa225cbcSrjs#define MAP_UNIT(unit) ((unit)<<16) 335fa225cbcSrjs#define MAP_UNIT_MASK (0x7<<16) 336fa225cbcSrjs 337fa225cbcSrjs/* _3DSTATE_MAP_COORD_SETS, p164 */ 338fa225cbcSrjs#define _3DSTATE_MAP_COORD_SET_CMD (CMD_3D|(0x1c<<24)|(0x01<<19)) 339fa225cbcSrjs#define TEXCOORD_SET(n) ((n)<<16) 340fa225cbcSrjs#define ENABLE_TEXCOORD_PARAMS (1<<15) 341fa225cbcSrjs#define TEXCOORDS_ARE_NORMAL (1<<14) 342fa225cbcSrjs#define TEXCOORDS_ARE_IN_TEXELUNITS 0 343fa225cbcSrjs#define TEXCOORDTYPE_CARTESIAN 0 344fa225cbcSrjs#define TEXCOORDTYPE_HOMOGENEOUS (1<<11) 345fa225cbcSrjs#define TEXCOORDTYPE_VECTOR (2<<11) 346fa225cbcSrjs#define TEXCOORDTYPE_MASK (0x7<<11) 347fa225cbcSrjs#define ENABLE_ADDR_V_CNTL (1<<7) 348fa225cbcSrjs#define ENABLE_ADDR_U_CNTL (1<<3) 349fa225cbcSrjs#define TEXCOORD_ADDR_V_MODE(x) ((x)<<4) 350fa225cbcSrjs#define TEXCOORD_ADDR_U_MODE(x) (x) 351fa225cbcSrjs#define TEXCOORDMODE_WRAP 0 352fa225cbcSrjs#define TEXCOORDMODE_MIRROR 1 353fa225cbcSrjs#define TEXCOORDMODE_CLAMP 2 354fa225cbcSrjs#define TEXCOORDMODE_WRAP_SHORTEST 3 355fa225cbcSrjs#define TEXCOORDMODE_CLAMP_BORDER 4 356fa225cbcSrjs#define TEXCOORD_ADDR_V_MASK 0x70 357fa225cbcSrjs#define TEXCOORD_ADDR_U_MASK 0x7 358fa225cbcSrjs 359fa225cbcSrjs/* _3DSTATE_MAP_CUBE, p168 TODO */ 360fa225cbcSrjs#define _3DSTATE_MAP_CUBE (CMD_3D|(0x1c<<24)|(0x0a<<19)) 361fa225cbcSrjs#define CUBE_NEGX_ENABLE (1<<5) 362fa225cbcSrjs#define CUBE_POSX_ENABLE (1<<4) 363fa225cbcSrjs#define CUBE_NEGY_ENABLE (1<<3) 364fa225cbcSrjs#define CUBE_POSY_ENABLE (1<<2) 365fa225cbcSrjs#define CUBE_NEGZ_ENABLE (1<<1) 366fa225cbcSrjs#define CUBE_POSZ_ENABLE (1<<0) 367fa225cbcSrjs 368fa225cbcSrjs#define _3DSTATE_MAP_INFO_CMD (CMD_3D|(0x1d<<24)|(0x0<<16)|3) 369fa225cbcSrjs#define TEXMAP_INDEX(x) ((x)<<28) 370fa225cbcSrjs#define MAP_SURFACE_8BIT (1<<24) 371fa225cbcSrjs#define MAP_SURFACE_16BIT (2<<24) 372fa225cbcSrjs#define MAP_SURFACE_32BIT (3<<24) 373fa225cbcSrjs#define MAP_FORMAT_2D (0) 374fa225cbcSrjs#define MAP_FORMAT_3D_CUBE (1<<11) 375fa225cbcSrjs 376fa225cbcSrjs/* _3DSTATE_MODES_1, p190 */ 377fa225cbcSrjs#define _3DSTATE_MODES_1_CMD (CMD_3D|(0x08<<24)) 378fa225cbcSrjs#define BLENDFUNC_MASK 0x3f0000 379fa225cbcSrjs#define ENABLE_COLR_BLND_FUNC (1<<21) 380fa225cbcSrjs#define BLENDFUNC_ADD 0 381fa225cbcSrjs#define BLENDFUNC_SUB (1<<16) 382fa225cbcSrjs#define BLENDFUNC_RVRSE_SUB (2<<16) 383fa225cbcSrjs#define BLENDFUNC_MIN (3<<16) 384fa225cbcSrjs#define BLENDFUNC_MAX (4<<16) 385fa225cbcSrjs#define SRC_DST_BLND_MASK 0xfff 386fa225cbcSrjs#define ENABLE_SRC_BLND_FACTOR (1<<11) 387fa225cbcSrjs#define ENABLE_DST_BLND_FACTOR (1<<5) 388fa225cbcSrjs#define SRC_BLND_FACT(x) ((x)<<6) 389fa225cbcSrjs#define DST_BLND_FACT(x) (x) 390fa225cbcSrjs 391fa225cbcSrjs 392fa225cbcSrjs/* _3DSTATE_MODES_2, p192 */ 393fa225cbcSrjs#define _3DSTATE_MODES_2_CMD (CMD_3D|(0x0f<<24)) 394fa225cbcSrjs#define ENABLE_GLOBAL_DEPTH_BIAS (1<<22) 395fa225cbcSrjs#define GLOBAL_DEPTH_BIAS(x) ((x)<<14) 396fa225cbcSrjs#define ENABLE_ALPHA_TEST_FUNC (1<<13) 397fa225cbcSrjs#define ENABLE_ALPHA_REF_VALUE (1<<8) 398fa225cbcSrjs#define ALPHA_TEST_FUNC(x) ((x)<<9) 399fa225cbcSrjs#define ALPHA_REF_VALUE(x) (x) 400fa225cbcSrjs 401fa225cbcSrjs#define ALPHA_TEST_REF_MASK 0x3fff 402fa225cbcSrjs 403fa225cbcSrjs/* _3DSTATE_MODES_3, p193 */ 404fa225cbcSrjs#define _3DSTATE_MODES_3_CMD (CMD_3D|(0x02<<24)) 405fa225cbcSrjs#define DEPTH_TEST_FUNC_MASK 0x1f0000 406fa225cbcSrjs#define ENABLE_DEPTH_TEST_FUNC (1<<20) 407fa225cbcSrjs/* Uses COMPAREFUNC */ 408fa225cbcSrjs#define DEPTH_TEST_FUNC(x) ((x)<<16) 409fa225cbcSrjs#define ENABLE_ALPHA_SHADE_MODE (1<<11) 410fa225cbcSrjs#define ENABLE_FOG_SHADE_MODE (1<<9) 411fa225cbcSrjs#define ENABLE_SPEC_SHADE_MODE (1<<7) 412fa225cbcSrjs#define ENABLE_COLOR_SHADE_MODE (1<<5) 413fa225cbcSrjs#define ALPHA_SHADE_MODE(x) ((x)<<10) 414fa225cbcSrjs#define FOG_SHADE_MODE(x) ((x)<<8) 415fa225cbcSrjs#define SPEC_SHADE_MODE(x) ((x)<<6) 416fa225cbcSrjs#define COLOR_SHADE_MODE(x) ((x)<<4) 417fa225cbcSrjs#define CULLMODE_MASK 0xf 418fa225cbcSrjs#define ENABLE_CULL_MODE (1<<3) 419fa225cbcSrjs#define CULLMODE_BOTH 0 420fa225cbcSrjs#define CULLMODE_NONE 1 421fa225cbcSrjs#define CULLMODE_CW 2 422fa225cbcSrjs#define CULLMODE_CCW 3 423fa225cbcSrjs 424fa225cbcSrjs#define SHADE_MODE_LINEAR 0 425fa225cbcSrjs#define SHADE_MODE_FLAT 0x1 426fa225cbcSrjs 427fa225cbcSrjs/* _3DSTATE_MODES_4, p195 */ 428fa225cbcSrjs#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x16<<24)) 429fa225cbcSrjs#define ENABLE_LOGIC_OP_FUNC (1<<23) 430fa225cbcSrjs#define LOGIC_OP_FUNC(x) ((x)<<18) 431fa225cbcSrjs#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21)) 432fa225cbcSrjs#define LOGICOP_CLEAR 0 433fa225cbcSrjs#define LOGICOP_NOR 0x1 434fa225cbcSrjs#define LOGICOP_AND_INV 0x2 435fa225cbcSrjs#define LOGICOP_COPY_INV 0x3 436fa225cbcSrjs#define LOGICOP_AND_RVRSE 0x4 437fa225cbcSrjs#define LOGICOP_INV 0x5 438fa225cbcSrjs#define LOGICOP_XOR 0x6 439fa225cbcSrjs#define LOGICOP_NAND 0x7 440fa225cbcSrjs#define LOGICOP_AND 0x8 441fa225cbcSrjs#define LOGICOP_EQUIV 0x9 442fa225cbcSrjs#define LOGICOP_NOOP 0xa 443fa225cbcSrjs#define LOGICOP_OR_INV 0xb 444fa225cbcSrjs#define LOGICOP_COPY 0xc 445fa225cbcSrjs#define LOGICOP_OR_RVRSE 0xd 446fa225cbcSrjs#define LOGICOP_OR 0xe 447fa225cbcSrjs#define LOGICOP_SET 0xf 448fa225cbcSrjs#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00)) 449fa225cbcSrjs#define ENABLE_STENCIL_TEST_MASK (1<<17) 450fa225cbcSrjs#define STENCIL_TEST_MASK(x) ((x)<<8) 451fa225cbcSrjs#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff)) 452fa225cbcSrjs#define ENABLE_STENCIL_WRITE_MASK (1<<16) 453fa225cbcSrjs#define STENCIL_WRITE_MASK(x) ((x)&0xff) 454fa225cbcSrjs 455fa225cbcSrjs/* _3DSTATE_MODES_5, p196 */ 456fa225cbcSrjs#define _3DSTATE_MODES_5_CMD (CMD_3D|(0x0c<<24)) 457fa225cbcSrjs#define ENABLE_SPRITE_POINT_TEX (1<<23) 458fa225cbcSrjs#define SPRITE_POINT_TEX_ON (1<<22) 459fa225cbcSrjs#define SPRITE_POINT_TEX_OFF 0 460fa225cbcSrjs#define FLUSH_RENDER_CACHE (1<<18) 461fa225cbcSrjs#define FLUSH_TEXTURE_CACHE (1<<16) 462fa225cbcSrjs#define FIXED_LINE_WIDTH_MASK 0xfc00 463fa225cbcSrjs#define ENABLE_FIXED_LINE_WIDTH (1<<15) 464fa225cbcSrjs#define FIXED_LINE_WIDTH(x) ((x)<<10) 465fa225cbcSrjs#define FIXED_POINT_WIDTH_MASK 0x3ff 466fa225cbcSrjs#define ENABLE_FIXED_POINT_WIDTH (1<<9) 467fa225cbcSrjs#define FIXED_POINT_WIDTH(x) (x) 468fa225cbcSrjs 469fa225cbcSrjs/* _3DSTATE_RASTERIZATION_RULES, p198 */ 470fa225cbcSrjs#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24)) 471fa225cbcSrjs#define ENABLE_POINT_RASTER_RULE (1<<15) 472fa225cbcSrjs#define OGL_POINT_RASTER_RULE (1<<13) 473fa225cbcSrjs#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8) 474fa225cbcSrjs#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5) 475fa225cbcSrjs#define ENABLE_TRI_STRIP_PROVOKE_VRTX (1<<2) 476fa225cbcSrjs#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6) 477fa225cbcSrjs#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3) 478fa225cbcSrjs#define TRI_STRIP_PROVOKE_VRTX(x) (x) 479fa225cbcSrjs 480fa225cbcSrjs/* _3DSTATE_SCISSOR_ENABLE, p200 */ 481fa225cbcSrjs#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19)) 482fa225cbcSrjs#define ENABLE_SCISSOR_RECT ((1<<1) | 1) 483fa225cbcSrjs#define DISABLE_SCISSOR_RECT (1<<1) 484fa225cbcSrjs 485fa225cbcSrjs/* _3DSTATE_SCISSOR_RECTANGLE_0, p201 */ 486fa225cbcSrjs#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1) 487fa225cbcSrjs/* Dword 1 */ 488fa225cbcSrjs#define SCISSOR_RECT_0_YMIN(x) ((x)<<16) 489fa225cbcSrjs#define SCISSOR_RECT_0_XMIN(x) (x) 490fa225cbcSrjs/* Dword 2 */ 491fa225cbcSrjs#define SCISSOR_RECT_0_YMAX(x) ((x)<<16) 492fa225cbcSrjs#define SCISSOR_RECT_0_XMAX(x) (x) 493fa225cbcSrjs 494fa225cbcSrjs/* _3DSTATE_STENCIL_TEST, p202 */ 495fa225cbcSrjs#define _3DSTATE_STENCIL_TEST_CMD (CMD_3D|(0x09<<24)) 496fa225cbcSrjs#define ENABLE_STENCIL_PARMS (1<<23) 497fa225cbcSrjs#define STENCIL_OPS_MASK (0xffc000) 498fa225cbcSrjs#define STENCIL_FAIL_OP(x) ((x)<<20) 499fa225cbcSrjs#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17) 500fa225cbcSrjs#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14) 501fa225cbcSrjs 502fa225cbcSrjs#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)) 503fa225cbcSrjs#define ENABLE_STENCIL_TEST_FUNC (1<<13) 504fa225cbcSrjs/* Uses COMPAREFUNC */ 505fa225cbcSrjs#define STENCIL_TEST_FUNC(x) ((x)<<9) 506fa225cbcSrjs#define STENCIL_REF_VALUE_MASK ((1<<8)|0xff) 507fa225cbcSrjs#define ENABLE_STENCIL_REF_VALUE (1<<8) 508fa225cbcSrjs#define STENCIL_REF_VALUE(x) (x) 509fa225cbcSrjs 510fa225cbcSrjs/* _3DSTATE_VERTEX_FORMAT, p204 */ 511fa225cbcSrjs#define _3DSTATE_VFT0_CMD (CMD_3D|(0x05<<24)) 512fa225cbcSrjs#define VFT0_POINT_WIDTH (1<<12) 513fa225cbcSrjs#define VFT0_TEX_COUNT_MASK (7<<8) 514fa225cbcSrjs#define VFT0_TEX_COUNT_SHIFT 8 515fa225cbcSrjs#define VFT0_TEX_COUNT(x) ((x)<<8) 516fa225cbcSrjs#define VFT0_SPEC (1<<7) 517fa225cbcSrjs#define VFT0_DIFFUSE (1<<6) 518fa225cbcSrjs#define VFT0_DEPTH_OFFSET (1<<5) 519fa225cbcSrjs#define VFT0_XYZ (1<<1) 520fa225cbcSrjs#define VFT0_XYZW (2<<1) 521fa225cbcSrjs#define VFT0_XY (3<<1) 522fa225cbcSrjs#define VFT0_XYW (4<<1) 523fa225cbcSrjs#define VFT0_XYZW_MASK (7<<1) 524fa225cbcSrjs 525fa225cbcSrjs/* _3DSTATE_VERTEX_FORMAT_2, p206 */ 526fa225cbcSrjs#define _3DSTATE_VERTEX_FORMAT_2_CMD (CMD_3D|(0x0a<<24)) 527fa225cbcSrjs#define VFT1_TEX7_FMT(x) ((x)<<14) 528fa225cbcSrjs#define VFT1_TEX6_FMT(x) ((x)<<12) 529fa225cbcSrjs#define VFT1_TEX5_FMT(x) ((x)<<10) 530fa225cbcSrjs#define VFT1_TEX4_FMT(x) ((x)<<8) 531fa225cbcSrjs#define VFT1_TEX3_FMT(x) ((x)<<6) 532fa225cbcSrjs#define VFT1_TEX2_FMT(x) ((x)<<4) 533fa225cbcSrjs#define VFT1_TEX1_FMT(x) ((x)<<2) 534fa225cbcSrjs#define VFT1_TEX0_FMT(x) (x) 535fa225cbcSrjs#define VFT1_TEX0_MASK 3 536fa225cbcSrjs#define VFT1_TEX1_SHIFT 2 537fa225cbcSrjs#define TEXCOORDFMT_2D 0 538fa225cbcSrjs#define TEXCOORDFMT_3D 1 539fa225cbcSrjs#define TEXCOORDFMT_4D 2 540fa225cbcSrjs#define TEXCOORDFMT_1D 3 541fa225cbcSrjs 542fa225cbcSrjs/*New stuff picked up along the way */ 543fa225cbcSrjs 544fa225cbcSrjs#define MLC_LOD_BIAS_MASK ((1<<7)-1) 545fa225cbcSrjs 546fa225cbcSrjs 547fa225cbcSrjs/* _3DSTATE_VERTEX_TRANSFORM, p207 */ 548fa225cbcSrjs#define _3DSTATE_VERTEX_TRANS_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|0) 549fa225cbcSrjs#define _3DSTATE_VERTEX_TRANS_MTX_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|6) 550fa225cbcSrjs/* Dword 1 */ 551fa225cbcSrjs#define ENABLE_VIEWPORT_TRANSFORM ((1<<31)|(1<<30)) 552fa225cbcSrjs#define DISABLE_VIEWPORT_TRANSFORM (1<<31) 553fa225cbcSrjs#define ENABLE_PERSP_DIVIDE ((1<<29)|(1<<28)) 554fa225cbcSrjs#define DISABLE_PERSP_DIVIDE (1<<29) 555fa225cbcSrjs#define VRTX_TRANS_LOAD_MATRICES 0x7421 556fa225cbcSrjs#define VRTX_TRANS_NO_LOAD_MATRICES 0x0000 557fa225cbcSrjs/* Dword 2 -> 7 are matrix elements */ 558fa225cbcSrjs 559fa225cbcSrjs/* _3DSTATE_W_STATE, p209 */ 560fa225cbcSrjs#define _3DSTATE_W_STATE_CMD (CMD_3D|(0x1d<<24)|(0x8d<<16)|1) 561fa225cbcSrjs/* Dword 1 */ 562fa225cbcSrjs#define MAGIC_W_STATE_DWORD1 0x00000008 563fa225cbcSrjs/* Dword 2 */ 564fa225cbcSrjs#define WFAR_VALUE(x) (x) 565fa225cbcSrjs 566fa225cbcSrjs 567fa225cbcSrjs/* Stipple command, carried over from the i810, apparently: 568fa225cbcSrjs */ 569fa225cbcSrjs#define _3DSTATE_STIPPLE (CMD_3D|(0x1d<<24)|(0x83<<16)) 570fa225cbcSrjs#define ST1_ENABLE (1<<16) 571fa225cbcSrjs#define ST1_MASK (0xffff) 572fa225cbcSrjs 573fa225cbcSrjs#define _3DSTATE_LOAD_STATE_IMMEDIATE_1 (CMD_3D|(0x1d<<24)|(0x04<<16)) 574fa225cbcSrjs#define I1_LOAD_S(n) (1<<((n)+4)) 575fa225cbcSrjs#define S3_POINT_WIDTH_SHIFT 23 576fa225cbcSrjs#define S3_LINE_WIDTH_SHIFT 19 577fa225cbcSrjs#define S3_ALPHA_SHADE_MODE_SHIFT 18 578fa225cbcSrjs#define S3_FOG_SHADE_MODE_SHIFT 17 579fa225cbcSrjs#define S3_SPEC_SHADE_MODE_SHIFT 16 580fa225cbcSrjs#define S3_COLOR_SHADE_MODE_SHIFT 15 581fa225cbcSrjs#define S3_CULL_MODE_SHIFT 13 582fa225cbcSrjs#define S3_CULLMODE_BOTH (0) 583fa225cbcSrjs#define S3_CULLMODE_NONE (1<<13) 584fa225cbcSrjs#define S3_CULLMODE_CW (2<<13) 585fa225cbcSrjs#define S3_CULLMODE_CCW (3<<13) 586fa225cbcSrjs#define S3_POINT_WIDTH_PRESENT (1<<12) 587fa225cbcSrjs#define S3_SPEC_FOG_PRESENT (1<<11) 588fa225cbcSrjs#define S3_DIFFUSE_PRESENT (1<<10) 589fa225cbcSrjs#define S3_DEPTH_OFFSET_PRESENT (1<<9) 590fa225cbcSrjs#define S3_POSITION_SHIFT 6 591fa225cbcSrjs#define S3_VERTEXHAS_XYZ (1<<6) 592fa225cbcSrjs#define S3_VERTEXHAS_XYZW (2<<6) 593fa225cbcSrjs#define S3_VERTEXHAS_XY (3<<6) 594fa225cbcSrjs#define S3_VERTEXHAS_XYW (4<<6) 595fa225cbcSrjs#define S3_ENABLE_SPEC_ADD (1<<5) 596fa225cbcSrjs#define S3_ENABLE_FOG (1<<4) 597fa225cbcSrjs#define S3_ENABLE_LOCAL_DEPTH_BIAS (1<<3) 598fa225cbcSrjs#define S3_ENABLE_SPRITE_POINT (1<<1) 599fa225cbcSrjs#define S3_ENABLE_ANTIALIASING 1 600fa225cbcSrjs#define S8_ENABLE_ALPHA_TEST (1<<31) 601fa225cbcSrjs#define S8_ALPHA_TEST_FUNC_SHIFT 28 602fa225cbcSrjs#define S8_ALPHA_REFVALUE_SHIFT 20 603fa225cbcSrjs#define S8_ENABLE_DEPTH_TEST (1<<19) 604fa225cbcSrjs#define S8_DEPTH_TEST_FUNC_SHIFT 16 605fa225cbcSrjs#define S8_ENABLE_COLOR_BLEND (1<<15) 606fa225cbcSrjs#define S8_COLOR_BLEND_FUNC_SHIFT 12 607fa225cbcSrjs#define S8_BLENDFUNC_ADD (0) 608fa225cbcSrjs#define S8_BLENDFUNC_SUB (1<<12) 609fa225cbcSrjs#define S8_BLENDFUNC_RVRSE_SUB (2<<12) 610fa225cbcSrjs#define S8_BLENDFUNC_MIN (3<<12) 611fa225cbcSrjs#define S8_BLENDFUNC_MAX (4<<12) 612fa225cbcSrjs#define S8_SRC_BLEND_FACTOR_SHIFT 8 613fa225cbcSrjs#define S8_DST_BLEND_FACTOR_SHIFT 4 614fa225cbcSrjs#define S8_ENABLE_DEPTH_BUFFER_WRITE (1<<3) 615fa225cbcSrjs#define S8_ENABLE_COLOR_BUFFER_WRITE (1<<2) 616fa225cbcSrjs 617fa225cbcSrjs#define _3DSTATE_LOAD_STATE_IMMEDIATE_2 (CMD_3D|(0x1d<<24)|(0x03<<16)) 618fa225cbcSrjs#define LOAD_TEXTURE_MAP(x) (1<<((x)+11)) 619fa225cbcSrjs#define LOAD_TEXTURE_BLEND_STAGE(x) (1<<((x)+7)) 620fa225cbcSrjs#define LOAD_GLOBAL_COLOR_FACTOR (1<<6) 621fa225cbcSrjs 622fa225cbcSrjs#define TM0S0_ADDRESS_MASK 0xfffffffc 623fa225cbcSrjs#define TM0S0_USE_FENCE (1<<1) 624fa225cbcSrjs 625fa225cbcSrjs#define TM0S1_HEIGHT_SHIFT 21 626fa225cbcSrjs#define TM0S1_WIDTH_SHIFT 10 627fa225cbcSrjs#define TM0S1_PALETTE_SELECT (1<<9) 628fa225cbcSrjs#define TM0S1_MAPSURF_FORMAT_MASK (0x7 << 6) 629fa225cbcSrjs#define TM0S1_MAPSURF_FORMAT_SHIFT 6 630fa225cbcSrjs#define MAPSURF_8BIT_INDEXED (0<<6) 631fa225cbcSrjs#define MAPSURF_8BIT (1<<6) 632fa225cbcSrjs#define MAPSURF_16BIT (2<<6) 633fa225cbcSrjs#define MAPSURF_32BIT (3<<6) 634fa225cbcSrjs#define MAPSURF_411 (4<<6) 635fa225cbcSrjs#define MAPSURF_422 (5<<6) 636fa225cbcSrjs#define MAPSURF_COMPRESSED (6<<6) 637fa225cbcSrjs#define MAPSURF_4BIT_INDEXED (7<<6) 638fa225cbcSrjs#define TM0S1_MT_FORMAT_MASK (0x7 << 3) 639fa225cbcSrjs#define TM0S1_MT_FORMAT_SHIFT 3 640fa225cbcSrjs#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */ 641fa225cbcSrjs#define MT_8BIT_IDX_RGB565 (0<<3) /* SURFACE_8BIT_INDEXED */ 642fa225cbcSrjs#define MT_8BIT_IDX_ARGB1555 (1<<3) 643fa225cbcSrjs#define MT_8BIT_IDX_ARGB4444 (2<<3) 644fa225cbcSrjs#define MT_8BIT_IDX_AY88 (3<<3) 645fa225cbcSrjs#define MT_8BIT_IDX_ABGR8888 (4<<3) 646fa225cbcSrjs#define MT_8BIT_IDX_BUMP_88DVDU (5<<3) 647fa225cbcSrjs#define MT_8BIT_IDX_BUMP_655LDVDU (6<<3) 648fa225cbcSrjs#define MT_8BIT_IDX_ARGB8888 (7<<3) 649fa225cbcSrjs#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */ 650fa225cbcSrjs#define MT_8BIT_L8 (1<<3) 651fa225cbcSrjs#define MT_8BIT_A8 (4<<3) 652fa225cbcSrjs#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */ 653fa225cbcSrjs#define MT_16BIT_ARGB1555 (1<<3) 654fa225cbcSrjs#define MT_16BIT_ARGB4444 (2<<3) 655fa225cbcSrjs#define MT_16BIT_AY88 (3<<3) 656fa225cbcSrjs#define MT_16BIT_DIB_ARGB1555_8888 (4<<3) 657fa225cbcSrjs#define MT_16BIT_BUMP_88DVDU (5<<3) 658fa225cbcSrjs#define MT_16BIT_BUMP_655LDVDU (6<<3) 659fa225cbcSrjs#define MT_16BIT_DIB_RGB565_8888 (7<<3) 660fa225cbcSrjs#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */ 661fa225cbcSrjs#define MT_32BIT_ABGR8888 (1<<3) 662fa225cbcSrjs#define MT_32BIT_XRGB8888 (2<<3) 663fa225cbcSrjs#define MT_32BIT_XBGR8888 (3<<3) 664fa225cbcSrjs#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3) 665fa225cbcSrjs#define MT_32BIT_DIB_8888 (7<<3) 666fa225cbcSrjs#define MT_411_YUV411 (0<<3) /* SURFACE_411 */ 667fa225cbcSrjs#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */ 668fa225cbcSrjs#define MT_422_YCRCB_NORMAL (1<<3) 669fa225cbcSrjs#define MT_422_YCRCB_SWAPUV (2<<3) 670fa225cbcSrjs#define MT_422_YCRCB_SWAPUVY (3<<3) 671fa225cbcSrjs#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */ 672fa225cbcSrjs#define MT_COMPRESS_DXT2_3 (1<<3) 673fa225cbcSrjs#define MT_COMPRESS_DXT4_5 (2<<3) 674fa225cbcSrjs#define MT_COMPRESS_FXT1 (3<<3) 675fa225cbcSrjs#define TM0S1_COLORSPACE_CONVERSION (1 << 2) 676fa225cbcSrjs#define TM0S1_TILED_SURFACE (1 << 1) 677fa225cbcSrjs#define TM0S1_TILE_WALK (1 << 0) 678fa225cbcSrjs 679fa225cbcSrjs#define TM0S2_PITCH_SHIFT 21 680fa225cbcSrjs#define TM0S2_CUBE_FACE_ENA_SHIFT 15 681fa225cbcSrjs#define TM0S2_CUBE_FACE_ENA_MASK (1<<15) 682fa225cbcSrjs#define TM0S2_MAP_FORMAT (1<<14) 683fa225cbcSrjs#define TM0S2_MAP_2D (0<<14) 684fa225cbcSrjs#define TM0S2_MAP_3D_CUBE (1<<14) 685fa225cbcSrjs#define TM0S2_VERTICAL_LINE_STRIDE (1<<13) 686fa225cbcSrjs#define TM0S2_VERITCAL_LINE_STRIDE_OFF (1<<12) 687fa225cbcSrjs#define TM0S2_OUTPUT_CHAN_SHIFT 10 688fa225cbcSrjs#define TM0S2_OUTPUT_CHAN_MASK (3<<10) 689fa225cbcSrjs 690fa225cbcSrjs#define TM0S3_MIP_FILTER_MASK (0x3<<30) 691fa225cbcSrjs#define TM0S3_MIP_FILTER_SHIFT 30 692fa225cbcSrjs#define MIPFILTER_NONE 0 693fa225cbcSrjs#define MIPFILTER_NEAREST 1 694fa225cbcSrjs#define MIPFILTER_LINEAR 3 695fa225cbcSrjs#define TM0S3_MAG_FILTER_MASK (0x3<<28) 696fa225cbcSrjs#define TM0S3_MAG_FILTER_SHIFT 28 697fa225cbcSrjs#define TM0S3_MIN_FILTER_MASK (0x3<<26) 698fa225cbcSrjs#define TM0S3_MIN_FILTER_SHIFT 26 699fa225cbcSrjs#define FILTER_NEAREST 0 700fa225cbcSrjs#define FILTER_LINEAR 1 701fa225cbcSrjs#define FILTER_ANISOTROPIC 2 702fa225cbcSrjs 703fa225cbcSrjs#define TM0S3_LOD_BIAS_SHIFT 17 704fa225cbcSrjs#define TM0S3_LOD_BIAS_MASK (0x1ff<<17) 705fa225cbcSrjs#define TM0S3_MAX_MIP_SHIFT 9 706fa225cbcSrjs#define TM0S3_MAX_MIP_MASK (0xff<<9) 707fa225cbcSrjs#define TM0S3_MIN_MIP_SHIFT 3 708fa225cbcSrjs#define TM0S3_MIN_MIP_MASK (0x3f<<3) 709fa225cbcSrjs#define TM0S3_KILL_PIXEL (1<<2) 710fa225cbcSrjs#define TM0S3_KEYED_FILTER (1<<1) 711fa225cbcSrjs#define TM0S3_CHROMA_KEY (1<<0) 712fa225cbcSrjs 713fa225cbcSrjs 714fa225cbcSrjs/* _3DSTATE_MAP_TEXEL_STREAM, p188 */ 715fa225cbcSrjs#define _3DSTATE_MAP_TEX_STREAM_CMD (CMD_3D|(0x1c<<24)|(0x05<<19)) 716fa225cbcSrjs#define DISABLE_TEX_STREAM_BUMP (1<<12) 717fa225cbcSrjs#define ENABLE_TEX_STREAM_BUMP ((1<<12)|(1<<11)) 718fa225cbcSrjs#define TEX_MODIFY_UNIT_0 0 719fa225cbcSrjs#define TEX_MODIFY_UNIT_1 (1<<8) 720fa225cbcSrjs#define ENABLE_TEX_STREAM_COORD_SET (1<<7) 721fa225cbcSrjs#define TEX_STREAM_COORD_SET(x) ((x)<<4) 722fa225cbcSrjs#define ENABLE_TEX_STREAM_MAP_IDX (1<<3) 723fa225cbcSrjs#define TEX_STREAM_MAP_IDX(x) (x) 724fa225cbcSrjs 725fa225cbcSrjs 726fa225cbcSrjs#define FLUSH_MAP_CACHE (1<<0) 727fa225cbcSrjs 728fa225cbcSrjs#define _3DSTATE_MAP_FILTER_CMD (CMD_3D|(0x1c<<24)|(0x02<<19)) 729fa225cbcSrjs#define FILTER_TEXMAP_INDEX(x) ((x) << 16) 730fa225cbcSrjs#define MAG_MODE_FILTER_ENABLE (1 << 5) 731fa225cbcSrjs#define MIN_MODE_FILTER_ENABLE (1 << 2) 732fa225cbcSrjs#define MAG_MAPFILTER_NEAREST (0 << 3) 733fa225cbcSrjs#define MAG_MAPFILTER_LINEAR (1 << 3) 734fa225cbcSrjs#define MAG_MAPFILTER_ANISOTROPIC (2 << 3) 735fa225cbcSrjs#define MIN_MAPFILTER_NEAREST (0) 736fa225cbcSrjs#define MIN_MAPFILTER_LINEAR (1) 737fa225cbcSrjs#define MIN_MAPFILTER_ANISOTROPIC (2) 738fa225cbcSrjs#define ENABLE_KEYS (1<<15) 739fa225cbcSrjs#define DISABLE_COLOR_KEY 0 740fa225cbcSrjs#define DISABLE_CHROMA_KEY 0 741fa225cbcSrjs#define DISABLE_KILL_PIXEL 0 742fa225cbcSrjs#define ENABLE_MIP_MODE_FILTER (1 << 9) 743fa225cbcSrjs#define MIPFILTER_NONE 0 744fa225cbcSrjs#define MIPFILTER_NEAREST 1 745fa225cbcSrjs#define MIPFILTER_LINEAR 3 746fa225cbcSrjs 747fa225cbcSrjs#endif 748