5 #include "nv_include.h"
7 typedef struct nv10_exa_state {
11 PictTransformPtr transform;
16 static nv10_exa_state_t state;
18 static int NV10TexFormat(int ExaFormat)
20 struct {int exa;int hw;} tex_format[] =
22 {PICT_a8r8g8b8, NV10_TCL_PRIMITIVE_3D_TX_FORMAT_FORMAT_R8G8B8A8_RECT},
23 //{PICT_a1r5g5b5, NV10_TCL_PRIMITIVE_3D_TX_FORMAT_FORMAT_R5G5B5A1},
24 //{PICT_a4r4g4b4, NV10_TCL_PRIMITIVE_3D_TX_FORMAT_FORMAT_R4G4B4A4},
25 //{PICT_a8, NV10_TCL_PRIMITIVE_3D_TX_FORMAT_FORMAT_A8_RECT}
26 // FIXME other formats
30 for(i=0;i<sizeof(tex_format)/sizeof(tex_format[0]);i++)
32 if(tex_format[i].exa==ExaFormat)
33 return tex_format[i].hw;
39 static int NV10DstFormat(int ExaFormat)
41 struct {int exa;int hw;} dst_format[] =
43 {PICT_a8r8g8b8, 0x108},
44 {PICT_x8r8g8b8, 0x108}, // FIXME that one might need more
46 // FIXME other formats
50 for(i=0;i<sizeof(dst_format)/sizeof(dst_format[0]);i++)
52 if(dst_format[i].exa==ExaFormat)
53 return dst_format[i].hw;
59 static Bool NV10CheckTexture(PicturePtr Picture)
61 int w = Picture->pDrawable->width;
62 int h = Picture->pDrawable->height;
64 if ((w > 2046) || (h>2046))
66 if (!NV10TexFormat(Picture->format))
68 if (Picture->filter != PictFilterNearest && Picture->filter != PictFilterBilinear)
70 if (Picture->repeat != RepeatNone)
75 static Bool NV10CheckBuffer(PicturePtr Picture)
77 int w = Picture->pDrawable->width;
78 int h = Picture->pDrawable->height;
80 if ((w > 4096) || (h>4096))
82 if (!NV10DstFormat(Picture->format))
87 Bool NV10CheckComposite(int op,
88 PicturePtr pSrcPicture,
89 PicturePtr pMaskPicture,
90 PicturePtr pDstPicture)
92 // XXX A8 + A8 special case "TO BE DONE LATER"
93 /* if ((!pMaskPicture) &&
94 (pSrcPicture->format == PICT_a8) &&
95 (pDstPicture->format == PICT_a8) )
98 if (!NV10CheckBuffer(pDstPicture))
100 if (!NV10CheckTexture(pSrcPicture))
102 if ((pMaskPicture)&&(!NV10CheckTexture(pMaskPicture)))
108 static void NV10SetTexture(NVPtr pNv,int unit,PicturePtr Pict,PixmapPtr pixmap)
110 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_OFFSET(unit), 1 );
111 OUT_RING (NVAccelGetPixmapOffset(pixmap));
113 int log2w = log2i(Pict->pDrawable->width);
114 int log2h = log2i(Pict->pDrawable->height);
115 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_FORMAT(unit), 1 );
116 OUT_RING ((NV10_TCL_PRIMITIVE_3D_TX_FORMAT_WRAP_T_CLAMP_TO_EDGE) |
117 (NV10_TCL_PRIMITIVE_3D_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE) |
120 (1<<12) | /* lod == 1 */
121 (1<<11) | /* enable NPOT */
122 (NV10TexFormat(Pict->format)) |
126 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_ENABLE(unit), 1 );
127 OUT_RING (NV10_TCL_PRIMITIVE_3D_TX_ENABLE_ENABLE);
129 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_NPOT_PITCH(unit), 1);
130 OUT_RING (exaGetPixmapPitch(pixmap) << 16);
132 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_NPOT_SIZE(unit), 1);
133 OUT_RING ((Pict->pDrawable->width<<16) | Pict->pDrawable->height); /* FIXME alignment restrictions, should be even at least */
135 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_FILTER(unit), 1);
136 if (Pict->filter == PictFilterNearest)
137 OUT_RING ((NV10_TCL_PRIMITIVE_3D_TX_FILTER_MAGNIFY_NEAREST) |
138 (NV10_TCL_PRIMITIVE_3D_TX_FILTER_MINIFY_NEAREST));
140 OUT_RING ((NV10_TCL_PRIMITIVE_3D_TX_FILTER_MAGNIFY_LINEAR) |
141 (NV10_TCL_PRIMITIVE_3D_TX_FILTER_MINIFY_LINEAR));
143 state.unit[unit].width = (float)pixmap->drawable.width;
144 state.unit[unit].height = (float)pixmap->drawable.height;
145 state.unit[unit].transform = Pict->transform;
148 static void NV10SetBuffer(NVPtr pNv,PicturePtr Pict,PixmapPtr pixmap)
151 int w = Pict->pDrawable->width;
152 int h = Pict->pDrawable->height;
154 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_BUFFER_FORMAT, 4);
155 OUT_RING (NV10DstFormat(Pict->format));
156 OUT_RING (((uint32_t)exaGetPixmapPitch(pixmap) << 16) |(uint32_t)exaGetPixmapPitch(pixmap));
157 OUT_RING (NVAccelGetPixmapOffset(pixmap));
159 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2);
160 OUT_RING ((w<<16)|x);
161 OUT_RING ((h<<16)|y);
162 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_MODE, 1); /* clip_mode */
164 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1);
165 OUT_RING (((w-1+x)<<16)|x|0x08000800);
166 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1);
167 OUT_RING (((h-1+y)<<16)|y|0x08000800);
169 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_PROJECTION_MATRIX(0), 16);
176 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2);
179 OUT_RINGf (16777216.0);
183 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_SCALE_X, 4);
190 static void NV10SetMultitexture(NVPtr pNv,int multitex)
196 18141010 NV10_TCL_PRIMITIVE_3D.RC_IN_ALPHA[0] = D_INPUT=ZERO | D_COMPONENT_USAGE=ALPHA | D_MAPPING=UNSIGNED_IDENTITY_NV | C_INPUT=ZERO | C_COMPONENT_USAGE=ALPHA | C_MAPPING=UNSIGNED_IDENTITY_NV | B_INPUT=PRIMARY_COLOR_NV | B_COMPONENT_USAGE=ALPHA | B_MAPPING=UNSIGNED_IDENTITY_NV | A_INPUT=TEXTURE1_ARB | A_COMPONENT_USAGE=ALPHA | A_MAPPING=UNSIGNED_IDENTITY_NV
197 091c1010 NV10_TCL_PRIMITIVE_3D.RC_IN_ALPHA[1] = D_INPUT=ZERO | D_COMPONENT_USAGE=ALPHA | D_MAPPING=UNSIGNED_IDENTITY_NV | C_INPUT=ZERO | C_COMPONENT_USAGE=ALPHA | C_MAPPING=UNSIGNED_IDENTITY_NV | B_INPUT=SPARE0_NV | B_COMPONENT_USAGE=ALPHA | B_MAPPING=UNSIGNED_IDENTITY_NV | A_INPUT=TEXTURE0_ARB | A_COMPONENT_USAGE=BLUE | A_MAPPING=UNSIGNED_IDENTITY_NV
198 08040820 NV10_TCL_PRIMITIVE_3D.RC_IN_RGB[0] = D_INPUT=ZERO | D_COMPONENT_USAGE=RGB | D_MAPPING=UNSIGNED_INVERT_NV | C_INPUT=TEXTURE1_ARB | C_COMPONENT_USAGE=RGB | C_MAPPING=UNSIGNED_IDENTITY_NV | B_INPUT=PRIMARY_COLOR_NV | B_COMPONENT_USAGE=RGB | B_MAPPING=UNSIGNED_IDENTITY_NV | A_INPUT=TEXTURE1_ARB | A_COMPONENT_USAGE=RGB | A_MAPPING=UNSIGNED_IDENTITY_NV
199 090c0920 NV10_TCL_PRIMITIVE_3D.RC_IN_RGB[1] = D_INPUT=ZERO | D_COMPONENT_USAGE=RGB | D_MAPPING=UNSIGNED_INVERT_NV | C_INPUT=TEXTURE0_ARB | C_COMPONENT_USAGE=RGB | C_MAPPING=UNSIGNED_IDENTITY_NV | B_INPUT=SPARE0_NV | B_COMPONENT_USAGE=RGB | B_MAPPING=UNSIGNED_IDENTITY_NV | A_INPUT=TEXTURE0_ARB | A_COMPONENT_USAGE=RGB | A_MAPPING=UNSIGNED_IDENTITY_NV
200 00000000 NV10_TCL_PRIMITIVE_3D.RC_COLOR[0] = B=0 | G=0 | R=0 | A=0
201 00000000 NV10_TCL_PRIMITIVE_3D.RC_COLOR[1] = B=0 | G=0 | R=0 | A=0
202 00000c00 NV10_TCL_PRIMITIVE_3D.RC_OUT_ALPHA[0] = CD_OUTPUT=ZERO | AB_OUTPUT=ZERO | SUM_OUTPUT=SPARE0_NV | CD_DOT_PRODUCT=FALSE | AB_DOT_PRODUCT=FALSE | MUX_SUM=FALSE | BIAS=NONE | SCALE=NONE | leftover=0x00000000/0x0000ffff
203 00000c00 NV10_TCL_PRIMITIVE_3D.RC_OUT_ALPHA[1] = CD_OUTPUT=ZERO | AB_OUTPUT=ZERO | SUM_OUTPUT=SPARE0_NV | CD_DOT_PRODUCT=FALSE | AB_DOT_PRODUCT=FALSE | MUX_SUM=FALSE | BIAS=NONE | SCALE=NONE | leftover=0x00000000/0x0000ffff
204 000010cd NV10_TCL_PRIMITIVE_3D.RC_OUT_RGB[0] = CD_OUTPUT=SPARE1_NV | AB_OUTPUT=SPARE0_NV | SUM_OUTPUT=ZERO | CD_DOT_PRODUCT=TRUE | AB_DOT_PRODUCT=FALSE | MUX_SUM=FALSE | BIAS=NONE | SCALE=NONE | OPERATION=0 | leftover=0x00000000/0x3800ffff
205 280010cd NV10_TCL_PRIMITIVE_3D.RC_OUT_RGB[1] = CD_OUTPUT=SPARE1_NV | AB_OUTPUT=SPARE0_NV | SUM_OUTPUT=ZERO | CD_DOT_PRODUCT=TRUE | AB_DOT_PRODUCT=FALSE | MUX_SUM=FALSE | BIAS=NONE | SCALE=NONE | OPERATION=5 | leftover=0x00000000/0x3800ffff
206 300e0300 NV10_TCL_PRIMITIVE_3D.RC_FINAL0 = D_INPUT=ZERO | D_COMPONENT_USAGE=RGB | D_MAPPING=UNSIGNED_IDENTITY_NV | C_INPUT=FOG | C_COMPONENT_USAGE=RGB | C_MAPPING=UNSIGNED_IDENTITY_NV | B_INPUT=SPARE0_PLUS_SECONDARY_COLOR_NV | B_COMPONENT_USAGE=RGB | B_MAPPING=UNSIGNED_IDENTITY_NV | A_INPUT=ZERO | A_COMPONENT_USAGE=ALPHA | A_MAPPING=UNSIGNED_INVERT_NV
207 0c091c80 NV10_TCL_PRIMITIVE_3D.RC_FINAL1 = COLOR_SUM_CLAMP=TRUE | G_INPUT=SPARE0_NV | G_COMPONENT_USAGE=ALPHA | G_MAPPING=UNSIGNED_IDENTITY_NV | F_INPUT=TEXTURE0_ARB | F_COMPONENT_USAGE=RGB | F_MAPPING=UNSIGNED_IDENTITY_NV | E_INPUT=SPARE0_NV | E_COMPONENT_USAGE=RGB | E_MAPPING=UNSIGNED_IDENTITY_NV | leftover=0x00000000/0xffffff80
208 00042294 size 1, subchannel 1 (0xbeef5601),offset 0x0294,increment
209 00000000 NV10_TCL_PRIMITIVE_3D.LIGHT_MODEL = COLOR_CONTROL=0 | LOCAL_VIEWER=FALSE | leftover=0x00000000/0x00010002
210 000423b8 size 1, subchannel 1 (0xbeef5601),offset 0x03b8,increment
211 00000000 NV10_TCL_PRIMITIVE_3D.COLOR_CONTROL
212 000423bc size 1, subchannel 1 (0xbeef5601),offset 0x03bc,increment
213 00000000 NV10_TCL_PRIMITIVE_3D.ENABLED_LIGHTS = LIGHT0=FALSE | LIGHT1=FALSE | LIGHT2=FALSE | LIGHT3=FALSE | LIGHT4=FALSE | LIGHT5=FALSE | LIGHT6=FALSE | LIGHT7=FALSE | leftover=0x00000000/0x00005555
214 00402500 size 16, subchannel 1 (0xbeef5601),offset 0x0500,increment
219 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_RC_IN_ALPHA(0), 12);
220 OUT_RING (0x18141010);
222 OUT_RING (0x08040820);
226 OUT_RING (0x00000c00);
228 OUT_RING (0x000010cd);
229 OUT_RING (0x18000000);
230 OUT_RING (0x300e0300);
231 OUT_RING (0x0c091c80);
235 static void NV10SetPictOp(NVPtr pNv,int op)
237 struct {int src;int dst;} pictops[] =
239 {0x0000,0x0000}, // PictOpClear
240 {0x0001,0x0000}, // PictOpSrc
241 {0x0000,0x0001}, // PictOpDst
242 {0x0001,0x0303}, // PictOpOver
243 {0x0305,0x0001}, // PictOpOverReverse
244 {0x0304,0x0000}, // PictOpIn
245 {0x0000,0x0302}, // PictOpInReverse
246 {0x0305,0x0000}, // PictOpOut
247 {0x0000,0x0303}, // PictOpOutReverse
248 {0x0304,0x0303}, // PictOpAtop
249 {0x0305,0x0302}, // PictOpAtopReverse
250 {0x0305,0x0303}, // PictOpXor
251 {0x0001,0x0001}, // PictOpAdd
254 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2);
255 OUT_RING (pictops[op].src);
256 OUT_RING (pictops[op].dst);
257 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1);
261 Bool NV10PrepareComposite(int op,
262 PicturePtr pSrcPicture,
263 PicturePtr pMaskPicture,
264 PicturePtr pDstPicture,
269 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
270 NVPtr pNv = NVPTR(pScrn);
273 NV10SetBuffer(pNv,pDstPicture,pDst);
276 NV10SetTexture(pNv,0,pSrcPicture,pSrc);
278 /* Set mask format */
280 NV10SetTexture(pNv,1,pMaskPicture,pMask);
282 /* Set Multitexturing */
283 NV10SetMultitexture(pNv, (pMaskPicture!=NULL));
286 NV10SetPictOp(pNv, op);
288 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_BEGIN_END, 1);
289 OUT_RING (NV10_TCL_PRIMITIVE_3D_VERTEX_BEGIN_END_QUADS);
291 state.have_mask=(pMaskPicture!=NULL);
295 static inline void NV10Vertex(NVPtr pNv,float vx,float vy,float tx,float ty)
297 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_TX0_2F_S, 2);
300 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_POS_3F_X, 3);
306 static inline void NV10MVertex(NVPtr pNv,float vx,float vy,float t0x,float t0y,float t1x,float t1y)
308 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_TX0_2F_S, 2);
311 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_TX1_2F_S, 2);
314 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_POS_3F_X, 3);
320 #define xFixedToFloat(v) \
321 ((float)xFixedToInt((v)) + ((float)xFixedFrac(v) / 65536.0))
324 NV10EXATransformCoord(PictTransformPtr t, int x, int y, float sx, float sy,
325 float *x_ret, float *y_ret)
330 v.vector[0] = IntToxFixed(x);
331 v.vector[1] = IntToxFixed(y);
332 v.vector[2] = xFixed1;
333 PictureTransformPoint(t, &v);
334 *x_ret = xFixedToFloat(v.vector[0]);
335 *y_ret = xFixedToFloat(v.vector[1]);
343 void NV10Composite(PixmapPtr pDst,
353 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
354 NVPtr pNv = NVPTR(pScrn);
355 float sX0, sX1, sY0, sY1;
356 float mX0, mX1, mY0, mY1;
358 NV10EXATransformCoord(state.unit[0].transform, srcX, srcY,
360 state.unit[0].height, &sX0, &sY0);
361 NV10EXATransformCoord(state.unit[0].transform,
362 srcX + width, srcY + height,
364 state.unit[0].height, &sX1, &sY1);
366 if (state.have_mask) {
367 NV10EXATransformCoord(state.unit[1].transform, maskX, maskY,
369 state.unit[1].height, &mX0, &mY0);
370 NV10EXATransformCoord(state.unit[1].transform,
371 maskX + width, maskY + height,
373 state.unit[1].height, &mX1, &mY1);
374 NV10MVertex(pNv , dstX , dstY,sX0 , sY0 , mX0 , mY0);
375 NV10MVertex(pNv , dstX + width , dstY,sX1 , sY0 , mX1 , mY0);
376 NV10MVertex(pNv , dstX + width , dstY + height,sX1 , sY1 , mX1 , mY1);
377 NV10MVertex(pNv , dstX , dstY + height,sX0 , sY1 , mX0 , mY1);
379 NV10Vertex(pNv , dstX , dstY , sX0 , sY0);
380 NV10Vertex(pNv , dstX + width , dstY , sX1 , sY0);
381 NV10Vertex(pNv , dstX + width , dstY + height , sX1 , sY1);
382 NV10Vertex(pNv , dstX , dstY + height , sX0 , sY1);
388 void NV10DoneComposite (PixmapPtr pDst)
390 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
391 NVPtr pNv = NVPTR(pScrn);
393 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_BEGIN_END, 1);
394 OUT_RING (NV10_TCL_PRIMITIVE_3D_VERTEX_BEGIN_END_STOP);
396 exaMarkSync(pDst->drawable.pScreen);
401 NVAccelInitNV10TCL(ScrnInfoPtr pScrn)
403 NVPtr pNv = NVPTR(pScrn);
404 static int have_object = FALSE;
405 uint32_t class = 0, chipset;
408 chipset = (nvReadMC(pNv, 0) >> 20) & 0xff;
409 if ( ((chipset & 0xf0) != NV_ARCH_10) &&
410 ((chipset & 0xf0) != NV_ARCH_20) )
414 class = NV11_TCL_PRIMITIVE_3D;
415 else if (chipset>=0x17)
416 class = NV17_TCL_PRIMITIVE_3D;
417 else if (chipset>=0x11)
418 class = NV11_TCL_PRIMITIVE_3D;
420 class = NV10_TCL_PRIMITIVE_3D;
423 if (!NVDmaCreateContextObject(pNv, Nv3D, class))
428 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DMA_NOTIFY, 1);
429 OUT_RING (NvNullObject);
431 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DMA_IN_MEMORY0, 2);
435 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DMA_IN_MEMORY2, 2);
439 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NOP, 1);
442 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2);
446 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1);
447 OUT_RING ((0x7ff<<16)|0x800);
448 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1);
449 OUT_RING ((0x7ff<<16)|0x800);
452 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 1);
454 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(i), 1);
458 BEGIN_RING(Nv3D, 0x290, 1);
459 OUT_RING ((0x10<<16)|1);
460 BEGIN_RING(Nv3D, 0x3f4, 1);
463 // BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NOTIFY, 1);
465 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NOP, 1);
468 if (class != NV10_TCL_PRIMITIVE_3D) {
470 BEGIN_RING(Nv3D, 0x120, 3);
475 BEGIN_RING(NvImageBlit, 0x120, 3);
480 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NOP, 1);
484 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NOP, 1);
488 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_FOG_ENABLE, 1);
490 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1);
492 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2);
495 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_TX_ENABLE(0), 2);
498 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_RC_IN_ALPHA(0), 12);
499 OUT_RING (0x30141010);
501 OUT_RING (0x20040000);
505 OUT_RING (0x00000c00);
507 OUT_RING (0x00000c00);
508 OUT_RING (0x18000000);
509 OUT_RING (0x300e0300);
510 OUT_RING (0x0c091c80);
511 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1);
513 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DITHER_ENABLE, 2);
516 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE, 1);
518 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_WEIGHT_ENABLE, 2);
521 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 4);
526 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_STENCIL_MASK, 8);
535 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1);
537 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_FOG_ENABLE, 2);
540 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_LIGHT_MODEL, 1);
542 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_COLOR_CONTROL, 1);
544 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1);
546 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 3);
550 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1);
552 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1);
554 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1);
556 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR, 2);
559 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_POINT_SIZE, 1);
561 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_POINT_PARAMETERS_ENABLE, 2);
564 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_LINE_WIDTH, 1);
566 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE, 1);
568 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_POLYGON_MODE_FRONT, 2);
571 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_CULL_FACE, 2);
574 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1);
576 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1);
578 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(0), 8);
582 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_FOG_EQUATION_CONSTANT, 3);
583 OUT_RING (0x3fc00000); /* -1.50 */
584 OUT_RING (0xbdb8aa0a); /* -0.09 */
585 OUT_RING (0); /* 0.00 */
587 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_NOP, 1);
590 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_FOG_MODE, 2);
593 /* for some reason VIEW_MATRIX_ENABLE need to be 6 instead of 4 when
594 * using texturing, except when using the texture matrix
596 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VIEW_MATRIX_ENABLE, 1);
598 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_COLOR_MASK, 1);
599 OUT_RING (0x01010101);
601 /* Set vertex component */
602 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_COL_4F_R, 4);
607 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_COL2_3F_R, 3);
611 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_NOR_3F_X, 3);
615 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_TX0_4F_S, 4);
620 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_TX1_4F_S, 4);
625 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_VERTEX_FOG_1F, 1);
627 BEGIN_RING(Nv3D, NV10_TCL_PRIMITIVE_3D_EDGEFLAG_ENABLE, 1);