Merge commit 'origin/7.8'
[mesa.git] / src / gallium / drivers / nvfx / nvfx_state.c
1 #include "pipe/p_state.h"
2 #include "pipe/p_defines.h"
3 #include "util/u_inlines.h"
4
5 #include "draw/draw_context.h"
6
7 #include "tgsi/tgsi_parse.h"
8
9 #include "nvfx_context.h"
10 #include "nvfx_state.h"
11 #include "nvfx_tex.h"
12
13 static void *
14 nvfx_blend_state_create(struct pipe_context *pipe,
15 const struct pipe_blend_state *cso)
16 {
17 struct nvfx_context *nvfx = nvfx_context(pipe);
18 struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
19 struct nvfx_blend_state *bso = CALLOC(1, sizeof(*bso));
20 struct nouveau_stateobj *so = so_new(5, 8, 0);
21
22 if (cso->rt[0].blend_enable) {
23 so_method(so, eng3d, NV34TCL_BLEND_FUNC_ENABLE, 3);
24 so_data (so, 1);
25 so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
26 nvgl_blend_func(cso->rt[0].rgb_src_factor));
27 so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
28 nvgl_blend_func(cso->rt[0].rgb_dst_factor));
29 if(nvfx->screen->base.device->chipset < 0x40) {
30 so_method(so, eng3d, NV34TCL_BLEND_EQUATION, 1);
31 so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
32 } else {
33 so_method(so, eng3d, NV40TCL_BLEND_EQUATION, 1);
34 so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
35 nvgl_blend_eqn(cso->rt[0].rgb_func));
36 }
37 } else {
38 so_method(so, eng3d, NV34TCL_BLEND_FUNC_ENABLE, 1);
39 so_data (so, 0);
40 }
41
42 so_method(so, eng3d, NV34TCL_COLOR_MASK, 1);
43 so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
44 ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
45 ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
46 ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
47
48 /* TODO: add NV40 MRT color mask */
49
50 if (cso->logicop_enable) {
51 so_method(so, eng3d, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
52 so_data (so, 1);
53 so_data (so, nvgl_logicop_func(cso->logicop_func));
54 } else {
55 so_method(so, eng3d, NV34TCL_COLOR_LOGIC_OP_ENABLE, 1);
56 so_data (so, 0);
57 }
58
59 so_method(so, eng3d, NV34TCL_DITHER_ENABLE, 1);
60 so_data (so, cso->dither ? 1 : 0);
61
62 so_ref(so, &bso->so);
63 so_ref(NULL, &so);
64 bso->pipe = *cso;
65 return (void *)bso;
66 }
67
68 static void
69 nvfx_blend_state_bind(struct pipe_context *pipe, void *hwcso)
70 {
71 struct nvfx_context *nvfx = nvfx_context(pipe);
72
73 nvfx->blend = hwcso;
74 nvfx->dirty |= NVFX_NEW_BLEND;
75 }
76
77 static void
78 nvfx_blend_state_delete(struct pipe_context *pipe, void *hwcso)
79 {
80 struct nvfx_blend_state *bso = hwcso;
81
82 so_ref(NULL, &bso->so);
83 FREE(bso);
84 }
85
86 static void *
87 nvfx_sampler_state_create(struct pipe_context *pipe,
88 const struct pipe_sampler_state *cso)
89 {
90 struct nvfx_context *nvfx = nvfx_context(pipe);
91 struct nvfx_sampler_state *ps;
92
93 ps = MALLOC(sizeof(struct nvfx_sampler_state));
94
95 /* on nv30, we use this as an internal flag */
96 ps->fmt = cso->normalized_coords ? 0 : NV40TCL_TEX_FORMAT_RECT;
97 ps->en = 0;
98 ps->filt = nvfx_tex_filter(cso);
99 ps->wrap = (nvfx_tex_wrap_mode(cso->wrap_s) << NV34TCL_TX_WRAP_S_SHIFT) |
100 (nvfx_tex_wrap_mode(cso->wrap_t) << NV34TCL_TX_WRAP_T_SHIFT) |
101 (nvfx_tex_wrap_mode(cso->wrap_r) << NV34TCL_TX_WRAP_R_SHIFT) |
102 nvfx_tex_wrap_compare_mode(cso);
103 ps->bcol = nvfx_tex_border_color(cso->border_color);
104
105 if(nvfx->is_nv4x)
106 nv40_sampler_state_init(pipe, ps, cso);
107 else
108 nv30_sampler_state_init(pipe, ps, cso);
109
110 return (void *)ps;
111 }
112
113 static void
114 nvfx_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
115 {
116 struct nvfx_context *nvfx = nvfx_context(pipe);
117 unsigned unit;
118
119 for (unit = 0; unit < nr; unit++) {
120 nvfx->tex_sampler[unit] = sampler[unit];
121 nvfx->dirty_samplers |= (1 << unit);
122 }
123
124 for (unit = nr; unit < nvfx->nr_samplers; unit++) {
125 nvfx->tex_sampler[unit] = NULL;
126 nvfx->dirty_samplers |= (1 << unit);
127 }
128
129 nvfx->nr_samplers = nr;
130 nvfx->dirty |= NVFX_NEW_SAMPLER;
131 }
132
133 static void
134 nvfx_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
135 {
136 FREE(hwcso);
137 }
138
139 static void
140 nvfx_set_fragment_sampler_views(struct pipe_context *pipe,
141 unsigned nr,
142 struct pipe_sampler_view **views)
143 {
144 struct nvfx_context *nvfx = nvfx_context(pipe);
145 unsigned unit;
146
147 for (unit = 0; unit < nr; unit++) {
148 pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit],
149 views[unit]);
150 nvfx->dirty_samplers |= (1 << unit);
151 }
152
153 for (unit = nr; unit < nvfx->nr_textures; unit++) {
154 pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit],
155 NULL);
156 nvfx->dirty_samplers |= (1 << unit);
157 }
158
159 nvfx->nr_textures = nr;
160 nvfx->dirty |= NVFX_NEW_SAMPLER;
161 }
162
163
164 static struct pipe_sampler_view *
165 nvfx_create_sampler_view(struct pipe_context *pipe,
166 struct pipe_resource *texture,
167 const struct pipe_sampler_view *templ)
168 {
169 struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
170
171 if (view) {
172 *view = *templ;
173 view->reference.count = 1;
174 view->texture = NULL;
175 pipe_resource_reference(&view->texture, texture);
176 view->context = pipe;
177 }
178
179 return view;
180 }
181
182
183 static void
184 nvfx_sampler_view_destroy(struct pipe_context *pipe,
185 struct pipe_sampler_view *view)
186 {
187 pipe_resource_reference(&view->texture, NULL);
188 FREE(view);
189 }
190
191 static void *
192 nvfx_rasterizer_state_create(struct pipe_context *pipe,
193 const struct pipe_rasterizer_state *cso)
194 {
195 struct nvfx_context *nvfx = nvfx_context(pipe);
196 struct nvfx_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
197 struct nouveau_stateobj *so = so_new(9, 19, 0);
198 struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
199
200 /*XXX: ignored:
201 * light_twoside
202 * point_smooth -nohw
203 * multisample
204 */
205
206 so_method(so, eng3d, NV34TCL_SHADE_MODEL, 1);
207 so_data (so, cso->flatshade ? NV34TCL_SHADE_MODEL_FLAT :
208 NV34TCL_SHADE_MODEL_SMOOTH);
209
210 so_method(so, eng3d, NV34TCL_LINE_WIDTH, 2);
211 so_data (so, (unsigned char)(cso->line_width * 8.0) & 0xff);
212 so_data (so, cso->line_smooth ? 1 : 0);
213 so_method(so, eng3d, NV34TCL_LINE_STIPPLE_ENABLE, 2);
214 so_data (so, cso->line_stipple_enable ? 1 : 0);
215 so_data (so, (cso->line_stipple_pattern << 16) |
216 cso->line_stipple_factor);
217
218 so_method(so, eng3d, NV34TCL_POINT_SIZE, 1);
219 so_data (so, fui(cso->point_size));
220
221 so_method(so, eng3d, NV34TCL_POLYGON_MODE_FRONT, 6);
222 if (cso->front_winding == PIPE_WINDING_CCW) {
223 so_data(so, nvgl_polygon_mode(cso->fill_ccw));
224 so_data(so, nvgl_polygon_mode(cso->fill_cw));
225 switch (cso->cull_mode) {
226 case PIPE_WINDING_CCW:
227 so_data(so, NV34TCL_CULL_FACE_FRONT);
228 break;
229 case PIPE_WINDING_CW:
230 so_data(so, NV34TCL_CULL_FACE_BACK);
231 break;
232 case PIPE_WINDING_BOTH:
233 so_data(so, NV34TCL_CULL_FACE_FRONT_AND_BACK);
234 break;
235 default:
236 so_data(so, NV34TCL_CULL_FACE_BACK);
237 break;
238 }
239 so_data(so, NV34TCL_FRONT_FACE_CCW);
240 } else {
241 so_data(so, nvgl_polygon_mode(cso->fill_cw));
242 so_data(so, nvgl_polygon_mode(cso->fill_ccw));
243 switch (cso->cull_mode) {
244 case PIPE_WINDING_CCW:
245 so_data(so, NV34TCL_CULL_FACE_BACK);
246 break;
247 case PIPE_WINDING_CW:
248 so_data(so, NV34TCL_CULL_FACE_FRONT);
249 break;
250 case PIPE_WINDING_BOTH:
251 so_data(so, NV34TCL_CULL_FACE_FRONT_AND_BACK);
252 break;
253 default:
254 so_data(so, NV34TCL_CULL_FACE_BACK);
255 break;
256 }
257 so_data(so, NV34TCL_FRONT_FACE_CW);
258 }
259 so_data(so, cso->poly_smooth ? 1 : 0);
260 so_data(so, (cso->cull_mode != PIPE_WINDING_NONE) ? 1 : 0);
261
262 so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
263 so_data (so, cso->poly_stipple_enable ? 1 : 0);
264
265 so_method(so, eng3d, NV34TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
266 if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) ||
267 (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT))
268 so_data(so, 1);
269 else
270 so_data(so, 0);
271 if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
272 (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
273 so_data(so, 1);
274 else
275 so_data(so, 0);
276 if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
277 (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
278 so_data(so, 1);
279 else
280 so_data(so, 0);
281 if (cso->offset_cw || cso->offset_ccw) {
282 so_method(so, eng3d, NV34TCL_POLYGON_OFFSET_FACTOR, 2);
283 so_data (so, fui(cso->offset_scale));
284 so_data (so, fui(cso->offset_units * 2));
285 }
286
287 so_method(so, eng3d, NV34TCL_POINT_SPRITE, 1);
288 if (cso->point_quad_rasterization) {
289 unsigned psctl = (1 << 0), i;
290
291 for (i = 0; i < 8; i++) {
292 if ((cso->sprite_coord_enable >> i) & 1)
293 psctl |= (1 << (8 + i));
294 }
295
296 so_data(so, psctl);
297 } else {
298 so_data(so, 0);
299 }
300
301 so_ref(so, &rsso->so);
302 so_ref(NULL, &so);
303 rsso->pipe = *cso;
304 return (void *)rsso;
305 }
306
307 static void
308 nvfx_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
309 {
310 struct nvfx_context *nvfx = nvfx_context(pipe);
311
312 nvfx->rasterizer = hwcso;
313 nvfx->dirty |= NVFX_NEW_RAST;
314 nvfx->draw_dirty |= NVFX_NEW_RAST;
315 }
316
317 static void
318 nvfx_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
319 {
320 struct nvfx_rasterizer_state *rsso = hwcso;
321
322 so_ref(NULL, &rsso->so);
323 FREE(rsso);
324 }
325
326 static void *
327 nvfx_depth_stencil_alpha_state_create(struct pipe_context *pipe,
328 const struct pipe_depth_stencil_alpha_state *cso)
329 {
330 struct nvfx_context *nvfx = nvfx_context(pipe);
331 struct nvfx_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso));
332 struct nouveau_stateobj *so = so_new(6, 20, 0);
333 struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
334
335 so_method(so, eng3d, NV34TCL_DEPTH_FUNC, 3);
336 so_data (so, nvgl_comparison_op(cso->depth.func));
337 so_data (so, cso->depth.writemask ? 1 : 0);
338 so_data (so, cso->depth.enabled ? 1 : 0);
339
340 so_method(so, eng3d, NV34TCL_ALPHA_FUNC_ENABLE, 3);
341 so_data (so, cso->alpha.enabled ? 1 : 0);
342 so_data (so, nvgl_comparison_op(cso->alpha.func));
343 so_data (so, float_to_ubyte(cso->alpha.ref_value));
344
345 if (cso->stencil[0].enabled) {
346 so_method(so, eng3d, NV34TCL_STENCIL_FRONT_ENABLE, 3);
347 so_data (so, cso->stencil[0].enabled ? 1 : 0);
348 so_data (so, cso->stencil[0].writemask);
349 so_data (so, nvgl_comparison_op(cso->stencil[0].func));
350 so_method(so, eng3d, NV34TCL_STENCIL_FRONT_FUNC_MASK, 4);
351 so_data (so, cso->stencil[0].valuemask);
352 so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op));
353 so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
354 so_data (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
355 } else {
356 so_method(so, eng3d, NV34TCL_STENCIL_FRONT_ENABLE, 1);
357 so_data (so, 0);
358 }
359
360 if (cso->stencil[1].enabled) {
361 so_method(so, eng3d, NV34TCL_STENCIL_BACK_ENABLE, 3);
362 so_data (so, cso->stencil[1].enabled ? 1 : 0);
363 so_data (so, cso->stencil[1].writemask);
364 so_data (so, nvgl_comparison_op(cso->stencil[1].func));
365 so_method(so, eng3d, NV34TCL_STENCIL_BACK_FUNC_MASK, 4);
366 so_data (so, cso->stencil[1].valuemask);
367 so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op));
368 so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
369 so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
370 } else {
371 so_method(so, eng3d, NV34TCL_STENCIL_BACK_ENABLE, 1);
372 so_data (so, 0);
373 }
374
375 so_ref(so, &zsaso->so);
376 so_ref(NULL, &so);
377 zsaso->pipe = *cso;
378 return (void *)zsaso;
379 }
380
381 static void
382 nvfx_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso)
383 {
384 struct nvfx_context *nvfx = nvfx_context(pipe);
385
386 nvfx->zsa = hwcso;
387 nvfx->dirty |= NVFX_NEW_ZSA;
388 }
389
390 static void
391 nvfx_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
392 {
393 struct nvfx_zsa_state *zsaso = hwcso;
394
395 so_ref(NULL, &zsaso->so);
396 FREE(zsaso);
397 }
398
399 static void *
400 nvfx_vp_state_create(struct pipe_context *pipe,
401 const struct pipe_shader_state *cso)
402 {
403 struct nvfx_context *nvfx = nvfx_context(pipe);
404 struct nvfx_vertex_program *vp;
405
406 vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
407 vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
408 vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
409
410 return (void *)vp;
411 }
412
413 static void
414 nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
415 {
416 struct nvfx_context *nvfx = nvfx_context(pipe);
417
418 nvfx->vertprog = hwcso;
419 nvfx->dirty |= NVFX_NEW_VERTPROG;
420 nvfx->draw_dirty |= NVFX_NEW_VERTPROG;
421 }
422
423 static void
424 nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
425 {
426 struct nvfx_context *nvfx = nvfx_context(pipe);
427 struct nvfx_vertex_program *vp = hwcso;
428
429 draw_delete_vertex_shader(nvfx->draw, vp->draw);
430 nvfx_vertprog_destroy(nvfx, vp);
431 FREE((void*)vp->pipe.tokens);
432 FREE(vp);
433 }
434
435 static void *
436 nvfx_fp_state_create(struct pipe_context *pipe,
437 const struct pipe_shader_state *cso)
438 {
439 struct nvfx_fragment_program *fp;
440
441 fp = CALLOC(1, sizeof(struct nvfx_fragment_program));
442 fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
443
444 tgsi_scan_shader(fp->pipe.tokens, &fp->info);
445
446 return (void *)fp;
447 }
448
449 static void
450 nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso)
451 {
452 struct nvfx_context *nvfx = nvfx_context(pipe);
453
454 nvfx->fragprog = hwcso;
455 nvfx->dirty |= NVFX_NEW_FRAGPROG;
456 }
457
458 static void
459 nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso)
460 {
461 struct nvfx_context *nvfx = nvfx_context(pipe);
462 struct nvfx_fragment_program *fp = hwcso;
463
464 nvfx_fragprog_destroy(nvfx, fp);
465 FREE((void*)fp->pipe.tokens);
466 FREE(fp);
467 }
468
469 static void
470 nvfx_set_blend_color(struct pipe_context *pipe,
471 const struct pipe_blend_color *bcol)
472 {
473 struct nvfx_context *nvfx = nvfx_context(pipe);
474
475 nvfx->blend_colour = *bcol;
476 nvfx->dirty |= NVFX_NEW_BCOL;
477 }
478
479 static void
480 nvfx_set_stencil_ref(struct pipe_context *pipe,
481 const struct pipe_stencil_ref *sr)
482 {
483 struct nvfx_context *nvfx = nvfx_context(pipe);
484
485 nvfx->stencil_ref = *sr;
486 nvfx->dirty |= NVFX_NEW_SR;
487 }
488
489 static void
490 nvfx_set_clip_state(struct pipe_context *pipe,
491 const struct pipe_clip_state *clip)
492 {
493 struct nvfx_context *nvfx = nvfx_context(pipe);
494
495 nvfx->clip = *clip;
496 nvfx->dirty |= NVFX_NEW_UCP;
497 nvfx->draw_dirty |= NVFX_NEW_UCP;
498 }
499
500 static void
501 nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
502 struct pipe_resource *buf )
503 {
504 struct nvfx_context *nvfx = nvfx_context(pipe);
505
506 nvfx->constbuf[shader] = buf;
507 nvfx->constbuf_nr[shader] = buf->width0 / (4 * sizeof(float));
508
509 if (shader == PIPE_SHADER_VERTEX) {
510 nvfx->dirty |= NVFX_NEW_VERTPROG;
511 } else
512 if (shader == PIPE_SHADER_FRAGMENT) {
513 nvfx->dirty |= NVFX_NEW_FRAGPROG;
514 }
515 }
516
517 static void
518 nvfx_set_framebuffer_state(struct pipe_context *pipe,
519 const struct pipe_framebuffer_state *fb)
520 {
521 struct nvfx_context *nvfx = nvfx_context(pipe);
522
523 nvfx->framebuffer = *fb;
524 nvfx->dirty |= NVFX_NEW_FB;
525 }
526
527 static void
528 nvfx_set_polygon_stipple(struct pipe_context *pipe,
529 const struct pipe_poly_stipple *stipple)
530 {
531 struct nvfx_context *nvfx = nvfx_context(pipe);
532
533 memcpy(nvfx->stipple, stipple->stipple, 4 * 32);
534 nvfx->dirty |= NVFX_NEW_STIPPLE;
535 }
536
537 static void
538 nvfx_set_scissor_state(struct pipe_context *pipe,
539 const struct pipe_scissor_state *s)
540 {
541 struct nvfx_context *nvfx = nvfx_context(pipe);
542
543 nvfx->scissor = *s;
544 nvfx->dirty |= NVFX_NEW_SCISSOR;
545 }
546
547 static void
548 nvfx_set_viewport_state(struct pipe_context *pipe,
549 const struct pipe_viewport_state *vpt)
550 {
551 struct nvfx_context *nvfx = nvfx_context(pipe);
552
553 nvfx->viewport = *vpt;
554 nvfx->dirty |= NVFX_NEW_VIEWPORT;
555 nvfx->draw_dirty |= NVFX_NEW_VIEWPORT;
556 }
557
558 static void
559 nvfx_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
560 const struct pipe_vertex_buffer *vb)
561 {
562 struct nvfx_context *nvfx = nvfx_context(pipe);
563
564 memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count);
565 nvfx->vtxbuf_nr = count;
566
567 nvfx->dirty |= NVFX_NEW_ARRAYS;
568 nvfx->draw_dirty |= NVFX_NEW_ARRAYS;
569 }
570
571 static void *
572 nvfx_vtxelts_state_create(struct pipe_context *pipe,
573 unsigned num_elements,
574 const struct pipe_vertex_element *elements)
575 {
576 struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state);
577
578 assert(num_elements < 16); /* not doing fallbacks yet */
579 cso->num_elements = num_elements;
580 memcpy(cso->pipe, elements, num_elements * sizeof(*elements));
581
582 /* nvfx_vtxelt_construct(cso);*/
583
584 return (void *)cso;
585 }
586
587 static void
588 nvfx_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso)
589 {
590 FREE(hwcso);
591 }
592
593 static void
594 nvfx_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso)
595 {
596 struct nvfx_context *nvfx = nvfx_context(pipe);
597
598 nvfx->vtxelt = hwcso;
599 nvfx->dirty |= NVFX_NEW_ARRAYS;
600 /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/
601 }
602
603 void
604 nvfx_init_state_functions(struct nvfx_context *nvfx)
605 {
606 nvfx->pipe.create_blend_state = nvfx_blend_state_create;
607 nvfx->pipe.bind_blend_state = nvfx_blend_state_bind;
608 nvfx->pipe.delete_blend_state = nvfx_blend_state_delete;
609
610 nvfx->pipe.create_sampler_state = nvfx_sampler_state_create;
611 nvfx->pipe.bind_fragment_sampler_states = nvfx_sampler_state_bind;
612 nvfx->pipe.delete_sampler_state = nvfx_sampler_state_delete;
613 nvfx->pipe.set_fragment_sampler_views = nvfx_set_fragment_sampler_views;
614 nvfx->pipe.create_sampler_view = nvfx_create_sampler_view;
615 nvfx->pipe.sampler_view_destroy = nvfx_sampler_view_destroy;
616
617 nvfx->pipe.create_rasterizer_state = nvfx_rasterizer_state_create;
618 nvfx->pipe.bind_rasterizer_state = nvfx_rasterizer_state_bind;
619 nvfx->pipe.delete_rasterizer_state = nvfx_rasterizer_state_delete;
620
621 nvfx->pipe.create_depth_stencil_alpha_state =
622 nvfx_depth_stencil_alpha_state_create;
623 nvfx->pipe.bind_depth_stencil_alpha_state =
624 nvfx_depth_stencil_alpha_state_bind;
625 nvfx->pipe.delete_depth_stencil_alpha_state =
626 nvfx_depth_stencil_alpha_state_delete;
627
628 nvfx->pipe.create_vs_state = nvfx_vp_state_create;
629 nvfx->pipe.bind_vs_state = nvfx_vp_state_bind;
630 nvfx->pipe.delete_vs_state = nvfx_vp_state_delete;
631
632 nvfx->pipe.create_fs_state = nvfx_fp_state_create;
633 nvfx->pipe.bind_fs_state = nvfx_fp_state_bind;
634 nvfx->pipe.delete_fs_state = nvfx_fp_state_delete;
635
636 nvfx->pipe.set_blend_color = nvfx_set_blend_color;
637 nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref;
638 nvfx->pipe.set_clip_state = nvfx_set_clip_state;
639 nvfx->pipe.set_constant_buffer = nvfx_set_constant_buffer;
640 nvfx->pipe.set_framebuffer_state = nvfx_set_framebuffer_state;
641 nvfx->pipe.set_polygon_stipple = nvfx_set_polygon_stipple;
642 nvfx->pipe.set_scissor_state = nvfx_set_scissor_state;
643 nvfx->pipe.set_viewport_state = nvfx_set_viewport_state;
644
645 nvfx->pipe.create_vertex_elements_state = nvfx_vtxelts_state_create;
646 nvfx->pipe.delete_vertex_elements_state = nvfx_vtxelts_state_delete;
647 nvfx->pipe.bind_vertex_elements_state = nvfx_vtxelts_state_bind;
648
649 nvfx->pipe.set_vertex_buffers = nvfx_set_vertex_buffers;
650 }