Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / gallium / drivers / failover / fo_state.c
1 /**************************************************************************
2  * 
3  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  * 
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  * 
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  * 
26  **************************************************************************/
27
28 /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
29  */
30
31 #include "util/u_inlines.h"
32 #include "util/u_memory.h"
33 #include "util/u_transfer.h"
34
35 #include "fo_context.h"
36
37
38 /* This looks like a lot of work at the moment - we're keeping a
39  * duplicate copy of the state up-to-date.  
40  *
41  * This can change in two ways:
42  * - With constant state objects we would only need to save a pointer,
43  *     not the whole object.
44  * - By adding a callback in the state tracker to re-emit state.  The
45  *     state tracker knows the current state already and can re-emit it 
46  *     without additional complexity.
47  *
48  * This works as a proof-of-concept, but a final version will have
49  * lower overheads.
50  */
51
52
53
54 static void *
55 failover_create_blend_state( struct pipe_context *pipe,
56                              const struct pipe_blend_state *blend )
57 {
58    struct fo_state *state = MALLOC(sizeof(struct fo_state));
59    struct failover_context *failover = failover_context(pipe);
60
61    state->sw_state = failover->sw->create_blend_state(failover->sw, blend);
62    state->hw_state = failover->hw->create_blend_state(failover->hw, blend);
63
64    return state;
65 }
66
67 static void
68 failover_bind_blend_state( struct pipe_context *pipe,
69                            void *blend )
70 {
71    struct failover_context *failover = failover_context(pipe);
72    struct fo_state *state = (struct fo_state *)blend;
73    failover->blend = state;
74    failover->dirty |= FO_NEW_BLEND;
75    failover->sw->bind_blend_state( failover->sw, state->sw_state );
76    failover->hw->bind_blend_state( failover->hw, state->hw_state );
77 }
78
79 static void
80 failover_delete_blend_state( struct pipe_context *pipe,
81                              void *blend )
82 {
83    struct fo_state *state = (struct fo_state*)blend;
84    struct failover_context *failover = failover_context(pipe);
85
86    failover->sw->delete_blend_state(failover->sw, state->sw_state);
87    failover->hw->delete_blend_state(failover->hw, state->hw_state);
88    state->sw_state = 0;
89    state->hw_state = 0;
90    FREE(state);
91 }
92
93 static void
94 failover_set_blend_color( struct pipe_context *pipe,
95                           const struct pipe_blend_color *blend_color )
96 {
97    struct failover_context *failover = failover_context(pipe);
98
99    failover->blend_color = *blend_color;
100    failover->dirty |= FO_NEW_BLEND_COLOR;
101    failover->sw->set_blend_color( failover->sw, blend_color );
102    failover->hw->set_blend_color( failover->hw, blend_color );
103 }
104
105 static void
106 failover_set_stencil_ref( struct pipe_context *pipe,
107                           const struct pipe_stencil_ref *stencil_ref )
108 {
109    struct failover_context *failover = failover_context(pipe);
110
111    failover->stencil_ref = *stencil_ref;
112    failover->dirty |= FO_NEW_STENCIL_REF;
113    failover->sw->set_stencil_ref( failover->sw, stencil_ref );
114    failover->hw->set_stencil_ref( failover->hw, stencil_ref );
115 }
116
117 static void 
118 failover_set_clip_state( struct pipe_context *pipe,
119                          const struct pipe_clip_state *clip )
120 {
121    struct failover_context *failover = failover_context(pipe);
122
123    failover->clip = *clip;
124    failover->dirty |= FO_NEW_CLIP;
125    failover->sw->set_clip_state( failover->sw, clip );
126    failover->hw->set_clip_state( failover->hw, clip );
127 }
128
129 static void
130 failover_set_sample_mask(struct pipe_context *pipe,
131                          unsigned sample_mask)
132 {
133    struct failover_context *failover = failover_context(pipe);
134
135    failover->sample_mask = sample_mask;
136    failover->dirty |= FO_NEW_SAMPLE_MASK;
137    failover->sw->set_sample_mask( failover->sw, sample_mask );
138    failover->hw->set_sample_mask( failover->hw, sample_mask );
139
140 }
141
142
143 static void *
144 failover_create_depth_stencil_state(struct pipe_context *pipe,
145                               const struct pipe_depth_stencil_alpha_state *templ)
146 {
147    struct fo_state *state = MALLOC(sizeof(struct fo_state));
148    struct failover_context *failover = failover_context(pipe);
149
150    state->sw_state = failover->sw->create_depth_stencil_alpha_state(failover->sw, templ);
151    state->hw_state = failover->hw->create_depth_stencil_alpha_state(failover->hw, templ);
152
153    return state;
154 }
155
156 static void
157 failover_bind_depth_stencil_state(struct pipe_context *pipe,
158                                   void *depth_stencil)
159 {
160    struct failover_context *failover = failover_context(pipe);
161    struct fo_state *state = (struct fo_state *)depth_stencil;
162    failover->depth_stencil = state;
163    failover->dirty |= FO_NEW_DEPTH_STENCIL;
164    failover->sw->bind_depth_stencil_alpha_state(failover->sw, state->sw_state);
165    failover->hw->bind_depth_stencil_alpha_state(failover->hw, state->hw_state);
166 }
167
168 static void
169 failover_delete_depth_stencil_state(struct pipe_context *pipe,
170                                     void *ds)
171 {
172    struct fo_state *state = (struct fo_state*)ds;
173    struct failover_context *failover = failover_context(pipe);
174
175    failover->sw->delete_depth_stencil_alpha_state(failover->sw, state->sw_state);
176    failover->hw->delete_depth_stencil_alpha_state(failover->hw, state->hw_state);
177    state->sw_state = 0;
178    state->hw_state = 0;
179    FREE(state);
180 }
181
182 static void
183 failover_set_framebuffer_state(struct pipe_context *pipe,
184                                const struct pipe_framebuffer_state *framebuffer)
185 {
186    struct failover_context *failover = failover_context(pipe);
187
188    failover->framebuffer = *framebuffer;
189    failover->dirty |= FO_NEW_FRAMEBUFFER;
190    failover->sw->set_framebuffer_state( failover->sw, framebuffer );
191    failover->hw->set_framebuffer_state( failover->hw, framebuffer );
192 }
193
194
195 static void *
196 failover_create_fs_state(struct pipe_context *pipe,
197                          const struct pipe_shader_state *templ)
198 {
199    struct fo_state *state = MALLOC(sizeof(struct fo_state));
200    struct failover_context *failover = failover_context(pipe);
201
202    state->sw_state = failover->sw->create_fs_state(failover->sw, templ);
203    state->hw_state = failover->hw->create_fs_state(failover->hw, templ);
204
205    return state;
206 }
207
208 static void
209 failover_bind_fs_state(struct pipe_context *pipe, void *fs)
210 {
211    struct failover_context *failover = failover_context(pipe);
212    struct fo_state *state = (struct fo_state*)fs;
213    failover->fragment_shader = state;
214    failover->dirty |= FO_NEW_FRAGMENT_SHADER;
215    failover->sw->bind_fs_state(failover->sw, state->sw_state);
216    failover->hw->bind_fs_state(failover->hw, state->hw_state);
217 }
218
219 static void
220 failover_delete_fs_state(struct pipe_context *pipe,
221                          void *fs)
222 {
223    struct fo_state *state = (struct fo_state*)fs;
224    struct failover_context *failover = failover_context(pipe);
225
226    failover->sw->delete_fs_state(failover->sw, state->sw_state);
227    failover->hw->delete_fs_state(failover->hw, state->hw_state);
228    state->sw_state = 0;
229    state->hw_state = 0;
230    FREE(state);
231 }
232
233 static void *
234 failover_create_vs_state(struct pipe_context *pipe,
235                          const struct pipe_shader_state *templ)
236 {
237    struct fo_state *state = MALLOC(sizeof(struct fo_state));
238    struct failover_context *failover = failover_context(pipe);
239
240    state->sw_state = failover->sw->create_vs_state(failover->sw, templ);
241    state->hw_state = failover->hw->create_vs_state(failover->hw, templ);
242
243    return state;
244 }
245
246 static void
247 failover_bind_vs_state(struct pipe_context *pipe,
248                        void *vs)
249 {
250    struct failover_context *failover = failover_context(pipe);
251
252    struct fo_state *state = (struct fo_state*)vs;
253    failover->vertex_shader = state;
254    failover->dirty |= FO_NEW_VERTEX_SHADER;
255    failover->sw->bind_vs_state(failover->sw, state->sw_state);
256    failover->hw->bind_vs_state(failover->hw, state->hw_state);
257 }
258
259 static void
260 failover_delete_vs_state(struct pipe_context *pipe,
261                          void *vs)
262 {
263    struct fo_state *state = (struct fo_state*)vs;
264    struct failover_context *failover = failover_context(pipe);
265
266    failover->sw->delete_vs_state(failover->sw, state->sw_state);
267    failover->hw->delete_vs_state(failover->hw, state->hw_state);
268    state->sw_state = 0;
269    state->hw_state = 0;
270    FREE(state);
271 }
272
273
274
275 static void *
276 failover_create_vertex_elements_state( struct pipe_context *pipe,
277                                        unsigned count,
278                                        const struct pipe_vertex_element *velems )
279 {
280    struct fo_state *state = MALLOC(sizeof(struct fo_state));
281    struct failover_context *failover = failover_context(pipe);
282
283    state->sw_state = failover->sw->create_vertex_elements_state(failover->sw, count, velems);
284    state->hw_state = failover->hw->create_vertex_elements_state(failover->hw, count, velems);
285
286    return state;
287 }
288
289 static void
290 failover_bind_vertex_elements_state(struct pipe_context *pipe,
291                                     void *velems )
292 {
293    struct failover_context *failover = failover_context(pipe);
294    struct fo_state *state = (struct fo_state*)velems;
295
296    failover->vertex_elements = state;
297    failover->dirty |= FO_NEW_VERTEX_ELEMENT;
298    failover->sw->bind_vertex_elements_state( failover->sw, velems );
299    failover->hw->bind_vertex_elements_state( failover->hw, velems );
300 }
301
302 static void
303 failover_delete_vertex_elements_state( struct pipe_context *pipe,
304                                        void *velems )
305 {
306    struct fo_state *state = (struct fo_state*)velems;
307    struct failover_context *failover = failover_context(pipe);
308
309    failover->sw->delete_vertex_elements_state(failover->sw, state->sw_state);
310    failover->hw->delete_vertex_elements_state(failover->hw, state->hw_state);
311    state->sw_state = 0;
312    state->hw_state = 0;
313    FREE(state);
314 }
315
316 static void 
317 failover_set_polygon_stipple( struct pipe_context *pipe,
318                               const struct pipe_poly_stipple *stipple )
319 {
320    struct failover_context *failover = failover_context(pipe);
321
322    failover->poly_stipple = *stipple;
323    failover->dirty |= FO_NEW_STIPPLE;
324    failover->sw->set_polygon_stipple( failover->sw, stipple );
325    failover->hw->set_polygon_stipple( failover->hw, stipple );
326 }
327
328
329 static void *
330 failover_create_rasterizer_state(struct pipe_context *pipe,
331                                  const struct pipe_rasterizer_state *templ)
332 {
333    struct fo_state *state = MALLOC(sizeof(struct fo_state));
334    struct failover_context *failover = failover_context(pipe);
335
336    state->sw_state = failover->sw->create_rasterizer_state(failover->sw, templ);
337    state->hw_state = failover->hw->create_rasterizer_state(failover->hw, templ);
338
339    return state;
340 }
341
342 static void
343 failover_bind_rasterizer_state(struct pipe_context *pipe,
344                                void *raster)
345 {
346    struct failover_context *failover = failover_context(pipe);
347
348    struct fo_state *state = (struct fo_state*)raster;
349    failover->rasterizer = state;
350    failover->dirty |= FO_NEW_RASTERIZER;
351    failover->sw->bind_rasterizer_state(failover->sw, state->sw_state);
352    failover->hw->bind_rasterizer_state(failover->hw, state->hw_state);
353 }
354
355 static void
356 failover_delete_rasterizer_state(struct pipe_context *pipe,
357                                  void *raster)
358 {
359    struct fo_state *state = (struct fo_state*)raster;
360    struct failover_context *failover = failover_context(pipe);
361
362    failover->sw->delete_rasterizer_state(failover->sw, state->sw_state);
363    failover->hw->delete_rasterizer_state(failover->hw, state->hw_state);
364    state->sw_state = 0;
365    state->hw_state = 0;
366    FREE(state);
367 }
368
369
370 static void 
371 failover_set_scissor_state( struct pipe_context *pipe,
372                                  const struct pipe_scissor_state *scissor )
373 {
374    struct failover_context *failover = failover_context(pipe);
375
376    failover->scissor = *scissor;
377    failover->dirty |= FO_NEW_SCISSOR;
378    failover->sw->set_scissor_state( failover->sw, scissor );
379    failover->hw->set_scissor_state( failover->hw, scissor );
380 }
381
382
383 static void *
384 failover_create_sampler_state(struct pipe_context *pipe,
385                               const struct pipe_sampler_state *templ)
386 {
387    struct fo_state *state = MALLOC(sizeof(struct fo_state));
388    struct failover_context *failover = failover_context(pipe);
389
390    state->sw_state = failover->sw->create_sampler_state(failover->sw, templ);
391    state->hw_state = failover->hw->create_sampler_state(failover->hw, templ);
392
393    return state;
394 }
395
396 static void
397 failover_bind_fragment_sampler_states(struct pipe_context *pipe,
398                                       unsigned num,
399                                       void **sampler)
400 {
401    struct failover_context *failover = failover_context(pipe);
402    struct fo_state *state = (struct fo_state*)sampler;
403    uint i;
404    assert(num <= PIPE_MAX_SAMPLERS);
405    /* Check for no-op */
406    if (num == failover->num_samplers &&
407        !memcmp(failover->sampler, sampler, num * sizeof(void *)))
408       return;
409    for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
410       failover->sw_sampler_state[i] = i < num ? state[i].sw_state : NULL;
411       failover->hw_sampler_state[i] = i < num ? state[i].hw_state : NULL;
412    }
413    failover->dirty |= FO_NEW_SAMPLER;
414    failover->num_samplers = num;
415    failover->sw->bind_fragment_sampler_states(failover->sw, num,
416                                               failover->sw_sampler_state);
417    failover->hw->bind_fragment_sampler_states(failover->hw, num,
418                                               failover->hw_sampler_state);
419 }
420
421 static void
422 failover_bind_vertex_sampler_states(struct pipe_context *pipe,
423                                     unsigned num_samplers,
424                                     void **samplers)
425 {
426    struct failover_context *failover = failover_context(pipe);
427    struct fo_state *state = (struct fo_state*)samplers;
428    uint i;
429
430    assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS);
431
432    /* Check for no-op */
433    if (num_samplers == failover->num_vertex_samplers &&
434        !memcmp(failover->vertex_samplers, samplers, num_samplers * sizeof(void *))) {
435       return;
436    }
437    for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
438       failover->sw_vertex_sampler_state[i] = i < num_samplers ? state[i].sw_state : NULL;
439       failover->hw_vertex_sampler_state[i] = i < num_samplers ? state[i].hw_state : NULL;
440    }
441    failover->dirty |= FO_NEW_SAMPLER;
442    failover->num_vertex_samplers = num_samplers;
443    failover->sw->bind_vertex_sampler_states(failover->sw,
444                                             num_samplers,
445                                             failover->sw_vertex_sampler_state);
446    failover->hw->bind_vertex_sampler_states(failover->hw,
447                                             num_samplers,
448                                             failover->hw_vertex_sampler_state);
449 }
450
451 static void
452 failover_delete_sampler_state(struct pipe_context *pipe, void *sampler)
453 {
454    struct fo_state *state = (struct fo_state*)sampler;
455    struct failover_context *failover = failover_context(pipe);
456
457    failover->sw->delete_sampler_state(failover->sw, state->sw_state);
458    failover->hw->delete_sampler_state(failover->hw, state->hw_state);
459    state->sw_state = 0;
460    state->hw_state = 0;
461    FREE(state);
462 }
463
464
465 static struct pipe_sampler_view *
466 failover_create_sampler_view(struct pipe_context *pipe,
467                              struct pipe_resource *texture,
468                              const struct pipe_sampler_view *templ)
469 {
470    struct fo_sampler_view *view = MALLOC(sizeof(struct fo_sampler_view));
471    struct failover_context *failover = failover_context(pipe);
472
473    view->sw = failover->sw->create_sampler_view(failover->sw, texture, templ);
474    view->hw = failover->hw->create_sampler_view(failover->hw, texture, templ);
475
476    view->base = *templ;
477    view->base.reference.count = 1;
478    view->base.texture = NULL;
479    pipe_resource_reference(&view->base.texture, texture);
480    view->base.context = pipe;
481
482    return &view->base;
483 }
484
485 static void
486 failover_sampler_view_destroy(struct pipe_context *pipe,
487                               struct pipe_sampler_view *view)
488 {
489    struct fo_sampler_view *fo_view = (struct fo_sampler_view *)view;
490    struct failover_context *failover = failover_context(pipe);
491
492    failover->sw->sampler_view_destroy(failover->sw, fo_view->sw);
493    failover->hw->sampler_view_destroy(failover->hw, fo_view->hw);
494
495    pipe_resource_reference(&fo_view->base.texture, NULL);
496    FREE(fo_view);
497 }
498
499 static void
500 failover_set_fragment_sampler_views(struct pipe_context *pipe,
501                                     unsigned num,
502                                     struct pipe_sampler_view **views)
503 {
504    struct failover_context *failover = failover_context(pipe);
505    struct pipe_sampler_view *hw_views[PIPE_MAX_SAMPLERS];
506    uint i;
507
508    assert(num <= PIPE_MAX_SAMPLERS);
509
510    /* Check for no-op */
511    if (num == failover->num_fragment_sampler_views &&
512        !memcmp(failover->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
513       return;
514    for (i = 0; i < num; i++) {
515       struct fo_sampler_view *fo_view = (struct fo_sampler_view *)views[i];
516
517       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->fragment_sampler_views[i], views[i]);
518       hw_views[i] = fo_view->hw;
519    }
520    for (i = num; i < failover->num_fragment_sampler_views; i++)
521       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->fragment_sampler_views[i], NULL);
522    failover->dirty |= FO_NEW_SAMPLER_VIEW;
523    failover->num_fragment_sampler_views = num;
524    failover->hw->set_fragment_sampler_views(failover->hw, num, hw_views);
525 }
526
527
528 static void
529 failover_set_vertex_sampler_views(struct pipe_context *pipe,
530                                   unsigned num,
531                                   struct pipe_sampler_view **views)
532 {
533    struct failover_context *failover = failover_context(pipe);
534    struct pipe_sampler_view *hw_views[PIPE_MAX_VERTEX_SAMPLERS];
535    uint i;
536
537    assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
538
539    /* Check for no-op */
540    if (num == failover->num_vertex_sampler_views &&
541        !memcmp(failover->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
542       return;
543    }
544    for (i = 0; i < num; i++) {
545       struct fo_sampler_view *fo_view = (struct fo_sampler_view *)views[i];
546
547       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->vertex_sampler_views[i], views[i]);
548       hw_views[i] = fo_view->hw;
549    }
550    for (i = num; i < failover->num_vertex_sampler_views; i++)
551       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->vertex_sampler_views[i], NULL);
552    failover->dirty |= FO_NEW_SAMPLER_VIEW;
553    failover->num_vertex_sampler_views = num;
554    failover->hw->set_vertex_sampler_views(failover->hw, num, hw_views);
555 }
556
557
558 static void 
559 failover_set_viewport_state( struct pipe_context *pipe,
560                              const struct pipe_viewport_state *viewport )
561 {
562    struct failover_context *failover = failover_context(pipe);
563
564    failover->viewport = *viewport; 
565    failover->dirty |= FO_NEW_VIEWPORT;
566    failover->sw->set_viewport_state( failover->sw, viewport );
567    failover->hw->set_viewport_state( failover->hw, viewport );
568 }
569
570
571 static void
572 failover_set_vertex_buffers(struct pipe_context *pipe,
573                             unsigned count,
574                             const struct pipe_vertex_buffer *vertex_buffers)
575 {
576    struct failover_context *failover = failover_context(pipe);
577
578    util_copy_vertex_buffers(failover->vertex_buffers,
579                             &failover->num_vertex_buffers,
580                             vertex_buffers, count);
581    failover->dirty |= FO_NEW_VERTEX_BUFFER;
582    failover->sw->set_vertex_buffers( failover->sw, count, vertex_buffers );
583    failover->hw->set_vertex_buffers( failover->hw, count, vertex_buffers );
584 }
585
586
587 static void
588 failover_set_index_buffer(struct pipe_context *pipe,
589                           const struct pipe_index_buffer *ib)
590 {
591    struct failover_context *failover = failover_context(pipe);
592
593    if (ib)
594       memcpy(&failover->index_buffer, ib, sizeof(failover->index_buffer));
595    else
596       memset(&failover->index_buffer, 0, sizeof(failover->index_buffer));
597
598    failover->dirty |= FO_NEW_INDEX_BUFFER;
599    failover->sw->set_index_buffer( failover->sw, ib );
600    failover->hw->set_index_buffer( failover->hw, ib );
601 }
602
603
604 void
605 failover_set_constant_buffer(struct pipe_context *pipe,
606                              uint shader, uint index,
607                              struct pipe_resource *res)
608 {
609    struct failover_context *failover = failover_context(pipe);
610
611    assert(shader < PIPE_SHADER_TYPES);
612    assert(index == 0);
613
614    failover->sw->set_constant_buffer(failover->sw, shader, index, res);
615    failover->hw->set_constant_buffer(failover->hw, shader, index, res);
616 }
617
618
619 void
620 failover_init_state_functions( struct failover_context *failover )
621 {
622    failover->pipe.create_blend_state = failover_create_blend_state;
623    failover->pipe.bind_blend_state   = failover_bind_blend_state;
624    failover->pipe.delete_blend_state = failover_delete_blend_state;
625    failover->pipe.create_sampler_state = failover_create_sampler_state;
626    failover->pipe.bind_fragment_sampler_states  = failover_bind_fragment_sampler_states;
627    failover->pipe.bind_vertex_sampler_states  = failover_bind_vertex_sampler_states;
628    failover->pipe.delete_sampler_state = failover_delete_sampler_state;
629    failover->pipe.create_depth_stencil_alpha_state = failover_create_depth_stencil_state;
630    failover->pipe.bind_depth_stencil_alpha_state   = failover_bind_depth_stencil_state;
631    failover->pipe.delete_depth_stencil_alpha_state = failover_delete_depth_stencil_state;
632    failover->pipe.create_rasterizer_state = failover_create_rasterizer_state;
633    failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
634    failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state;
635    failover->pipe.create_fs_state = failover_create_fs_state;
636    failover->pipe.bind_fs_state   = failover_bind_fs_state;
637    failover->pipe.delete_fs_state = failover_delete_fs_state;
638    failover->pipe.create_vs_state = failover_create_vs_state;
639    failover->pipe.bind_vs_state   = failover_bind_vs_state;
640    failover->pipe.delete_vs_state = failover_delete_vs_state;
641    failover->pipe.create_vertex_elements_state = failover_create_vertex_elements_state;
642    failover->pipe.bind_vertex_elements_state = failover_bind_vertex_elements_state;
643    failover->pipe.delete_vertex_elements_state = failover_delete_vertex_elements_state;
644
645    failover->pipe.set_blend_color = failover_set_blend_color;
646    failover->pipe.set_stencil_ref = failover_set_stencil_ref;
647    failover->pipe.set_clip_state = failover_set_clip_state;
648    failover->pipe.set_sample_mask = failover_set_sample_mask;
649    failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
650    failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
651    failover->pipe.set_scissor_state = failover_set_scissor_state;
652    failover->pipe.set_fragment_sampler_views = failover_set_fragment_sampler_views;
653    failover->pipe.set_vertex_sampler_views = failover_set_vertex_sampler_views;
654    failover->pipe.set_viewport_state = failover_set_viewport_state;
655    failover->pipe.set_vertex_buffers = failover_set_vertex_buffers;
656    failover->pipe.set_index_buffer = failover_set_index_buffer;
657    failover->pipe.set_constant_buffer = failover_set_constant_buffer;
658    failover->pipe.create_sampler_view = failover_create_sampler_view;
659    failover->pipe.sampler_view_destroy = failover_sampler_view_destroy;
660    failover->pipe.redefine_user_buffer = u_default_redefine_user_buffer;
661 }