1 #include "pipe/p_state.h"
2 #include "pipe/p_defines.h"
3 #include "pipe/p_util.h"
4 #include "pipe/p_shader_tokens.h"
7 #include "nv10_context.h"
8 #include "nv10_state.h"
10 static void nv10_vertex_layout(struct pipe_context
* pipe
)
12 struct nv10_context
*nv10
= nv10_context(pipe
);
13 struct nv10_fragment_program
*fp
= nv10
->fragprog
.current
;
16 struct vertex_info vinfo
;
18 memset(&vinfo
, 0, sizeof(vinfo
));
20 for (i
= 0; i
< fp
->info
.num_inputs
; i
++) {
21 switch (fp
->info
.input_semantic_name
[i
]) {
22 case TGSI_SEMANTIC_POSITION
:
23 draw_emit_vertex_attr(&vinfo
, EMIT_4F
, INTERP_LINEAR
, src
++);
25 case TGSI_SEMANTIC_COLOR
:
26 draw_emit_vertex_attr(&vinfo
, EMIT_4F
, INTERP_LINEAR
, src
++);
29 case TGSI_SEMANTIC_GENERIC
:
30 draw_emit_vertex_attr(&vinfo
, EMIT_4F
, INTERP_PERSPECTIVE
, src
++);
32 case TGSI_SEMANTIC_FOG
:
33 draw_emit_vertex_attr(&vinfo
, EMIT_4F
, INTERP_PERSPECTIVE
, src
++);
37 draw_compute_vertex_size(&vinfo
);
41 nv10_blend_state_create(struct pipe_context
*pipe
,
42 const struct pipe_blend_state
*cso
)
44 struct nv10_blend_state
*cb
;
46 cb
= malloc(sizeof(struct nv10_blend_state
));
48 cb
->b_enable
= cso
->blend_enable
? 1 : 0;
49 cb
->b_srcfunc
= ((nvgl_blend_func(cso
->alpha_src_factor
)<<16) |
50 (nvgl_blend_func(cso
->rgb_src_factor
)));
51 cb
->b_dstfunc
= ((nvgl_blend_func(cso
->alpha_dst_factor
)<<16) |
52 (nvgl_blend_func(cso
->rgb_dst_factor
)));
54 cb
->c_mask
= (((cso
->colormask
& PIPE_MASK_A
) ? (0x01<<24) : 0) |
55 ((cso
->colormask
& PIPE_MASK_R
) ? (0x01<<16) : 0) |
56 ((cso
->colormask
& PIPE_MASK_G
) ? (0x01<< 8) : 0) |
57 ((cso
->colormask
& PIPE_MASK_B
) ? (0x01<< 0) : 0));
59 cb
->d_enable
= cso
->dither
? 1 : 0;
65 nv10_blend_state_bind(struct pipe_context
*pipe
, void *hwcso
)
67 struct nv10_context
*nv10
= nv10_context(pipe
);
68 struct nv10_blend_state
*cb
= hwcso
;
70 BEGIN_RING(celsius
, NV10TCL_DITHER_ENABLE
, 1);
71 OUT_RING (cb
->d_enable
);
73 BEGIN_RING(celsius
, NV10TCL_BLEND_FUNC_ENABLE
, 3);
74 OUT_RING (cb
->b_enable
);
75 OUT_RING (cb
->b_srcfunc
);
76 OUT_RING (cb
->b_dstfunc
);
78 BEGIN_RING(celsius
, NV10TCL_COLOR_MASK
, 1);
79 OUT_RING (cb
->c_mask
);
83 nv10_blend_state_delete(struct pipe_context
*pipe
, void *hwcso
)
89 static INLINE
unsigned
90 wrap_mode(unsigned wrap
) {
94 case PIPE_TEX_WRAP_REPEAT
:
95 ret
= NV10TCL_TX_FORMAT_WRAP_S_REPEAT
;
97 case PIPE_TEX_WRAP_MIRROR_REPEAT
:
98 ret
= NV10TCL_TX_FORMAT_WRAP_S_MIRRORED_REPEAT
;
100 case PIPE_TEX_WRAP_CLAMP_TO_EDGE
:
101 ret
= NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE
;
103 case PIPE_TEX_WRAP_CLAMP_TO_BORDER
:
104 ret
= NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_BORDER
;
106 case PIPE_TEX_WRAP_CLAMP
:
107 ret
= NV10TCL_TX_FORMAT_WRAP_S_CLAMP
;
109 case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE
:
110 case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER
:
111 case PIPE_TEX_WRAP_MIRROR_CLAMP
:
113 NOUVEAU_ERR("unknown wrap mode: %d\n", wrap
);
114 ret
= NV10TCL_TX_FORMAT_WRAP_S_REPEAT
;
118 return ret
>> NV10TCL_TX_FORMAT_WRAP_S_SHIFT
;
122 nv10_sampler_state_create(struct pipe_context
*pipe
,
123 const struct pipe_sampler_state
*cso
)
125 struct nv10_sampler_state
*ps
;
128 ps
= malloc(sizeof(struct nv10_sampler_state
));
130 ps
->wrap
= ((wrap_mode(cso
->wrap_s
) << NV10TCL_TX_FORMAT_WRAP_S_SHIFT
) |
131 (wrap_mode(cso
->wrap_t
) << NV10TCL_TX_FORMAT_WRAP_T_SHIFT
));
134 if (cso
->max_anisotropy
> 1.0) {
135 /* no idea, binary driver sets it, works without it.. meh.. */
136 ps
->wrap
|= (1 << 5);
138 /* if (cso->max_anisotropy >= 16.0) {
139 ps->en |= NV10TCL_TX_ENABLE_ANISO_16X;
141 if (cso->max_anisotropy >= 12.0) {
142 ps->en |= NV10TCL_TX_ENABLE_ANISO_12X;
144 if (cso->max_anisotropy >= 10.0) {
145 ps->en |= NV10TCL_TX_ENABLE_ANISO_10X;
147 if (cso->max_anisotropy >= 8.0) {
148 ps->en |= NV10TCL_TX_ENABLE_ANISO_8X;
150 if (cso->max_anisotropy >= 6.0) {
151 ps->en |= NV10TCL_TX_ENABLE_ANISO_6X;
153 if (cso->max_anisotropy >= 4.0) {
154 ps->en |= NV10TCL_TX_ENABLE_ANISO_4X;
156 ps->en |= NV10TCL_TX_ENABLE_ANISO_2X;
160 switch (cso
->mag_img_filter
) {
161 case PIPE_TEX_FILTER_LINEAR
:
162 filter
|= NV10TCL_TX_FILTER_MAGNIFY_LINEAR
;
164 case PIPE_TEX_FILTER_NEAREST
:
166 filter
|= NV10TCL_TX_FILTER_MAGNIFY_NEAREST
;
170 switch (cso
->min_img_filter
) {
171 case PIPE_TEX_FILTER_LINEAR
:
172 switch (cso
->min_mip_filter
) {
173 case PIPE_TEX_MIPFILTER_NEAREST
:
174 filter
|= NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST
;
176 case PIPE_TEX_MIPFILTER_LINEAR
:
177 filter
|= NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR
;
179 case PIPE_TEX_MIPFILTER_NONE
:
181 filter
|= NV10TCL_TX_FILTER_MINIFY_LINEAR
;
185 case PIPE_TEX_FILTER_NEAREST
:
187 switch (cso
->min_mip_filter
) {
188 case PIPE_TEX_MIPFILTER_NEAREST
:
189 filter
|= NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST
;
191 case PIPE_TEX_MIPFILTER_LINEAR
:
192 filter
|= NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR
;
194 case PIPE_TEX_MIPFILTER_NONE
:
196 filter
|= NV10TCL_TX_FILTER_MINIFY_NEAREST
;
204 /* if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
205 switch (cso->compare_func) {
206 case PIPE_FUNC_NEVER:
207 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NEVER;
209 case PIPE_FUNC_GREATER:
210 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GREATER;
212 case PIPE_FUNC_EQUAL:
213 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_EQUAL;
215 case PIPE_FUNC_GEQUAL:
216 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GEQUAL;
219 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LESS;
221 case PIPE_FUNC_NOTEQUAL:
222 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NOTEQUAL;
224 case PIPE_FUNC_LEQUAL:
225 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LEQUAL;
227 case PIPE_FUNC_ALWAYS:
228 ps->wrap |= NV10TCL_TX_WRAP_RCOMP_ALWAYS;
235 ps
->bcol
= ((float_to_ubyte(cso
->border_color
[3]) << 24) |
236 (float_to_ubyte(cso
->border_color
[0]) << 16) |
237 (float_to_ubyte(cso
->border_color
[1]) << 8) |
238 (float_to_ubyte(cso
->border_color
[2]) << 0));
244 nv10_sampler_state_bind(struct pipe_context
*pipe
, unsigned nr
, void **sampler
)
246 struct nv10_context
*nv10
= nv10_context(pipe
);
249 for (unit
= 0; unit
< nr
; unit
++) {
250 nv10
->tex_sampler
[unit
] = sampler
[unit
];
251 nv10
->dirty_samplers
|= (1 << unit
);
256 nv10_sampler_state_delete(struct pipe_context
*pipe
, void *hwcso
)
262 nv10_set_sampler_texture(struct pipe_context
*pipe
, unsigned nr
,
263 struct pipe_texture
**miptree
)
265 struct nv10_context
*nv10
= nv10_context(pipe
);
268 for (unit
= 0; unit
< nr
; unit
++) {
269 nv10
->tex_miptree
[unit
] = (struct nv10_miptree
*)miptree
[unit
];
270 nv10
->dirty_samplers
|= (1 << unit
);
275 nv10_rasterizer_state_create(struct pipe_context
*pipe
,
276 const struct pipe_rasterizer_state
*cso
)
278 struct nv10_rasterizer_state
*rs
;
283 * offset_cw/ccw -nohw
287 * offset_units / offset_scale
289 rs
= malloc(sizeof(struct nv10_rasterizer_state
));
291 rs
->shade_model
= cso
->flatshade
? 0x1d00 : 0x1d01;
293 rs
->line_width
= (unsigned char)(cso
->line_width
* 8.0) & 0xff;
294 rs
->line_smooth_en
= cso
->line_smooth
? 1 : 0;
296 rs
->point_size
= *(uint32_t*)&cso
->point_size
;
298 rs
->poly_smooth_en
= cso
->poly_smooth
? 1 : 0;
300 if (cso
->front_winding
== PIPE_WINDING_CCW
) {
301 rs
->front_face
= NV10TCL_FRONT_FACE_CCW
;
302 rs
->poly_mode_front
= nvgl_polygon_mode(cso
->fill_ccw
);
303 rs
->poly_mode_back
= nvgl_polygon_mode(cso
->fill_cw
);
305 rs
->front_face
= NV10TCL_FRONT_FACE_CW
;
306 rs
->poly_mode_front
= nvgl_polygon_mode(cso
->fill_cw
);
307 rs
->poly_mode_back
= nvgl_polygon_mode(cso
->fill_ccw
);
310 switch (cso
->cull_mode
) {
311 case PIPE_WINDING_CCW
:
312 rs
->cull_face_en
= 1;
313 if (cso
->front_winding
== PIPE_WINDING_CCW
)
314 rs
->cull_face
= NV10TCL_CULL_FACE_FRONT
;
316 rs
->cull_face
= NV10TCL_CULL_FACE_BACK
;
318 case PIPE_WINDING_CW
:
319 rs
->cull_face_en
= 1;
320 if (cso
->front_winding
== PIPE_WINDING_CW
)
321 rs
->cull_face
= NV10TCL_CULL_FACE_FRONT
;
323 rs
->cull_face
= NV10TCL_CULL_FACE_BACK
;
325 case PIPE_WINDING_BOTH
:
326 rs
->cull_face_en
= 1;
327 rs
->cull_face
= NV10TCL_CULL_FACE_FRONT_AND_BACK
;
329 case PIPE_WINDING_NONE
:
331 rs
->cull_face_en
= 0;
336 if (cso
->point_sprite
) {
337 rs
->point_sprite
= (1 << 0);
338 for (i
= 0; i
< 8; i
++) {
339 if (cso
->sprite_coord_mode
[i
] != PIPE_SPRITE_COORD_NONE
)
340 rs
->point_sprite
|= (1 << (8 + i
));
343 rs
->point_sprite
= 0;
350 nv10_rasterizer_state_bind(struct pipe_context
*pipe
, void *hwcso
)
352 struct nv10_context
*nv10
= nv10_context(pipe
);
353 struct nv10_rasterizer_state
*rs
= hwcso
;
355 BEGIN_RING(celsius
, NV10TCL_SHADE_MODEL
, 2);
356 OUT_RING (rs
->shade_model
);
357 OUT_RING (rs
->line_width
);
360 BEGIN_RING(celsius
, NV10TCL_POINT_SIZE
, 1);
361 OUT_RING (rs
->point_size
);
363 BEGIN_RING(celsius
, NV10TCL_POLYGON_MODE_FRONT
, 2);
364 OUT_RING (rs
->poly_mode_front
);
365 OUT_RING (rs
->poly_mode_back
);
368 BEGIN_RING(celsius
, NV10TCL_CULL_FACE
, 2);
369 OUT_RING (rs
->cull_face
);
370 OUT_RING (rs
->front_face
);
372 BEGIN_RING(celsius
, NV10TCL_LINE_SMOOTH_ENABLE
, 2);
373 OUT_RING (rs
->line_smooth_en
);
374 OUT_RING (rs
->poly_smooth_en
);
376 BEGIN_RING(celsius
, NV10TCL_CULL_FACE_ENABLE
, 1);
377 OUT_RING (rs
->cull_face_en
);
379 /* BEGIN_RING(celsius, NV10TCL_POINT_SPRITE, 1);
380 OUT_RING (rs->point_sprite);*/
384 nv10_rasterizer_state_delete(struct pipe_context
*pipe
, void *hwcso
)
390 nv10_depth_stencil_alpha_state_create(struct pipe_context
*pipe
,
391 const struct pipe_depth_stencil_alpha_state
*cso
)
393 struct nv10_depth_stencil_alpha_state
*hw
;
395 hw
= malloc(sizeof(struct nv10_depth_stencil_alpha_state
));
397 hw
->depth
.func
= nvgl_comparison_op(cso
->depth
.func
);
398 hw
->depth
.write_enable
= cso
->depth
.writemask
? 1 : 0;
399 hw
->depth
.test_enable
= cso
->depth
.enabled
? 1 : 0;
401 hw
->stencil
.enable
= cso
->stencil
[0].enabled
? 1 : 0;
402 hw
->stencil
.wmask
= cso
->stencil
[0].write_mask
;
403 hw
->stencil
.func
= nvgl_comparison_op(cso
->stencil
[0].func
);
404 hw
->stencil
.ref
= cso
->stencil
[0].ref_value
;
405 hw
->stencil
.vmask
= cso
->stencil
[0].value_mask
;
406 hw
->stencil
.fail
= nvgl_stencil_op(cso
->stencil
[0].fail_op
);
407 hw
->stencil
.zfail
= nvgl_stencil_op(cso
->stencil
[0].zfail_op
);
408 hw
->stencil
.zpass
= nvgl_stencil_op(cso
->stencil
[0].zpass_op
);
410 hw
->alpha
.enabled
= cso
->alpha
.enabled
? 1 : 0;
411 hw
->alpha
.func
= nvgl_comparison_op(cso
->alpha
.func
);
412 hw
->alpha
.ref
= float_to_ubyte(cso
->alpha
.ref
);
418 nv10_depth_stencil_alpha_state_bind(struct pipe_context
*pipe
, void *hwcso
)
420 struct nv10_context
*nv10
= nv10_context(pipe
);
421 struct nv10_depth_stencil_alpha_state
*hw
= hwcso
;
423 BEGIN_RING(celsius
, NV10TCL_DEPTH_FUNC
, 3);
424 OUT_RINGp ((uint32_t *)&hw
->depth
, 3);
425 BEGIN_RING(celsius
, NV10TCL_STENCIL_ENABLE
, 1);
426 OUT_RING (hw
->stencil
.enable
);
427 BEGIN_RING(celsius
, NV10TCL_STENCIL_MASK
, 7);
428 OUT_RINGp ((uint32_t *)&(hw
->stencil
.wmask
), 7);
429 BEGIN_RING(celsius
, NV10TCL_ALPHA_FUNC_ENABLE
, 3);
430 OUT_RINGp ((uint32_t *)&hw
->alpha
.enabled
, 3);
434 nv10_depth_stencil_alpha_state_delete(struct pipe_context
*pipe
, void *hwcso
)
440 nv10_vp_state_create(struct pipe_context
*pipe
,
441 const struct pipe_shader_state
*cso
)
443 struct nv10_vertex_program
*vp
;
445 vp
= CALLOC(1, sizeof(struct nv10_vertex_program
));
452 nv10_vp_state_bind(struct pipe_context
*pipe
, void *hwcso
)
454 struct nv10_context
*nv10
= nv10_context(pipe
);
455 struct nv10_vertex_program
*vp
= hwcso
;
457 nv10
->vertprog
.current
= vp
;
458 nv10
->dirty
|= NV10_NEW_VERTPROG
;
462 nv10_vp_state_delete(struct pipe_context
*pipe
, void *hwcso
)
464 struct nv10_context
*nv10
= nv10_context(pipe
);
465 struct nv10_vertex_program
*vp
= hwcso
;
467 //nv10_vertprog_destroy(nv10, vp);
472 nv10_fp_state_create(struct pipe_context
*pipe
,
473 const struct pipe_shader_state
*cso
)
475 struct nv10_fragment_program
*fp
;
477 fp
= CALLOC(1, sizeof(struct nv10_fragment_program
));
480 tgsi_scan_shader(cso
->tokens
, &fp
->info
);
486 nv10_fp_state_bind(struct pipe_context
*pipe
, void *hwcso
)
488 struct nv10_context
*nv10
= nv10_context(pipe
);
489 struct nv10_fragment_program
*fp
= hwcso
;
491 nv10
->fragprog
.current
= fp
;
492 nv10
->dirty
|= NV10_NEW_FRAGPROG
;
496 nv10_fp_state_delete(struct pipe_context
*pipe
, void *hwcso
)
498 struct nv10_context
*nv10
= nv10_context(pipe
);
499 struct nv10_fragment_program
*fp
= hwcso
;
501 nv10_fragprog_destroy(nv10
, fp
);
506 nv10_set_blend_color(struct pipe_context
*pipe
,
507 const struct pipe_blend_color
*bcol
)
509 struct nv10_context
*nv10
= nv10_context(pipe
);
511 BEGIN_RING(celsius
, NV10TCL_BLEND_COLOR
, 1);
512 OUT_RING ((float_to_ubyte(bcol
->color
[3]) << 24) |
513 (float_to_ubyte(bcol
->color
[0]) << 16) |
514 (float_to_ubyte(bcol
->color
[1]) << 8) |
515 (float_to_ubyte(bcol
->color
[2]) << 0));
519 nv10_set_clip_state(struct pipe_context
*pipe
,
520 const struct pipe_clip_state
*clip
)
525 nv10_set_constant_buffer(struct pipe_context
*pipe
, uint shader
, uint index
,
526 const struct pipe_constant_buffer
*buf
)
528 struct nv10_context
*nv10
= nv10_context(pipe
);
530 if (shader
== PIPE_SHADER_VERTEX
) {
531 nv10
->vertprog
.constant_buf
= buf
->buffer
;
532 nv10
->dirty
|= NV10_NEW_VERTPROG
;
534 if (shader
== PIPE_SHADER_FRAGMENT
) {
535 nv10
->fragprog
.constant_buf
= buf
->buffer
;
536 nv10
->dirty
|= NV10_NEW_FRAGPROG
;
541 nv10_set_framebuffer_state(struct pipe_context
*pipe
,
542 const struct pipe_framebuffer_state
*fb
)
544 struct nv10_context
*nv10
= nv10_context(pipe
);
545 struct pipe_surface
*rt
, *zeta
;
546 uint32_t rt_format
, w
, h
;
547 int i
, colour_format
= 0, zeta_format
= 0;
549 w
= fb
->cbufs
[0]->width
;
550 h
= fb
->cbufs
[0]->height
;
551 colour_format
= fb
->cbufs
[0]->format
;
556 assert(w
== fb
->zsbuf
->width
);
557 assert(h
== fb
->zsbuf
->height
);
559 w
= fb
->zsbuf
->width
;
560 h
= fb
->zsbuf
->height
;
563 zeta_format
= fb
->zsbuf
->format
;
567 rt_format
= NV10TCL_RT_FORMAT_TYPE_LINEAR
;
569 switch (colour_format
) {
570 case PIPE_FORMAT_A8R8G8B8_UNORM
:
572 rt_format
|= NV10TCL_RT_FORMAT_COLOR_A8R8G8B8
;
574 case PIPE_FORMAT_R5G6B5_UNORM
:
575 rt_format
|= NV10TCL_RT_FORMAT_COLOR_R5G6B5
;
581 BEGIN_RING(celsius
, NV10TCL_RT_PITCH
, 1);
582 OUT_RING ( (rt
->pitch
* rt
->cpp
) | ( (zeta
->pitch
* zeta
->cpp
) << 16) );
583 nv10
->rt
[0] = rt
->buffer
;
587 nv10
->zeta
= zeta
->buffer
;
590 BEGIN_RING(celsius
, NV10TCL_RT_HORIZ
, 3);
591 OUT_RING ((w
<< 16) | 0);
592 OUT_RING ((h
<< 16) | 0);
593 OUT_RING (rt_format
);
594 BEGIN_RING(celsius
, NV10TCL_VIEWPORT_CLIP_HORIZ(0), 2);
595 OUT_RING (((w
- 1) << 16) | 0);
596 OUT_RING (((h
- 1) << 16) | 0);
600 nv10_set_polygon_stipple(struct pipe_context
*pipe
,
601 const struct pipe_poly_stipple
*stipple
)
603 NOUVEAU_ERR("line stipple hahaha\n");
607 nv10_set_scissor_state(struct pipe_context
*pipe
,
608 const struct pipe_scissor_state
*s
)
610 struct nv10_context
*nv10
= nv10_context(pipe
);
613 /* BEGIN_RING(celsius, NV10TCL_SCISSOR_HORIZ, 2);
614 OUT_RING (((s->maxx - s->minx) << 16) | s->minx);
615 OUT_RING (((s->maxy - s->miny) << 16) | s->miny);*/
619 nv10_set_viewport_state(struct pipe_context
*pipe
,
620 const struct pipe_viewport_state
*vpt
)
622 struct nv10_context
*nv10
= nv10_context(pipe
);
624 /* OUT_RINGf (vpt->translate[0]);
625 OUT_RINGf (vpt->translate[1]);
626 OUT_RINGf (vpt->translate[2]);
627 OUT_RINGf (vpt->translate[3]);*/
628 BEGIN_RING(celsius
, NV10TCL_VIEWPORT_SCALE_X
, 4);
629 OUT_RINGf (vpt
->scale
[0]);
630 OUT_RINGf (vpt
->scale
[1]);
631 OUT_RINGf (vpt
->scale
[2]);
632 OUT_RINGf (vpt
->scale
[3]);
636 nv10_set_vertex_buffers(struct pipe_context
*pipe
, unsigned count
,
637 const struct pipe_vertex_buffer
*vb
)
639 struct nv10_context
*nv10
= nv10_context(pipe
);
641 memcpy(nv10
->vtxbuf
, vb
, sizeof(*vb
) * count
);
642 nv10
->dirty
|= NV10_NEW_ARRAYS
;
646 nv10_set_vertex_elements(struct pipe_context
*pipe
, unsigned count
,
647 const struct pipe_vertex_element
*ve
)
649 struct nv10_context
*nv10
= nv10_context(pipe
);
651 memcpy(nv10
->vtxelt
, ve
, sizeof(*ve
) * count
);
652 nv10
->dirty
|= NV10_NEW_ARRAYS
;
656 nv10_init_state_functions(struct nv10_context
*nv10
)
658 nv10
->pipe
.create_blend_state
= nv10_blend_state_create
;
659 nv10
->pipe
.bind_blend_state
= nv10_blend_state_bind
;
660 nv10
->pipe
.delete_blend_state
= nv10_blend_state_delete
;
662 nv10
->pipe
.create_sampler_state
= nv10_sampler_state_create
;
663 nv10
->pipe
.bind_sampler_states
= nv10_sampler_state_bind
;
664 nv10
->pipe
.delete_sampler_state
= nv10_sampler_state_delete
;
665 nv10
->pipe
.set_sampler_textures
= nv10_set_sampler_texture
;
667 nv10
->pipe
.create_rasterizer_state
= nv10_rasterizer_state_create
;
668 nv10
->pipe
.bind_rasterizer_state
= nv10_rasterizer_state_bind
;
669 nv10
->pipe
.delete_rasterizer_state
= nv10_rasterizer_state_delete
;
671 nv10
->pipe
.create_depth_stencil_alpha_state
=
672 nv10_depth_stencil_alpha_state_create
;
673 nv10
->pipe
.bind_depth_stencil_alpha_state
=
674 nv10_depth_stencil_alpha_state_bind
;
675 nv10
->pipe
.delete_depth_stencil_alpha_state
=
676 nv10_depth_stencil_alpha_state_delete
;
678 nv10
->pipe
.create_vs_state
= nv10_vp_state_create
;
679 nv10
->pipe
.bind_vs_state
= nv10_vp_state_bind
;
680 nv10
->pipe
.delete_vs_state
= nv10_vp_state_delete
;
682 nv10
->pipe
.create_fs_state
= nv10_fp_state_create
;
683 nv10
->pipe
.bind_fs_state
= nv10_fp_state_bind
;
684 nv10
->pipe
.delete_fs_state
= nv10_fp_state_delete
;
686 nv10
->pipe
.set_blend_color
= nv10_set_blend_color
;
687 nv10
->pipe
.set_clip_state
= nv10_set_clip_state
;
688 nv10
->pipe
.set_constant_buffer
= nv10_set_constant_buffer
;
689 nv10
->pipe
.set_framebuffer_state
= nv10_set_framebuffer_state
;
690 nv10
->pipe
.set_polygon_stipple
= nv10_set_polygon_stipple
;
691 nv10
->pipe
.set_scissor_state
= nv10_set_scissor_state
;
692 nv10
->pipe
.set_viewport_state
= nv10_set_viewport_state
;
694 nv10
->pipe
.set_vertex_buffers
= nv10_set_vertex_buffers
;
695 nv10
->pipe
.set_vertex_elements
= nv10_set_vertex_elements
;