2 * Copyright 2008 Ben Skeggs
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #include "pipe/p_state.h"
24 #include "pipe/p_defines.h"
25 #include "pipe/p_inlines.h"
27 #include "tgsi/tgsi_parse.h"
29 #include "nv50_context.h"
30 #include "nv50_texture.h"
32 #include "nouveau/nouveau_stateobj.h"
35 nv50_blend_state_create(struct pipe_context
*pipe
,
36 const struct pipe_blend_state
*cso
)
38 struct nouveau_stateobj
*so
= so_new(64, 0);
39 struct nouveau_grobj
*tesla
= nv50_context(pipe
)->screen
->tesla
;
40 struct nv50_blend_stateobj
*bso
= CALLOC_STRUCT(nv50_blend_stateobj
);
41 unsigned cmask
= 0, i
;
47 if (cso
->blend_enable
== 0) {
48 so_method(so
, tesla
, NV50TCL_BLEND_ENABLE(0), 8);
49 for (i
= 0; i
< 8; i
++)
52 so_method(so
, tesla
, NV50TCL_BLEND_ENABLE(0), 8);
53 for (i
= 0; i
< 8; i
++)
55 so_method(so
, tesla
, NV50TCL_BLEND_EQUATION_RGB
, 5);
56 so_data (so
, nvgl_blend_eqn(cso
->rgb_func
));
57 so_data (so
, 0x4000 | nvgl_blend_func(cso
->rgb_src_factor
));
58 so_data (so
, 0x4000 | nvgl_blend_func(cso
->rgb_dst_factor
));
59 so_data (so
, nvgl_blend_eqn(cso
->alpha_func
));
60 so_data (so
, 0x4000 | nvgl_blend_func(cso
->alpha_src_factor
));
61 so_method(so
, tesla
, NV50TCL_BLEND_FUNC_DST_ALPHA
, 1);
62 so_data (so
, 0x4000 | nvgl_blend_func(cso
->alpha_dst_factor
));
65 if (cso
->logicop_enable
== 0 ) {
66 so_method(so
, tesla
, NV50TCL_LOGIC_OP_ENABLE
, 1);
69 so_method(so
, tesla
, NV50TCL_LOGIC_OP_ENABLE
, 2);
71 so_data (so
, nvgl_logicop_func(cso
->logicop_func
));
74 if (cso
->colormask
& PIPE_MASK_R
)
76 if (cso
->colormask
& PIPE_MASK_G
)
78 if (cso
->colormask
& PIPE_MASK_B
)
80 if (cso
->colormask
& PIPE_MASK_A
)
82 so_method(so
, tesla
, NV50TCL_COLOR_MASK(0), 8);
83 for (i
= 0; i
< 8; i
++)
93 nv50_blend_state_bind(struct pipe_context
*pipe
, void *hwcso
)
95 struct nv50_context
*nv50
= nv50_context(pipe
);
98 nv50
->dirty
|= NV50_NEW_BLEND
;
102 nv50_blend_state_delete(struct pipe_context
*pipe
, void *hwcso
)
104 struct nv50_blend_stateobj
*bso
= hwcso
;
106 so_ref(NULL
, &bso
->so
);
110 static INLINE
unsigned
111 wrap_mode(unsigned wrap
)
114 case PIPE_TEX_WRAP_REPEAT
:
115 return NV50TSC_1_0_WRAPS_REPEAT
;
116 case PIPE_TEX_WRAP_MIRROR_REPEAT
:
117 return NV50TSC_1_0_WRAPS_MIRROR_REPEAT
;
118 case PIPE_TEX_WRAP_CLAMP_TO_EDGE
:
119 return NV50TSC_1_0_WRAPS_CLAMP_TO_EDGE
;
120 case PIPE_TEX_WRAP_CLAMP_TO_BORDER
:
121 return NV50TSC_1_0_WRAPS_CLAMP_TO_BORDER
;
122 case PIPE_TEX_WRAP_CLAMP
:
123 return NV50TSC_1_0_WRAPS_CLAMP
;
124 case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE
:
125 return NV50TSC_1_0_WRAPS_MIRROR_CLAMP_TO_EDGE
;
126 case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER
:
127 return NV50TSC_1_0_WRAPS_MIRROR_CLAMP_TO_BORDER
;
128 case PIPE_TEX_WRAP_MIRROR_CLAMP
:
129 return NV50TSC_1_0_WRAPS_MIRROR_CLAMP
;
131 NOUVEAU_ERR("unknown wrap mode: %d\n", wrap
);
132 return NV50TSC_1_0_WRAPS_REPEAT
;
136 nv50_sampler_state_create(struct pipe_context
*pipe
,
137 const struct pipe_sampler_state
*cso
)
139 struct nv50_sampler_stateobj
*sso
= CALLOC(1, sizeof(*sso
));
140 unsigned *tsc
= sso
->tsc
;
143 tsc
[0] = (0x00026000 |
144 (wrap_mode(cso
->wrap_s
) << 0) |
145 (wrap_mode(cso
->wrap_t
) << 3) |
146 (wrap_mode(cso
->wrap_r
) << 6));
148 switch (cso
->mag_img_filter
) {
149 case PIPE_TEX_FILTER_LINEAR
:
150 tsc
[1] |= NV50TSC_1_1_MAGF_LINEAR
;
152 case PIPE_TEX_FILTER_NEAREST
:
154 tsc
[1] |= NV50TSC_1_1_MAGF_NEAREST
;
158 switch (cso
->min_img_filter
) {
159 case PIPE_TEX_FILTER_LINEAR
:
160 tsc
[1] |= NV50TSC_1_1_MINF_LINEAR
;
162 case PIPE_TEX_FILTER_NEAREST
:
164 tsc
[1] |= NV50TSC_1_1_MINF_NEAREST
;
168 switch (cso
->min_mip_filter
) {
169 case PIPE_TEX_MIPFILTER_LINEAR
:
170 tsc
[1] |= NV50TSC_1_1_MIPF_LINEAR
;
172 case PIPE_TEX_MIPFILTER_NEAREST
:
173 tsc
[1] |= NV50TSC_1_1_MIPF_NEAREST
;
175 case PIPE_TEX_MIPFILTER_NONE
:
177 tsc
[1] |= NV50TSC_1_1_MIPF_NONE
;
181 if (cso
->max_anisotropy
>= 16.0)
184 if (cso
->max_anisotropy
>= 12.0)
187 if (cso
->max_anisotropy
>= 10.0)
190 if (cso
->max_anisotropy
>= 8.0)
193 if (cso
->max_anisotropy
>= 6.0)
196 if (cso
->max_anisotropy
>= 4.0)
199 if (cso
->max_anisotropy
>= 2.0)
202 if (cso
->compare_mode
== PIPE_TEX_COMPARE_R_TO_TEXTURE
) {
204 tsc
[0] |= (nvgl_comparison_op(cso
->compare_func
) & 0x7);
207 limit
= CLAMP(cso
->lod_bias
, -16.0, 15.0);
208 tsc
[1] |= ((int)(limit
* 256.0) & 0x1fff) << 12;
210 tsc
[2] |= ((int)CLAMP(cso
->max_lod
, 0.0, 15.0) << 20) |
211 ((int)CLAMP(cso
->min_lod
, 0.0, 15.0) << 8);
213 tsc
[4] = fui(cso
->border_color
[0]);
214 tsc
[5] = fui(cso
->border_color
[1]);
215 tsc
[6] = fui(cso
->border_color
[2]);
216 tsc
[7] = fui(cso
->border_color
[3]);
218 sso
->normalized
= cso
->normalized_coords
;
223 nv50_sampler_state_bind(struct pipe_context
*pipe
, unsigned nr
, void **sampler
)
225 struct nv50_context
*nv50
= nv50_context(pipe
);
228 nv50
->sampler_nr
= nr
;
229 for (i
= 0; i
< nv50
->sampler_nr
; i
++)
230 nv50
->sampler
[i
] = sampler
[i
];
232 nv50
->dirty
|= NV50_NEW_SAMPLER
;
236 nv50_sampler_state_delete(struct pipe_context
*pipe
, void *hwcso
)
242 nv50_set_sampler_texture(struct pipe_context
*pipe
, unsigned nr
,
243 struct pipe_texture
**pt
)
245 struct nv50_context
*nv50
= nv50_context(pipe
);
248 for (i
= 0; i
< nr
; i
++)
249 pipe_texture_reference((void *)&nv50
->miptree
[i
], pt
[i
]);
250 for (i
= nr
; i
< nv50
->miptree_nr
; i
++)
251 pipe_texture_reference((void *)&nv50
->miptree
[i
], NULL
);
253 nv50
->miptree_nr
= nr
;
254 nv50
->dirty
|= NV50_NEW_TEXTURE
;
258 nv50_rasterizer_state_create(struct pipe_context
*pipe
,
259 const struct pipe_rasterizer_state
*cso
)
261 struct nouveau_stateobj
*so
= so_new(64, 0);
262 struct nouveau_grobj
*tesla
= nv50_context(pipe
)->screen
->tesla
;
263 struct nv50_rasterizer_stateobj
*rso
=
264 CALLOC_STRUCT(nv50_rasterizer_stateobj
);
270 * - point_sprite / sprite_coord_mode
273 so_method(so
, tesla
, NV50TCL_SHADE_MODEL
, 1);
274 so_data (so
, cso
->flatshade
? NV50TCL_SHADE_MODEL_FLAT
:
275 NV50TCL_SHADE_MODEL_SMOOTH
);
276 so_method(so
, tesla
, 0x1684, 1);
277 so_data (so
, cso
->flatshade_first
? 0 : 1);
279 so_method(so
, tesla
, NV50TCL_VERTEX_TWO_SIDE_ENABLE
, 1);
280 so_data (so
, cso
->light_twoside
);
282 so_method(so
, tesla
, NV50TCL_LINE_WIDTH
, 1);
283 so_data (so
, fui(cso
->line_width
));
284 so_method(so
, tesla
, NV50TCL_LINE_SMOOTH_ENABLE
, 1);
285 so_data (so
, cso
->line_smooth
? 1 : 0);
286 if (cso
->line_stipple_enable
) {
287 so_method(so
, tesla
, NV50TCL_LINE_STIPPLE_ENABLE
, 1);
289 so_method(so
, tesla
, NV50TCL_LINE_STIPPLE_PATTERN
, 1);
290 so_data (so
, (cso
->line_stipple_pattern
<< 8) |
291 cso
->line_stipple_factor
);
293 so_method(so
, tesla
, NV50TCL_LINE_STIPPLE_ENABLE
, 1);
297 so_method(so
, tesla
, NV50TCL_POINT_SIZE
, 1);
298 so_data (so
, fui(cso
->point_size
));
300 so_method(so
, tesla
, NV50TCL_POINT_SPRITE_ENABLE
, 1);
301 so_data (so
, cso
->point_sprite
);
303 so_method(so
, tesla
, NV50TCL_POLYGON_MODE_FRONT
, 3);
304 if (cso
->front_winding
== PIPE_WINDING_CCW
) {
305 so_data(so
, nvgl_polygon_mode(cso
->fill_ccw
));
306 so_data(so
, nvgl_polygon_mode(cso
->fill_cw
));
308 so_data(so
, nvgl_polygon_mode(cso
->fill_cw
));
309 so_data(so
, nvgl_polygon_mode(cso
->fill_ccw
));
311 so_data(so
, cso
->poly_smooth
? 1 : 0);
313 so_method(so
, tesla
, NV50TCL_CULL_FACE_ENABLE
, 3);
314 so_data (so
, cso
->cull_mode
!= PIPE_WINDING_NONE
);
315 if (cso
->front_winding
== PIPE_WINDING_CCW
) {
316 so_data(so
, NV50TCL_FRONT_FACE_CCW
);
317 switch (cso
->cull_mode
) {
318 case PIPE_WINDING_CCW
:
319 so_data(so
, NV50TCL_CULL_FACE_FRONT
);
321 case PIPE_WINDING_CW
:
322 so_data(so
, NV50TCL_CULL_FACE_BACK
);
324 case PIPE_WINDING_BOTH
:
325 so_data(so
, NV50TCL_CULL_FACE_FRONT_AND_BACK
);
328 so_data(so
, NV50TCL_CULL_FACE_BACK
);
332 so_data(so
, NV50TCL_FRONT_FACE_CW
);
333 switch (cso
->cull_mode
) {
334 case PIPE_WINDING_CCW
:
335 so_data(so
, NV50TCL_CULL_FACE_BACK
);
337 case PIPE_WINDING_CW
:
338 so_data(so
, NV50TCL_CULL_FACE_FRONT
);
340 case PIPE_WINDING_BOTH
:
341 so_data(so
, NV50TCL_CULL_FACE_FRONT_AND_BACK
);
344 so_data(so
, NV50TCL_CULL_FACE_BACK
);
349 so_method(so
, tesla
, NV50TCL_POLYGON_STIPPLE_ENABLE
, 1);
350 so_data (so
, cso
->poly_stipple_enable
? 1 : 0);
352 so_method(so
, tesla
, NV50TCL_POLYGON_OFFSET_POINT_ENABLE
, 3);
353 if ((cso
->offset_cw
&& cso
->fill_cw
== PIPE_POLYGON_MODE_POINT
) ||
354 (cso
->offset_ccw
&& cso
->fill_ccw
== PIPE_POLYGON_MODE_POINT
))
358 if ((cso
->offset_cw
&& cso
->fill_cw
== PIPE_POLYGON_MODE_LINE
) ||
359 (cso
->offset_ccw
&& cso
->fill_ccw
== PIPE_POLYGON_MODE_LINE
))
363 if ((cso
->offset_cw
&& cso
->fill_cw
== PIPE_POLYGON_MODE_FILL
) ||
364 (cso
->offset_ccw
&& cso
->fill_ccw
== PIPE_POLYGON_MODE_FILL
))
369 if (cso
->offset_cw
|| cso
->offset_ccw
) {
370 so_method(so
, tesla
, NV50TCL_POLYGON_OFFSET_FACTOR
, 1);
371 so_data (so
, fui(cso
->offset_scale
));
372 so_method(so
, tesla
, NV50TCL_POLYGON_OFFSET_UNITS
, 1);
373 so_data (so
, fui(cso
->offset_units
));
377 so_ref(so
, &rso
->so
);
383 nv50_rasterizer_state_bind(struct pipe_context
*pipe
, void *hwcso
)
385 struct nv50_context
*nv50
= nv50_context(pipe
);
387 nv50
->rasterizer
= hwcso
;
388 nv50
->dirty
|= NV50_NEW_RASTERIZER
;
392 nv50_rasterizer_state_delete(struct pipe_context
*pipe
, void *hwcso
)
394 struct nv50_rasterizer_stateobj
*rso
= hwcso
;
396 so_ref(NULL
, &rso
->so
);
401 nv50_depth_stencil_alpha_state_create(struct pipe_context
*pipe
,
402 const struct pipe_depth_stencil_alpha_state
*cso
)
404 struct nouveau_grobj
*tesla
= nv50_context(pipe
)->screen
->tesla
;
405 struct nv50_zsa_stateobj
*zsa
= CALLOC_STRUCT(nv50_zsa_stateobj
);
406 struct nouveau_stateobj
*so
= so_new(64, 0);
408 so_method(so
, tesla
, NV50TCL_DEPTH_WRITE_ENABLE
, 1);
409 so_data (so
, cso
->depth
.writemask
? 1 : 0);
410 if (cso
->depth
.enabled
) {
411 so_method(so
, tesla
, NV50TCL_DEPTH_TEST_ENABLE
, 1);
413 so_method(so
, tesla
, NV50TCL_DEPTH_TEST_FUNC
, 1);
414 so_data (so
, nvgl_comparison_op(cso
->depth
.func
));
416 so_method(so
, tesla
, NV50TCL_DEPTH_TEST_ENABLE
, 1);
420 /* XXX: keep hex values until header is updated (names reversed) */
421 if (cso
->stencil
[0].enabled
) {
422 so_method(so
, tesla
, 0x1380, 8);
424 so_data (so
, nvgl_stencil_op(cso
->stencil
[0].fail_op
));
425 so_data (so
, nvgl_stencil_op(cso
->stencil
[0].zfail_op
));
426 so_data (so
, nvgl_stencil_op(cso
->stencil
[0].zpass_op
));
427 so_data (so
, nvgl_comparison_op(cso
->stencil
[0].func
));
428 so_data (so
, cso
->stencil
[0].ref_value
);
429 so_data (so
, cso
->stencil
[0].writemask
);
430 so_data (so
, cso
->stencil
[0].valuemask
);
432 so_method(so
, tesla
, 0x1380, 1);
436 if (cso
->stencil
[1].enabled
) {
437 so_method(so
, tesla
, 0x1594, 5);
439 so_data (so
, nvgl_stencil_op(cso
->stencil
[1].fail_op
));
440 so_data (so
, nvgl_stencil_op(cso
->stencil
[1].zfail_op
));
441 so_data (so
, nvgl_stencil_op(cso
->stencil
[1].zpass_op
));
442 so_data (so
, nvgl_comparison_op(cso
->stencil
[1].func
));
443 so_method(so
, tesla
, 0x0f54, 3);
444 so_data (so
, cso
->stencil
[1].ref_value
);
445 so_data (so
, cso
->stencil
[1].writemask
);
446 so_data (so
, cso
->stencil
[1].valuemask
);
448 so_method(so
, tesla
, 0x1594, 1);
452 if (cso
->alpha
.enabled
) {
453 so_method(so
, tesla
, NV50TCL_ALPHA_TEST_ENABLE
, 1);
455 so_method(so
, tesla
, NV50TCL_ALPHA_TEST_REF
, 2);
456 so_data (so
, fui(cso
->alpha
.ref_value
));
457 so_data (so
, nvgl_comparison_op(cso
->alpha
.func
));
459 so_method(so
, tesla
, NV50TCL_ALPHA_TEST_ENABLE
, 1);
464 so_ref(so
, &zsa
->so
);
470 nv50_depth_stencil_alpha_state_bind(struct pipe_context
*pipe
, void *hwcso
)
472 struct nv50_context
*nv50
= nv50_context(pipe
);
475 nv50
->dirty
|= NV50_NEW_ZSA
;
479 nv50_depth_stencil_alpha_state_delete(struct pipe_context
*pipe
, void *hwcso
)
481 struct nv50_zsa_stateobj
*zsa
= hwcso
;
483 so_ref(NULL
, &zsa
->so
);
488 nv50_vp_state_create(struct pipe_context
*pipe
,
489 const struct pipe_shader_state
*cso
)
491 struct nv50_program
*p
= CALLOC_STRUCT(nv50_program
);
493 p
->pipe
.tokens
= tgsi_dup_tokens(cso
->tokens
);
494 p
->type
= PIPE_SHADER_VERTEX
;
495 tgsi_scan_shader(p
->pipe
.tokens
, &p
->info
);
500 nv50_vp_state_bind(struct pipe_context
*pipe
, void *hwcso
)
502 struct nv50_context
*nv50
= nv50_context(pipe
);
504 nv50
->vertprog
= hwcso
;
505 nv50
->dirty
|= NV50_NEW_VERTPROG
;
509 nv50_vp_state_delete(struct pipe_context
*pipe
, void *hwcso
)
511 struct nv50_context
*nv50
= nv50_context(pipe
);
512 struct nv50_program
*p
= hwcso
;
514 nv50_program_destroy(nv50
, p
);
515 FREE((void*)p
->pipe
.tokens
);
520 nv50_fp_state_create(struct pipe_context
*pipe
,
521 const struct pipe_shader_state
*cso
)
523 struct nv50_program
*p
= CALLOC_STRUCT(nv50_program
);
525 p
->pipe
.tokens
= tgsi_dup_tokens(cso
->tokens
);
526 p
->type
= PIPE_SHADER_FRAGMENT
;
527 tgsi_scan_shader(p
->pipe
.tokens
, &p
->info
);
532 nv50_fp_state_bind(struct pipe_context
*pipe
, void *hwcso
)
534 struct nv50_context
*nv50
= nv50_context(pipe
);
536 nv50
->fragprog
= hwcso
;
537 nv50
->dirty
|= NV50_NEW_FRAGPROG
;
541 nv50_fp_state_delete(struct pipe_context
*pipe
, void *hwcso
)
543 struct nv50_context
*nv50
= nv50_context(pipe
);
544 struct nv50_program
*p
= hwcso
;
546 nv50_program_destroy(nv50
, p
);
547 FREE((void*)p
->pipe
.tokens
);
552 nv50_set_blend_color(struct pipe_context
*pipe
,
553 const struct pipe_blend_color
*bcol
)
555 struct nv50_context
*nv50
= nv50_context(pipe
);
557 nv50
->blend_colour
= *bcol
;
558 nv50
->dirty
|= NV50_NEW_BLEND_COLOUR
;
562 nv50_set_clip_state(struct pipe_context
*pipe
,
563 const struct pipe_clip_state
*clip
)
568 nv50_set_constant_buffer(struct pipe_context
*pipe
, uint shader
, uint index
,
569 const struct pipe_constant_buffer
*buf
)
571 struct nv50_context
*nv50
= nv50_context(pipe
);
573 if (shader
== PIPE_SHADER_VERTEX
) {
574 nv50
->constbuf
[PIPE_SHADER_VERTEX
] = buf
->buffer
;
575 nv50
->dirty
|= NV50_NEW_VERTPROG_CB
;
577 if (shader
== PIPE_SHADER_FRAGMENT
) {
578 nv50
->constbuf
[PIPE_SHADER_FRAGMENT
] = buf
->buffer
;
579 nv50
->dirty
|= NV50_NEW_FRAGPROG_CB
;
584 nv50_set_framebuffer_state(struct pipe_context
*pipe
,
585 const struct pipe_framebuffer_state
*fb
)
587 struct nv50_context
*nv50
= nv50_context(pipe
);
589 nv50
->framebuffer
= *fb
;
590 nv50
->dirty
|= NV50_NEW_FRAMEBUFFER
;
594 nv50_set_polygon_stipple(struct pipe_context
*pipe
,
595 const struct pipe_poly_stipple
*stipple
)
597 struct nv50_context
*nv50
= nv50_context(pipe
);
599 nv50
->stipple
= *stipple
;
600 nv50
->dirty
|= NV50_NEW_STIPPLE
;
604 nv50_set_scissor_state(struct pipe_context
*pipe
,
605 const struct pipe_scissor_state
*s
)
607 struct nv50_context
*nv50
= nv50_context(pipe
);
610 nv50
->dirty
|= NV50_NEW_SCISSOR
;
614 nv50_set_viewport_state(struct pipe_context
*pipe
,
615 const struct pipe_viewport_state
*vpt
)
617 struct nv50_context
*nv50
= nv50_context(pipe
);
619 nv50
->viewport
= *vpt
;
620 nv50
->dirty
|= NV50_NEW_VIEWPORT
;
624 nv50_set_vertex_buffers(struct pipe_context
*pipe
, unsigned count
,
625 const struct pipe_vertex_buffer
*vb
)
627 struct nv50_context
*nv50
= nv50_context(pipe
);
629 memcpy(nv50
->vtxbuf
, vb
, sizeof(*vb
) * count
);
630 nv50
->vtxbuf_nr
= count
;
632 nv50
->dirty
|= NV50_NEW_ARRAYS
;
636 nv50_set_vertex_elements(struct pipe_context
*pipe
, unsigned count
,
637 const struct pipe_vertex_element
*ve
)
639 struct nv50_context
*nv50
= nv50_context(pipe
);
641 memcpy(nv50
->vtxelt
, ve
, sizeof(*ve
) * count
);
642 nv50
->vtxelt_nr
= count
;
644 nv50
->dirty
|= NV50_NEW_ARRAYS
;
648 nv50_init_state_functions(struct nv50_context
*nv50
)
650 nv50
->pipe
.create_blend_state
= nv50_blend_state_create
;
651 nv50
->pipe
.bind_blend_state
= nv50_blend_state_bind
;
652 nv50
->pipe
.delete_blend_state
= nv50_blend_state_delete
;
654 nv50
->pipe
.create_sampler_state
= nv50_sampler_state_create
;
655 nv50
->pipe
.bind_sampler_states
= nv50_sampler_state_bind
;
656 nv50
->pipe
.delete_sampler_state
= nv50_sampler_state_delete
;
657 nv50
->pipe
.set_sampler_textures
= nv50_set_sampler_texture
;
659 nv50
->pipe
.create_rasterizer_state
= nv50_rasterizer_state_create
;
660 nv50
->pipe
.bind_rasterizer_state
= nv50_rasterizer_state_bind
;
661 nv50
->pipe
.delete_rasterizer_state
= nv50_rasterizer_state_delete
;
663 nv50
->pipe
.create_depth_stencil_alpha_state
=
664 nv50_depth_stencil_alpha_state_create
;
665 nv50
->pipe
.bind_depth_stencil_alpha_state
=
666 nv50_depth_stencil_alpha_state_bind
;
667 nv50
->pipe
.delete_depth_stencil_alpha_state
=
668 nv50_depth_stencil_alpha_state_delete
;
670 nv50
->pipe
.create_vs_state
= nv50_vp_state_create
;
671 nv50
->pipe
.bind_vs_state
= nv50_vp_state_bind
;
672 nv50
->pipe
.delete_vs_state
= nv50_vp_state_delete
;
674 nv50
->pipe
.create_fs_state
= nv50_fp_state_create
;
675 nv50
->pipe
.bind_fs_state
= nv50_fp_state_bind
;
676 nv50
->pipe
.delete_fs_state
= nv50_fp_state_delete
;
678 nv50
->pipe
.set_blend_color
= nv50_set_blend_color
;
679 nv50
->pipe
.set_clip_state
= nv50_set_clip_state
;
680 nv50
->pipe
.set_constant_buffer
= nv50_set_constant_buffer
;
681 nv50
->pipe
.set_framebuffer_state
= nv50_set_framebuffer_state
;
682 nv50
->pipe
.set_polygon_stipple
= nv50_set_polygon_stipple
;
683 nv50
->pipe
.set_scissor_state
= nv50_set_scissor_state
;
684 nv50
->pipe
.set_viewport_state
= nv50_set_viewport_state
;
686 nv50
->pipe
.set_vertex_buffers
= nv50_set_vertex_buffers
;
687 nv50
->pipe
.set_vertex_elements
= nv50_set_vertex_elements
;