Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / mesa / drivers / dri / nouveau / nv10_context.c
1 /*
2  * Copyright (C) 2009-2010 Francisco Jerez.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial
15  * portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  *
25  */
26
27 #include "main/state.h"
28 #include "nouveau_driver.h"
29 #include "nouveau_context.h"
30 #include "nouveau_fbo.h"
31 #include "nouveau_util.h"
32 #include "nv_object.xml.h"
33 #include "nv10_3d.xml.h"
34 #include "nv04_driver.h"
35 #include "nv10_driver.h"
36
37 static const struct dri_extension nv10_extensions[] = {
38         { "GL_ARB_texture_env_crossbar", NULL },
39         { "GL_EXT_texture_rectangle",   NULL },
40         { "GL_ARB_texture_env_combine", NULL },
41         { "GL_ARB_texture_env_dot3",    NULL },
42         { NULL,                         NULL }
43 };
44
45 static GLboolean
46 use_fast_zclear(struct gl_context *ctx, GLbitfield buffers)
47 {
48         struct nouveau_context *nctx = to_nouveau_context(ctx);
49         struct gl_framebuffer *fb = ctx->DrawBuffer;
50
51         if (buffers & BUFFER_BIT_STENCIL) {
52                 /*
53                  * The stencil test is bypassed when fast Z clears are
54                  * enabled.
55                  */
56                 nctx->hierz.clear_blocked = GL_TRUE;
57                 context_dirty(ctx, ZCLEAR);
58                 return GL_FALSE;
59         }
60
61         return !nctx->hierz.clear_blocked &&
62                 fb->_Xmax == fb->Width && fb->_Xmin == 0 &&
63                 fb->_Ymax == fb->Height && fb->_Ymin == 0;
64 }
65
66 GLboolean
67 nv10_use_viewport_zclear(struct gl_context *ctx)
68 {
69         struct nouveau_context *nctx = to_nouveau_context(ctx);
70         struct gl_framebuffer *fb = ctx->DrawBuffer;
71
72         return context_chipset(ctx) < 0x17 &&
73                 !nctx->hierz.clear_blocked && fb->_DepthBuffer &&
74                 (_mesa_get_format_bits(fb->_DepthBuffer->Format,
75                                        GL_DEPTH_BITS) >= 24);
76 }
77
78 float
79 nv10_transform_depth(struct gl_context *ctx, float z)
80 {
81         struct nouveau_context *nctx = to_nouveau_context(ctx);
82
83         if (nv10_use_viewport_zclear(ctx))
84                 return 2097152.0 * (z + (nctx->hierz.clear_seq & 7));
85         else
86                 return ctx->DrawBuffer->_DepthMaxF * z;
87 }
88
89 static void
90 nv10_zclear(struct gl_context *ctx, GLbitfield *buffers)
91 {
92         /*
93          * Pre-nv17 cards don't have native support for fast Z clears,
94          * but in some cases we can still "clear" the Z buffer without
95          * actually blitting to it if we're willing to sacrifice a few
96          * bits of depth precision.
97          *
98          * Each time a clear is requested we modify the viewport
99          * transform in such a way that the old contents of the depth
100          * buffer are clamped to the requested clear value when
101          * they're read by the GPU.
102          */
103         struct nouveau_context *nctx = to_nouveau_context(ctx);
104         struct gl_framebuffer *fb = ctx->DrawBuffer;
105         struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
106         struct nouveau_surface *s = &to_nouveau_renderbuffer(
107                 fb->_DepthBuffer->Wrapped)->surface;
108
109         if (nv10_use_viewport_zclear(ctx)) {
110                 int x, y, w, h;
111                 float z = ctx->Depth.Clear;
112                 uint32_t value = pack_zs_f(s->format, z, 0);
113
114                 get_scissors(fb, &x, &y, &w, &h);
115                 *buffers &= ~BUFFER_BIT_DEPTH;
116
117                 if (use_fast_zclear(ctx, *buffers)) {
118                         if (nfb->hierz.clear_value != value) {
119                                 /* Don't fast clear if we're changing
120                                  * the depth value. */
121                                 nfb->hierz.clear_value = value;
122
123                         } else if (z == 0.0) {
124                                 nctx->hierz.clear_seq++;
125                                 context_dirty(ctx, ZCLEAR);
126
127                                 if ((nctx->hierz.clear_seq & 7) != 0 &&
128                                     nctx->hierz.clear_seq != 1)
129                                         /* We didn't wrap around -- no need to
130                                          * clear the depth buffer for real. */
131                                         return;
132
133                         } else if (z == 1.0) {
134                                 nctx->hierz.clear_seq--;
135                                 context_dirty(ctx, ZCLEAR);
136
137                                 if ((nctx->hierz.clear_seq & 7) != 7)
138                                         /* No wrap around */
139                                         return;
140                         }
141                 }
142
143                 value = pack_zs_f(s->format,
144                                   (z + (nctx->hierz.clear_seq & 7)) / 8, 0);
145                 context_drv(ctx)->surface_fill(ctx, s, ~0, value, x, y, w, h);
146         }
147 }
148
149 static void
150 nv17_zclear(struct gl_context *ctx, GLbitfield *buffers)
151 {
152         struct nouveau_context *nctx = to_nouveau_context(ctx);
153         struct nouveau_channel *chan = context_chan(ctx);
154         struct nouveau_grobj *celsius = context_eng3d(ctx);
155         struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(
156                 ctx->DrawBuffer);
157         struct nouveau_surface *s = &to_nouveau_renderbuffer(
158                 nfb->base._DepthBuffer->Wrapped)->surface;
159
160         /* Clear the hierarchical depth buffer */
161         BEGIN_RING(chan, celsius, NV17_3D_HIERZ_FILL_VALUE, 1);
162         OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, 0));
163         BEGIN_RING(chan, celsius, NV17_3D_HIERZ_BUFFER_CLEAR, 1);
164         OUT_RING(chan, 1);
165
166         /* Mark the depth buffer as cleared */
167         if (use_fast_zclear(ctx, *buffers)) {
168                 if (nctx->hierz.clear_seq)
169                         *buffers &= ~BUFFER_BIT_DEPTH;
170
171                 nfb->hierz.clear_value =
172                         pack_zs_f(s->format, ctx->Depth.Clear, 0);
173                 nctx->hierz.clear_seq++;
174
175                 context_dirty(ctx, ZCLEAR);
176         }
177 }
178
179 static void
180 nv10_clear(struct gl_context *ctx, GLbitfield buffers)
181 {
182         nouveau_validate_framebuffer(ctx);
183
184         if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask) {
185                 if (context_chipset(ctx) >= 0x17)
186                         nv17_zclear(ctx, &buffers);
187                 else
188                         nv10_zclear(ctx, &buffers);
189
190                 /* Emit the zclear state if it's dirty */
191                 _mesa_update_state(ctx);
192         }
193
194         nouveau_clear(ctx, buffers);
195 }
196
197 static void
198 nv10_hwctx_init(struct gl_context *ctx)
199 {
200         struct nouveau_channel *chan = context_chan(ctx);
201         struct nouveau_grobj *celsius = context_eng3d(ctx);
202         struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
203         int i;
204
205         BEGIN_RING(chan, celsius, NV10_3D_DMA_NOTIFY, 1);
206         OUT_RING(chan, hw->ntfy->handle);
207
208         BEGIN_RING(chan, celsius, NV10_3D_DMA_TEXTURE0, 3);
209         OUT_RING(chan, chan->vram->handle);
210         OUT_RING(chan, chan->gart->handle);
211         OUT_RING(chan, chan->gart->handle);
212         BEGIN_RING(chan, celsius, NV10_3D_DMA_COLOR, 2);
213         OUT_RING(chan, chan->vram->handle);
214         OUT_RING(chan, chan->vram->handle);
215
216         BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
217         OUT_RING(chan, 0);
218
219         BEGIN_RING(chan, celsius, NV10_3D_RT_HORIZ, 2);
220         OUT_RING(chan, 0);
221         OUT_RING(chan, 0);
222
223         BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_HORIZ(0), 1);
224         OUT_RING(chan, 0x7ff << 16 | 0x800);
225         BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_VERT(0), 1);
226         OUT_RING(chan, 0x7ff << 16 | 0x800);
227
228         for (i = 1; i < 8; i++) {
229                 BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_HORIZ(i), 1);
230                 OUT_RING(chan, 0);
231                 BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_VERT(i), 1);
232                 OUT_RING(chan, 0);
233         }
234
235         BEGIN_RING(chan, celsius, 0x290, 1);
236         OUT_RING(chan, 0x10 << 16 | 1);
237         BEGIN_RING(chan, celsius, 0x3f4, 1);
238         OUT_RING(chan, 0);
239
240         BEGIN_RING(chan, celsius,  NV04_GRAPH_NOP, 1);
241         OUT_RING(chan, 0);
242
243         if (context_chipset(ctx) >= 0x17) {
244                 BEGIN_RING(chan, celsius, NV17_3D_UNK01AC, 2);
245                 OUT_RING(chan, chan->vram->handle);
246                 OUT_RING(chan, chan->vram->handle);
247
248                 BEGIN_RING(chan, celsius, 0xd84, 1);
249                 OUT_RING(chan, 0x3);
250
251                 BEGIN_RING(chan, celsius, NV17_3D_COLOR_MASK_ENABLE, 1);
252                 OUT_RING(chan, 1);
253         }
254
255         if (context_chipset(ctx) >= 0x11) {
256                 BEGIN_RING(chan, celsius, 0x120, 3);
257                 OUT_RING(chan, 0);
258                 OUT_RING(chan, 1);
259                 OUT_RING(chan, 2);
260
261                 BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
262                 OUT_RING(chan, 0);
263         }
264
265         BEGIN_RING(chan, celsius,  NV04_GRAPH_NOP, 1);
266         OUT_RING(chan, 0);
267
268         /* Set state */
269         BEGIN_RING(chan, celsius, NV10_3D_FOG_ENABLE, 1);
270         OUT_RING(chan, 0);
271         BEGIN_RING(chan, celsius, NV10_3D_ALPHA_FUNC_ENABLE, 1);
272         OUT_RING(chan, 0);
273         BEGIN_RING(chan, celsius, NV10_3D_ALPHA_FUNC_FUNC, 2);
274         OUT_RING(chan, 0x207);
275         OUT_RING(chan, 0);
276         BEGIN_RING(chan, celsius, NV10_3D_TEX_ENABLE(0), 2);
277         OUT_RING(chan, 0);
278         OUT_RING(chan, 0);
279
280         BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_ENABLE, 1);
281         OUT_RING(chan, 0);
282         BEGIN_RING(chan, celsius, NV10_3D_DITHER_ENABLE, 2);
283         OUT_RING(chan, 1);
284         OUT_RING(chan, 0);
285         BEGIN_RING(chan, celsius, NV10_3D_LINE_SMOOTH_ENABLE, 1);
286         OUT_RING(chan, 0);
287         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_WEIGHT_ENABLE, 2);
288         OUT_RING(chan, 0);
289         OUT_RING(chan, 0);
290         BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_SRC, 4);
291         OUT_RING(chan, 1);
292         OUT_RING(chan, 0);
293         OUT_RING(chan, 0);
294         OUT_RING(chan, 0x8006);
295         BEGIN_RING(chan, celsius, NV10_3D_STENCIL_MASK, 8);
296         OUT_RING(chan, 0xff);
297         OUT_RING(chan, 0x207);
298         OUT_RING(chan, 0);
299         OUT_RING(chan, 0xff);
300         OUT_RING(chan, 0x1e00);
301         OUT_RING(chan, 0x1e00);
302         OUT_RING(chan, 0x1e00);
303         OUT_RING(chan, 0x1d01);
304         BEGIN_RING(chan, celsius, NV10_3D_NORMALIZE_ENABLE, 1);
305         OUT_RING(chan, 0);
306         BEGIN_RING(chan, celsius, NV10_3D_FOG_ENABLE, 2);
307         OUT_RING(chan, 0);
308         OUT_RING(chan, 0);
309         BEGIN_RING(chan, celsius, NV10_3D_LIGHT_MODEL, 1);
310         OUT_RING(chan, 0);
311         BEGIN_RING(chan, celsius, NV10_3D_SEPARATE_SPECULAR_ENABLE, 1);
312         OUT_RING(chan, 0);
313         BEGIN_RING(chan, celsius, NV10_3D_ENABLED_LIGHTS, 1);
314         OUT_RING(chan, 0);
315         BEGIN_RING(chan, celsius, NV10_3D_POLYGON_OFFSET_POINT_ENABLE, 3);
316         OUT_RING(chan, 0);
317         OUT_RING(chan, 0);
318         OUT_RING(chan, 0);
319         BEGIN_RING(chan, celsius, NV10_3D_DEPTH_FUNC, 1);
320         OUT_RING(chan, 0x201);
321         BEGIN_RING(chan, celsius, NV10_3D_DEPTH_WRITE_ENABLE, 1);
322         OUT_RING(chan, 0);
323         BEGIN_RING(chan, celsius, NV10_3D_DEPTH_TEST_ENABLE, 1);
324         OUT_RING(chan, 0);
325         BEGIN_RING(chan, celsius, NV10_3D_POLYGON_OFFSET_FACTOR, 2);
326         OUT_RING(chan, 0);
327         OUT_RING(chan, 0);
328         BEGIN_RING(chan, celsius, NV10_3D_POINT_SIZE, 1);
329         OUT_RING(chan, 8);
330         BEGIN_RING(chan, celsius, NV10_3D_POINT_PARAMETERS_ENABLE, 2);
331         OUT_RING(chan, 0);
332         OUT_RING(chan, 0);
333         BEGIN_RING(chan, celsius, NV10_3D_LINE_WIDTH, 1);
334         OUT_RING(chan, 8);
335         BEGIN_RING(chan, celsius, NV10_3D_LINE_SMOOTH_ENABLE, 1);
336         OUT_RING(chan, 0);
337         BEGIN_RING(chan, celsius, NV10_3D_POLYGON_MODE_FRONT, 2);
338         OUT_RING(chan, 0x1b02);
339         OUT_RING(chan, 0x1b02);
340         BEGIN_RING(chan, celsius, NV10_3D_CULL_FACE, 2);
341         OUT_RING(chan, 0x405);
342         OUT_RING(chan, 0x901);
343         BEGIN_RING(chan, celsius, NV10_3D_POLYGON_SMOOTH_ENABLE, 1);
344         OUT_RING(chan, 0);
345         BEGIN_RING(chan, celsius, NV10_3D_CULL_FACE_ENABLE, 1);
346         OUT_RING(chan, 0);
347         BEGIN_RING(chan, celsius, NV10_3D_TEX_GEN_MODE(0, 0), 8);
348         for (i = 0; i < 8; i++)
349                 OUT_RING(chan, 0);
350
351         BEGIN_RING(chan, celsius, NV10_3D_TEX_MATRIX_ENABLE(0), 2);
352         OUT_RING(chan, 0);
353         OUT_RING(chan, 0);
354         BEGIN_RING(chan, celsius, NV10_3D_FOG_COEFF(0), 3);
355         OUT_RING(chan, 0x3fc00000);     /* -1.50 */
356         OUT_RING(chan, 0xbdb8aa0a);     /* -0.09 */
357         OUT_RING(chan, 0);              /*  0.00 */
358
359         BEGIN_RING(chan, celsius,  NV04_GRAPH_NOP, 1);
360         OUT_RING(chan, 0);
361
362         BEGIN_RING(chan, celsius, NV10_3D_FOG_MODE, 2);
363         OUT_RING(chan, 0x802);
364         OUT_RING(chan, 2);
365         /* for some reason VIEW_MATRIX_ENABLE need to be 6 instead of 4 when
366          * using texturing, except when using the texture matrix
367          */
368         BEGIN_RING(chan, celsius, NV10_3D_VIEW_MATRIX_ENABLE, 1);
369         OUT_RING(chan, 6);
370         BEGIN_RING(chan, celsius, NV10_3D_COLOR_MASK, 1);
371         OUT_RING(chan, 0x01010101);
372
373         /* Set vertex component */
374         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_COL_4F_R, 4);
375         OUT_RINGf(chan, 1.0);
376         OUT_RINGf(chan, 0.0);
377         OUT_RINGf(chan, 0.0);
378         OUT_RINGf(chan, 1.0);
379         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_COL2_3F_R, 3);
380         OUT_RING(chan, 0);
381         OUT_RING(chan, 0);
382         OUT_RING(chan, 0);
383         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_NOR_3F_X, 3);
384         OUT_RING(chan, 0);
385         OUT_RING(chan, 0);
386         OUT_RINGf(chan, 1.0);
387         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_TX0_4F_S, 4);
388         OUT_RINGf(chan, 0.0);
389         OUT_RINGf(chan, 0.0);
390         OUT_RINGf(chan, 0.0);
391         OUT_RINGf(chan, 1.0);
392         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_TX1_4F_S, 4);
393         OUT_RINGf(chan, 0.0);
394         OUT_RINGf(chan, 0.0);
395         OUT_RINGf(chan, 0.0);
396         OUT_RINGf(chan, 1.0);
397         BEGIN_RING(chan, celsius, NV10_3D_VERTEX_FOG_1F, 1);
398         OUT_RINGf(chan, 0.0);
399         BEGIN_RING(chan, celsius, NV10_3D_EDGEFLAG_ENABLE, 1);
400         OUT_RING(chan, 1);
401
402         BEGIN_RING(chan, celsius, NV10_3D_DEPTH_RANGE_NEAR, 2);
403         OUT_RINGf(chan, 0.0);
404         OUT_RINGf(chan, 16777216.0);
405
406         FIRE_RING(chan);
407 }
408
409 static void
410 nv10_context_destroy(struct gl_context *ctx)
411 {
412         struct nouveau_context *nctx = to_nouveau_context(ctx);
413
414         nv04_surface_takedown(ctx);
415         nv10_swtnl_destroy(ctx);
416         nv10_vbo_destroy(ctx);
417
418         nouveau_grobj_free(&nctx->hw.eng3d);
419
420         nouveau_context_deinit(ctx);
421         FREE(ctx);
422 }
423
424 static struct gl_context *
425 nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
426                     struct gl_context *share_ctx)
427 {
428         struct nouveau_context *nctx;
429         struct gl_context *ctx;
430         unsigned celsius_class;
431         int ret;
432
433         nctx = CALLOC_STRUCT(nouveau_context);
434         if (!nctx)
435                 return NULL;
436
437         ctx = &nctx->base;
438
439         if (!nouveau_context_init(ctx, screen, visual, share_ctx))
440                 goto fail;
441
442         driInitExtensions(ctx, nv10_extensions, GL_FALSE);
443
444         /* GL constants. */
445         ctx->Const.MaxTextureLevels = 12;
446         ctx->Const.MaxTextureCoordUnits = NV10_TEXTURE_UNITS;
447         ctx->Const.MaxTextureImageUnits = NV10_TEXTURE_UNITS;
448         ctx->Const.MaxTextureUnits = NV10_TEXTURE_UNITS;
449         ctx->Const.MaxTextureMaxAnisotropy = 2;
450         ctx->Const.MaxTextureLodBias = 15;
451         ctx->Driver.Clear = nv10_clear;
452
453         /* 2D engine. */
454         ret = nv04_surface_init(ctx);
455         if (!ret)
456                 goto fail;
457
458         /* 3D engine. */
459         if (context_chipset(ctx) >= 0x17)
460                 celsius_class = NV17_3D;
461         else if (context_chipset(ctx) >= 0x11)
462                 celsius_class = NV11_3D;
463         else
464                 celsius_class = NV10_3D;
465
466         ret = nouveau_grobj_alloc(context_chan(ctx), 0xbeef0001, celsius_class,
467                                   &nctx->hw.eng3d);
468         if (ret)
469                 goto fail;
470
471         nv10_hwctx_init(ctx);
472         nv10_vbo_init(ctx);
473         nv10_swtnl_init(ctx);
474
475         return ctx;
476
477 fail:
478         nv10_context_destroy(ctx);
479         return NULL;
480 }
481
482 const struct nouveau_driver nv10_driver = {
483         .context_create = nv10_context_create,
484         .context_destroy = nv10_context_destroy,
485         .surface_copy = nv04_surface_copy,
486         .surface_fill = nv04_surface_fill,
487         .emit = (nouveau_state_func[]) {
488                 nv10_emit_alpha_func,
489                 nv10_emit_blend_color,
490                 nv10_emit_blend_equation,
491                 nv10_emit_blend_func,
492                 nv10_emit_clip_plane,
493                 nv10_emit_clip_plane,
494                 nv10_emit_clip_plane,
495                 nv10_emit_clip_plane,
496                 nv10_emit_clip_plane,
497                 nv10_emit_clip_plane,
498                 nv10_emit_color_mask,
499                 nv10_emit_color_material,
500                 nv10_emit_cull_face,
501                 nv10_emit_front_face,
502                 nv10_emit_depth,
503                 nv10_emit_dither,
504                 nv10_emit_frag,
505                 nv10_emit_framebuffer,
506                 nv10_emit_fog,
507                 nv10_emit_light_enable,
508                 nv10_emit_light_model,
509                 nv10_emit_light_source,
510                 nv10_emit_light_source,
511                 nv10_emit_light_source,
512                 nv10_emit_light_source,
513                 nv10_emit_light_source,
514                 nv10_emit_light_source,
515                 nv10_emit_light_source,
516                 nv10_emit_light_source,
517                 nv10_emit_line_stipple,
518                 nv10_emit_line_mode,
519                 nv10_emit_logic_opcode,
520                 nv10_emit_material_ambient,
521                 nouveau_emit_nothing,
522                 nv10_emit_material_diffuse,
523                 nouveau_emit_nothing,
524                 nv10_emit_material_specular,
525                 nouveau_emit_nothing,
526                 nv10_emit_material_shininess,
527                 nouveau_emit_nothing,
528                 nv10_emit_modelview,
529                 nv10_emit_point_mode,
530                 nv10_emit_point_parameter,
531                 nv10_emit_polygon_mode,
532                 nv10_emit_polygon_offset,
533                 nv10_emit_polygon_stipple,
534                 nv10_emit_projection,
535                 nv10_emit_render_mode,
536                 nv10_emit_scissor,
537                 nv10_emit_shade_model,
538                 nv10_emit_stencil_func,
539                 nv10_emit_stencil_mask,
540                 nv10_emit_stencil_op,
541                 nv10_emit_tex_env,
542                 nv10_emit_tex_env,
543                 nouveau_emit_nothing,
544                 nouveau_emit_nothing,
545                 nv10_emit_tex_gen,
546                 nv10_emit_tex_gen,
547                 nouveau_emit_nothing,
548                 nouveau_emit_nothing,
549                 nv10_emit_tex_mat,
550                 nv10_emit_tex_mat,
551                 nouveau_emit_nothing,
552                 nouveau_emit_nothing,
553                 nv10_emit_tex_obj,
554                 nv10_emit_tex_obj,
555                 nouveau_emit_nothing,
556                 nouveau_emit_nothing,
557                 nv10_emit_viewport,
558                 nv10_emit_zclear
559         },
560         .num_emit = NUM_NV10_STATE,
561 };