1 #include "pipe/p_state.h"
2 #include "pipe/p_defines.h"
3 #include "pipe/p_util.h"
4 #include "pipe/p_inlines.h"
6 #include "nv30_context.h"
7 #include "nv30_state.h"
10 nv30_blend_state_create(struct pipe_context
*pipe
,
11 const struct pipe_blend_state
*cso
)
13 struct nv30_context
*nv30
= nv30_context(pipe
);
14 struct nouveau_grobj
*rankine
= nv30
->screen
->rankine
;
15 struct nv30_blend_state
*bso
= CALLOC(1, sizeof(*bso
));
16 struct nouveau_stateobj
*so
= so_new(16, 0);
18 if (cso
->blend_enable
) {
19 so_method(so
, rankine
, NV34TCL_BLEND_FUNC_ENABLE
, 3);
21 so_data (so
, (nvgl_blend_func(cso
->alpha_src_factor
) << 16) |
22 nvgl_blend_func(cso
->rgb_src_factor
));
23 so_data (so
, nvgl_blend_func(cso
->alpha_dst_factor
) << 16 |
24 nvgl_blend_func(cso
->rgb_dst_factor
));
25 so_method(so
, rankine
, NV34TCL_BLEND_EQUATION
, 1);
26 so_data (so
, nvgl_blend_eqn(cso
->alpha_func
) << 16 |
27 nvgl_blend_eqn(cso
->rgb_func
));
29 so_method(so
, rankine
, NV34TCL_BLEND_FUNC_ENABLE
, 1);
33 so_method(so
, rankine
, NV34TCL_COLOR_MASK
, 1);
34 so_data (so
, (((cso
->colormask
& PIPE_MASK_A
) ? (0x01 << 24) : 0) |
35 ((cso
->colormask
& PIPE_MASK_R
) ? (0x01 << 16) : 0) |
36 ((cso
->colormask
& PIPE_MASK_G
) ? (0x01 << 8) : 0) |
37 ((cso
->colormask
& PIPE_MASK_B
) ? (0x01 << 0) : 0)));
39 if (cso
->logicop_enable
) {
40 so_method(so
, rankine
, NV34TCL_COLOR_LOGIC_OP_ENABLE
, 2);
42 so_data (so
, nvgl_logicop_func(cso
->logicop_func
));
44 so_method(so
, rankine
, NV34TCL_COLOR_LOGIC_OP_ENABLE
, 1);
48 so_method(so
, rankine
, NV34TCL_DITHER_ENABLE
, 1);
49 so_data (so
, cso
->dither
? 1 : 0);
57 nv30_blend_state_bind(struct pipe_context
*pipe
, void *hwcso
)
59 struct nv30_context
*nv30
= nv30_context(pipe
);
62 nv30
->dirty
|= NV30_NEW_BLEND
;
66 nv30_blend_state_delete(struct pipe_context
*pipe
, void *hwcso
)
68 struct nv30_blend_state
*bso
= hwcso
;
70 so_ref(NULL
, &bso
->so
);
75 static INLINE
unsigned
76 wrap_mode(unsigned wrap
) {
80 case PIPE_TEX_WRAP_REPEAT
:
81 ret
= NV34TCL_TX_WRAP_S_REPEAT
;
83 case PIPE_TEX_WRAP_MIRROR_REPEAT
:
84 ret
= NV34TCL_TX_WRAP_S_MIRRORED_REPEAT
;
86 case PIPE_TEX_WRAP_CLAMP_TO_EDGE
:
87 ret
= NV34TCL_TX_WRAP_S_CLAMP_TO_EDGE
;
89 case PIPE_TEX_WRAP_CLAMP_TO_BORDER
:
90 ret
= NV34TCL_TX_WRAP_S_CLAMP_TO_BORDER
;
92 case PIPE_TEX_WRAP_CLAMP
:
93 ret
= NV34TCL_TX_WRAP_S_CLAMP
;
95 /* case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
96 ret = NV34TCL_TX_WRAP_S_MIRROR_CLAMP_TO_EDGE;
98 case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
99 ret = NV34TCL_TX_WRAP_S_MIRROR_CLAMP_TO_BORDER;
101 case PIPE_TEX_WRAP_MIRROR_CLAMP:
102 ret = NV34TCL_TX_WRAP_S_MIRROR_CLAMP;
105 NOUVEAU_ERR("unknown wrap mode: %d\n", wrap
);
106 ret
= NV34TCL_TX_WRAP_S_REPEAT
;
110 return ret
>> NV34TCL_TX_WRAP_S_SHIFT
;
114 nv30_sampler_state_create(struct pipe_context
*pipe
,
115 const struct pipe_sampler_state
*cso
)
117 struct nv30_sampler_state
*ps
;
120 ps
= MALLOC(sizeof(struct nv30_sampler_state
));
123 /* TODO: Not all RECTs formats have this bit set, bits 15-8 of format
124 are the tx format to use. We should store normalized coord flag
125 in sampler state structure, and set appropriate format in
128 if (!cso
->normalized_coords
)
129 ps
->fmt
|= (1<<14) /*NV34TCL_TX_FORMAT_RECT*/;
131 ps
->wrap
= ((wrap_mode(cso
->wrap_s
) << NV34TCL_TX_WRAP_S_SHIFT
) |
132 (wrap_mode(cso
->wrap_t
) << NV34TCL_TX_WRAP_T_SHIFT
) |
133 (wrap_mode(cso
->wrap_r
) << NV34TCL_TX_WRAP_R_SHIFT
));
137 if (cso
->max_anisotropy
>= 8.0) {
138 ps
->en
|= NV34TCL_TX_ENABLE_ANISO_8X
;
140 if (cso
->max_anisotropy
>= 4.0) {
141 ps
->en
|= NV34TCL_TX_ENABLE_ANISO_4X
;
143 if (cso
->max_anisotropy
>= 2.0) {
144 ps
->en
|= NV34TCL_TX_ENABLE_ANISO_2X
;
147 switch (cso
->mag_img_filter
) {
148 case PIPE_TEX_FILTER_LINEAR
:
149 filter
|= NV34TCL_TX_FILTER_MAGNIFY_LINEAR
;
151 case PIPE_TEX_FILTER_NEAREST
:
153 filter
|= NV34TCL_TX_FILTER_MAGNIFY_NEAREST
;
157 switch (cso
->min_img_filter
) {
158 case PIPE_TEX_FILTER_LINEAR
:
159 switch (cso
->min_mip_filter
) {
160 case PIPE_TEX_MIPFILTER_NEAREST
:
161 filter
|= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST
;
163 case PIPE_TEX_MIPFILTER_LINEAR
:
164 filter
|= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR
;
166 case PIPE_TEX_MIPFILTER_NONE
:
168 filter
|= NV34TCL_TX_FILTER_MINIFY_LINEAR
;
172 case PIPE_TEX_FILTER_NEAREST
:
174 switch (cso
->min_mip_filter
) {
175 case PIPE_TEX_MIPFILTER_NEAREST
:
176 filter
|= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST
;
178 case PIPE_TEX_MIPFILTER_LINEAR
:
179 filter
|= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR
;
181 case PIPE_TEX_MIPFILTER_NONE
:
183 filter
|= NV34TCL_TX_FILTER_MINIFY_NEAREST
;
194 limit
= CLAMP(cso
->lod_bias
, -16.0, 15.0);
195 ps
->filt
|= (int)(cso
->lod_bias
* 256.0) & 0x1fff;
197 limit
= CLAMP(cso
->max_lod
, 0.0, 15.0);
198 ps
->en
|= (int)(limit
* 256.0) << 7;
200 limit
= CLAMP(cso
->min_lod
, 0.0, 15.0);
201 ps
->en
|= (int)(limit
* 256.0) << 19;
204 if (cso
->compare_mode
== PIPE_TEX_COMPARE_R_TO_TEXTURE
) {
205 switch (cso
->compare_func
) {
206 case PIPE_FUNC_NEVER
:
207 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_NEVER
;
209 case PIPE_FUNC_GREATER
:
210 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_GREATER
;
212 case PIPE_FUNC_EQUAL
:
213 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_EQUAL
;
215 case PIPE_FUNC_GEQUAL
:
216 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_GEQUAL
;
219 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_LESS
;
221 case PIPE_FUNC_NOTEQUAL
:
222 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_NOTEQUAL
;
224 case PIPE_FUNC_LEQUAL
:
225 ps
->wrap
|= NV34TCL_TX_WRAP_RCOMP_LEQUAL
;
227 case PIPE_FUNC_ALWAYS
:
228 ps
->wrap
|= NV34TCL_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 nv30_sampler_state_bind(struct pipe_context
*pipe
, unsigned nr
, void **sampler
)
246 struct nv30_context
*nv30
= nv30_context(pipe
);
249 for (unit
= 0; unit
< nr
; unit
++) {
250 nv30
->tex_sampler
[unit
] = sampler
[unit
];
251 nv30
->dirty_samplers
|= (1 << unit
);
254 for (unit
= nr
; unit
< nv30
->nr_samplers
; unit
++) {
255 nv30
->tex_sampler
[unit
] = NULL
;
256 nv30
->dirty_samplers
|= (1 << unit
);
259 nv30
->nr_samplers
= nr
;
260 nv30
->dirty
|= NV30_NEW_SAMPLER
;
264 nv30_sampler_state_delete(struct pipe_context
*pipe
, void *hwcso
)
270 nv30_set_sampler_texture(struct pipe_context
*pipe
, unsigned nr
,
271 struct pipe_texture
**miptree
)
273 struct nv30_context
*nv30
= nv30_context(pipe
);
276 for (unit
= 0; unit
< nr
; unit
++) {
277 pipe_texture_reference((struct pipe_texture
**)
278 &nv30
->tex_miptree
[unit
], miptree
[unit
]);
279 nv30
->dirty_samplers
|= (1 << unit
);
282 for (unit
= nr
; unit
< nv30
->nr_textures
; unit
++) {
283 pipe_texture_reference((struct pipe_texture
**)
284 &nv30
->tex_miptree
[unit
], NULL
);
285 nv30
->dirty_samplers
|= (1 << unit
);
288 nv30
->nr_textures
= nr
;
289 nv30
->dirty
|= NV30_NEW_SAMPLER
;
293 nv30_rasterizer_state_create(struct pipe_context
*pipe
,
294 const struct pipe_rasterizer_state
*cso
)
296 struct nv30_context
*nv30
= nv30_context(pipe
);
297 struct nv30_rasterizer_state
*rsso
= CALLOC(1, sizeof(*rsso
));
298 struct nouveau_stateobj
*so
= so_new(32, 0);
299 struct nouveau_grobj
*rankine
= nv30
->screen
->rankine
;
307 so_method(so
, rankine
, NV34TCL_SHADE_MODEL
, 1);
308 so_data (so
, cso
->flatshade
? NV34TCL_SHADE_MODEL_FLAT
:
309 NV34TCL_SHADE_MODEL_SMOOTH
);
311 so_method(so
, rankine
, NV34TCL_LINE_WIDTH
, 2);
312 so_data (so
, (unsigned char)(cso
->line_width
* 8.0) & 0xff);
313 so_data (so
, cso
->line_smooth
? 1 : 0);
314 so_method(so
, rankine
, NV34TCL_LINE_STIPPLE_ENABLE
, 2);
315 so_data (so
, cso
->line_stipple_enable
? 1 : 0);
316 so_data (so
, (cso
->line_stipple_pattern
<< 16) |
317 cso
->line_stipple_factor
);
319 so_method(so
, rankine
, NV34TCL_POINT_SIZE
, 1);
320 so_data (so
, fui(cso
->point_size
));
322 so_method(so
, rankine
, NV34TCL_POLYGON_MODE_FRONT
, 6);
323 if (cso
->front_winding
== PIPE_WINDING_CCW
) {
324 so_data(so
, nvgl_polygon_mode(cso
->fill_ccw
));
325 so_data(so
, nvgl_polygon_mode(cso
->fill_cw
));
326 switch (cso
->cull_mode
) {
327 case PIPE_WINDING_CCW
:
328 so_data(so
, NV34TCL_CULL_FACE_FRONT
);
330 case PIPE_WINDING_CW
:
331 so_data(so
, NV34TCL_CULL_FACE_BACK
);
333 case PIPE_WINDING_BOTH
:
334 so_data(so
, NV34TCL_CULL_FACE_FRONT_AND_BACK
);
337 so_data(so
, NV34TCL_CULL_FACE_BACK
);
340 so_data(so
, NV34TCL_FRONT_FACE_CCW
);
342 so_data(so
, nvgl_polygon_mode(cso
->fill_cw
));
343 so_data(so
, nvgl_polygon_mode(cso
->fill_ccw
));
344 switch (cso
->cull_mode
) {
345 case PIPE_WINDING_CCW
:
346 so_data(so
, NV34TCL_CULL_FACE_BACK
);
348 case PIPE_WINDING_CW
:
349 so_data(so
, NV34TCL_CULL_FACE_FRONT
);
351 case PIPE_WINDING_BOTH
:
352 so_data(so
, NV34TCL_CULL_FACE_FRONT_AND_BACK
);
355 so_data(so
, NV34TCL_CULL_FACE_BACK
);
358 so_data(so
, NV34TCL_FRONT_FACE_CW
);
360 so_data(so
, cso
->poly_smooth
? 1 : 0);
361 so_data(so
, (cso
->cull_mode
!= PIPE_WINDING_NONE
) ? 1 : 0);
363 so_method(so
, rankine
, NV34TCL_POLYGON_STIPPLE_ENABLE
, 1);
364 so_data (so
, cso
->poly_stipple_enable
? 1 : 0);
366 so_method(so
, rankine
, NV34TCL_POLYGON_OFFSET_POINT_ENABLE
, 3);
367 if ((cso
->offset_cw
&& cso
->fill_cw
== PIPE_POLYGON_MODE_POINT
) ||
368 (cso
->offset_ccw
&& cso
->fill_ccw
== PIPE_POLYGON_MODE_POINT
))
372 if ((cso
->offset_cw
&& cso
->fill_cw
== PIPE_POLYGON_MODE_LINE
) ||
373 (cso
->offset_ccw
&& cso
->fill_ccw
== PIPE_POLYGON_MODE_LINE
))
377 if ((cso
->offset_cw
&& cso
->fill_cw
== PIPE_POLYGON_MODE_FILL
) ||
378 (cso
->offset_ccw
&& cso
->fill_ccw
== PIPE_POLYGON_MODE_FILL
))
382 if (cso
->offset_cw
|| cso
->offset_ccw
) {
383 so_method(so
, rankine
, NV34TCL_POLYGON_OFFSET_FACTOR
, 2);
384 so_data (so
, fui(cso
->offset_scale
));
385 so_data (so
, fui(cso
->offset_units
* 2));
388 so_method(so
, rankine
, NV34TCL_POINT_SPRITE
, 1);
389 if (cso
->point_sprite
) {
390 unsigned psctl
= (1 << 0), i
;
392 for (i
= 0; i
< 8; i
++) {
393 if (cso
->sprite_coord_mode
[i
] != PIPE_SPRITE_COORD_NONE
)
394 psctl
|= (1 << (8 + i
));
402 so_ref(so
, &rsso
->so
);
408 nv30_rasterizer_state_bind(struct pipe_context
*pipe
, void *hwcso
)
410 struct nv30_context
*nv30
= nv30_context(pipe
);
412 nv30
->rasterizer
= hwcso
;
413 nv30
->dirty
|= NV30_NEW_RAST
;
414 /*nv30->draw_dirty |= NV30_NEW_RAST;*/
418 nv30_rasterizer_state_delete(struct pipe_context
*pipe
, void *hwcso
)
420 struct nv30_rasterizer_state
*rsso
= hwcso
;
422 so_ref(NULL
, &rsso
->so
);
427 nv30_depth_stencil_alpha_state_create(struct pipe_context
*pipe
,
428 const struct pipe_depth_stencil_alpha_state
*cso
)
430 struct nv30_context
*nv30
= nv30_context(pipe
);
431 struct nv30_zsa_state
*zsaso
= CALLOC(1, sizeof(*zsaso
));
432 struct nouveau_stateobj
*so
= so_new(32, 0);
433 struct nouveau_grobj
*rankine
= nv30
->screen
->rankine
;
435 so_method(so
, rankine
, NV34TCL_DEPTH_FUNC
, 3);
436 so_data (so
, nvgl_comparison_op(cso
->depth
.func
));
437 so_data (so
, cso
->depth
.writemask
? 1 : 0);
438 so_data (so
, cso
->depth
.enabled
? 1 : 0);
440 so_method(so
, rankine
, NV34TCL_ALPHA_FUNC_ENABLE
, 3);
441 so_data (so
, cso
->alpha
.enabled
? 1 : 0);
442 so_data (so
, nvgl_comparison_op(cso
->alpha
.func
));
443 so_data (so
, float_to_ubyte(cso
->alpha
.ref
));
445 if (cso
->stencil
[0].enabled
) {
446 so_method(so
, rankine
, NV34TCL_STENCIL_FRONT_ENABLE
, 8);
447 so_data (so
, cso
->stencil
[0].enabled
? 1 : 0);
448 so_data (so
, cso
->stencil
[0].write_mask
);
449 so_data (so
, nvgl_comparison_op(cso
->stencil
[0].func
));
450 so_data (so
, cso
->stencil
[0].ref_value
);
451 so_data (so
, cso
->stencil
[0].value_mask
);
452 so_data (so
, nvgl_stencil_op(cso
->stencil
[0].fail_op
));
453 so_data (so
, nvgl_stencil_op(cso
->stencil
[0].zfail_op
));
454 so_data (so
, nvgl_stencil_op(cso
->stencil
[0].zpass_op
));
456 so_method(so
, rankine
, NV34TCL_STENCIL_FRONT_ENABLE
, 1);
460 if (cso
->stencil
[1].enabled
) {
461 so_method(so
, rankine
, NV34TCL_STENCIL_BACK_ENABLE
, 8);
462 so_data (so
, cso
->stencil
[1].enabled
? 1 : 0);
463 so_data (so
, cso
->stencil
[1].write_mask
);
464 so_data (so
, nvgl_comparison_op(cso
->stencil
[1].func
));
465 so_data (so
, cso
->stencil
[1].ref_value
);
466 so_data (so
, cso
->stencil
[1].value_mask
);
467 so_data (so
, nvgl_stencil_op(cso
->stencil
[1].fail_op
));
468 so_data (so
, nvgl_stencil_op(cso
->stencil
[1].zfail_op
));
469 so_data (so
, nvgl_stencil_op(cso
->stencil
[1].zpass_op
));
471 so_method(so
, rankine
, NV34TCL_STENCIL_BACK_ENABLE
, 1);
475 so_ref(so
, &zsaso
->so
);
477 return (void *)zsaso
;
481 nv30_depth_stencil_alpha_state_bind(struct pipe_context
*pipe
, void *hwcso
)
483 struct nv30_context
*nv30
= nv30_context(pipe
);
486 nv30
->dirty
|= NV30_NEW_ZSA
;
490 nv30_depth_stencil_alpha_state_delete(struct pipe_context
*pipe
, void *hwcso
)
492 struct nv30_zsa_state
*zsaso
= hwcso
;
494 so_ref(NULL
, &zsaso
->so
);
499 nv30_vp_state_create(struct pipe_context
*pipe
,
500 const struct pipe_shader_state
*cso
)
502 /*struct nv30_context *nv30 = nv30_context(pipe);*/
503 struct nv30_vertex_program
*vp
;
505 vp
= CALLOC(1, sizeof(struct nv30_vertex_program
));
507 /*vp->draw = draw_create_vertex_shader(nv30->draw, &vp->pipe);*/
513 nv30_vp_state_bind(struct pipe_context
*pipe
, void *hwcso
)
515 struct nv30_context
*nv30
= nv30_context(pipe
);
517 nv30
->vertprog
= hwcso
;
518 nv30
->dirty
|= NV30_NEW_VERTPROG
;
519 /*nv30->draw_dirty |= NV30_NEW_VERTPROG;*/
523 nv30_vp_state_delete(struct pipe_context
*pipe
, void *hwcso
)
525 struct nv30_context
*nv30
= nv30_context(pipe
);
526 struct nv30_vertex_program
*vp
= hwcso
;
528 /*draw_delete_vertex_shader(nv30->draw, vp->draw);*/
529 nv30_vertprog_destroy(nv30
, vp
);
534 nv30_fp_state_create(struct pipe_context
*pipe
,
535 const struct pipe_shader_state
*cso
)
537 struct nv30_fragment_program
*fp
;
539 fp
= CALLOC(1, sizeof(struct nv30_fragment_program
));
542 tgsi_scan_shader(fp
->pipe
.tokens
, &fp
->info
);
548 nv30_fp_state_bind(struct pipe_context
*pipe
, void *hwcso
)
550 struct nv30_context
*nv30
= nv30_context(pipe
);
552 nv30
->fragprog
= hwcso
;
553 nv30
->dirty
|= NV30_NEW_FRAGPROG
;
557 nv30_fp_state_delete(struct pipe_context
*pipe
, void *hwcso
)
559 struct nv30_context
*nv30
= nv30_context(pipe
);
560 struct nv30_fragment_program
*fp
= hwcso
;
562 nv30_fragprog_destroy(nv30
, fp
);
567 nv30_set_blend_color(struct pipe_context
*pipe
,
568 const struct pipe_blend_color
*bcol
)
570 struct nv30_context
*nv30
= nv30_context(pipe
);
572 nv30
->blend_colour
= *bcol
;
573 nv30
->dirty
|= NV30_NEW_BCOL
;
577 nv30_set_clip_state(struct pipe_context
*pipe
,
578 const struct pipe_clip_state
*clip
)
583 nv30_set_constant_buffer(struct pipe_context
*pipe
, uint shader
, uint index
,
584 const struct pipe_constant_buffer
*buf
)
586 struct nv30_context
*nv30
= nv30_context(pipe
);
588 nv30
->constbuf
[shader
] = buf
->buffer
;
589 nv30
->constbuf_nr
[shader
] = buf
->size
/ (4 * sizeof(float));
591 if (shader
== PIPE_SHADER_VERTEX
) {
592 nv30
->dirty
|= NV30_NEW_VERTPROG
;
594 if (shader
== PIPE_SHADER_FRAGMENT
) {
595 nv30
->dirty
|= NV30_NEW_FRAGPROG
;
600 nv30_set_framebuffer_state(struct pipe_context
*pipe
,
601 const struct pipe_framebuffer_state
*fb
)
603 struct nv30_context
*nv30
= nv30_context(pipe
);
605 nv30
->framebuffer
= *fb
;
606 nv30
->dirty
|= NV30_NEW_FB
;
610 nv30_set_polygon_stipple(struct pipe_context
*pipe
,
611 const struct pipe_poly_stipple
*stipple
)
613 struct nv30_context
*nv30
= nv30_context(pipe
);
615 memcpy(nv30
->stipple
, stipple
->stipple
, 4 * 32);
616 nv30
->dirty
|= NV30_NEW_STIPPLE
;
620 nv30_set_scissor_state(struct pipe_context
*pipe
,
621 const struct pipe_scissor_state
*s
)
623 struct nv30_context
*nv30
= nv30_context(pipe
);
626 nv30
->dirty
|= NV30_NEW_SCISSOR
;
630 nv30_set_viewport_state(struct pipe_context
*pipe
,
631 const struct pipe_viewport_state
*vpt
)
633 struct nv30_context
*nv30
= nv30_context(pipe
);
635 nv30
->viewport
= *vpt
;
636 nv30
->dirty
|= NV30_NEW_VIEWPORT
;
637 /*nv30->draw_dirty |= NV30_NEW_VIEWPORT;*/
641 nv30_set_vertex_buffers(struct pipe_context
*pipe
, unsigned count
,
642 const struct pipe_vertex_buffer
*vb
)
644 struct nv30_context
*nv30
= nv30_context(pipe
);
646 memcpy(nv30
->vtxbuf
, vb
, sizeof(*vb
) * count
);
647 nv30
->vtxbuf_nr
= count
;
649 nv30
->dirty
|= NV30_NEW_ARRAYS
;
650 /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/
654 nv30_set_vertex_elements(struct pipe_context
*pipe
, unsigned count
,
655 const struct pipe_vertex_element
*ve
)
657 struct nv30_context
*nv30
= nv30_context(pipe
);
659 memcpy(nv30
->vtxelt
, ve
, sizeof(*ve
) * count
);
660 nv30
->vtxelt_nr
= count
;
662 nv30
->dirty
|= NV30_NEW_ARRAYS
;
663 /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/
667 nv30_set_edgeflags(struct pipe_context
*pipe
, const unsigned *bitfield
)
669 struct nv30_context
*nv30
= nv30_context(pipe
);
671 nv30
->edgeflags
= bitfield
;
672 nv30
->dirty
|= NV30_NEW_ARRAYS
;
673 /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/
677 nv30_init_state_functions(struct nv30_context
*nv30
)
679 nv30
->pipe
.create_blend_state
= nv30_blend_state_create
;
680 nv30
->pipe
.bind_blend_state
= nv30_blend_state_bind
;
681 nv30
->pipe
.delete_blend_state
= nv30_blend_state_delete
;
683 nv30
->pipe
.create_sampler_state
= nv30_sampler_state_create
;
684 nv30
->pipe
.bind_sampler_states
= nv30_sampler_state_bind
;
685 nv30
->pipe
.delete_sampler_state
= nv30_sampler_state_delete
;
686 nv30
->pipe
.set_sampler_textures
= nv30_set_sampler_texture
;
688 nv30
->pipe
.create_rasterizer_state
= nv30_rasterizer_state_create
;
689 nv30
->pipe
.bind_rasterizer_state
= nv30_rasterizer_state_bind
;
690 nv30
->pipe
.delete_rasterizer_state
= nv30_rasterizer_state_delete
;
692 nv30
->pipe
.create_depth_stencil_alpha_state
=
693 nv30_depth_stencil_alpha_state_create
;
694 nv30
->pipe
.bind_depth_stencil_alpha_state
=
695 nv30_depth_stencil_alpha_state_bind
;
696 nv30
->pipe
.delete_depth_stencil_alpha_state
=
697 nv30_depth_stencil_alpha_state_delete
;
699 nv30
->pipe
.create_vs_state
= nv30_vp_state_create
;
700 nv30
->pipe
.bind_vs_state
= nv30_vp_state_bind
;
701 nv30
->pipe
.delete_vs_state
= nv30_vp_state_delete
;
703 nv30
->pipe
.create_fs_state
= nv30_fp_state_create
;
704 nv30
->pipe
.bind_fs_state
= nv30_fp_state_bind
;
705 nv30
->pipe
.delete_fs_state
= nv30_fp_state_delete
;
707 nv30
->pipe
.set_blend_color
= nv30_set_blend_color
;
708 nv30
->pipe
.set_clip_state
= nv30_set_clip_state
;
709 nv30
->pipe
.set_constant_buffer
= nv30_set_constant_buffer
;
710 nv30
->pipe
.set_framebuffer_state
= nv30_set_framebuffer_state
;
711 nv30
->pipe
.set_polygon_stipple
= nv30_set_polygon_stipple
;
712 nv30
->pipe
.set_scissor_state
= nv30_set_scissor_state
;
713 nv30
->pipe
.set_viewport_state
= nv30_set_viewport_state
;
715 nv30
->pipe
.set_edgeflags
= nv30_set_edgeflags
;
716 nv30
->pipe
.set_vertex_buffers
= nv30_set_vertex_buffers
;
717 nv30
->pipe
.set_vertex_elements
= nv30_set_vertex_elements
;