25c6273570520ee98e434be680e51efb7de38e0e
[profile/ivi/mesa.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
33 #include "fo_context.h"
34
35
36 /* This looks like a lot of work at the moment - we're keeping a
37  * duplicate copy of the state up-to-date.  
38  *
39  * This can change in two ways:
40  * - With constant state objects we would only need to save a pointer,
41  *     not the whole object.
42  * - By adding a callback in the state tracker to re-emit state.  The
43  *     state tracker knows the current state already and can re-emit it 
44  *     without additional complexity.
45  *
46  * This works as a proof-of-concept, but a final version will have
47  * lower overheads.
48  */
49
50
51
52 static void *
53 failover_create_blend_state( struct pipe_context *pipe,
54                              const struct pipe_blend_state *blend )
55 {
56    struct fo_state *state = malloc(sizeof(struct fo_state));
57    struct failover_context *failover = failover_context(pipe);
58
59    state->sw_state = failover->sw->create_blend_state(failover->sw, blend);
60    state->hw_state = failover->hw->create_blend_state(failover->hw, blend);
61
62    return state;
63 }
64
65 static void
66 failover_bind_blend_state( struct pipe_context *pipe,
67                            void *blend )
68 {
69    struct failover_context *failover = failover_context(pipe);
70    struct fo_state *state = (struct fo_state *)blend;
71    failover->blend = state;
72    failover->dirty |= FO_NEW_BLEND;
73    failover->sw->bind_blend_state( failover->sw, state->sw_state );
74    failover->hw->bind_blend_state( failover->hw, state->hw_state );
75 }
76
77 static void
78 failover_delete_blend_state( struct pipe_context *pipe,
79                              void *blend )
80 {
81    struct fo_state *state = (struct fo_state*)blend;
82    struct failover_context *failover = failover_context(pipe);
83
84    failover->sw->delete_blend_state(failover->sw, state->sw_state);
85    failover->hw->delete_blend_state(failover->hw, state->hw_state);
86    state->sw_state = 0;
87    state->hw_state = 0;
88    free(state);
89 }
90
91 static void
92 failover_set_blend_color( struct pipe_context *pipe,
93                           const struct pipe_blend_color *blend_color )
94 {
95    struct failover_context *failover = failover_context(pipe);
96
97    failover->blend_color = *blend_color;
98    failover->dirty |= FO_NEW_BLEND_COLOR;
99    failover->sw->set_blend_color( failover->sw, blend_color );
100    failover->hw->set_blend_color( failover->hw, blend_color );
101 }
102
103 static void
104 failover_set_stencil_ref( struct pipe_context *pipe,
105                           const struct pipe_stencil_ref *stencil_ref )
106 {
107    struct failover_context *failover = failover_context(pipe);
108
109    failover->stencil_ref = *stencil_ref;
110    failover->dirty |= FO_NEW_STENCIL_REF;
111    failover->sw->set_stencil_ref( failover->sw, stencil_ref );
112    failover->hw->set_stencil_ref( failover->hw, stencil_ref );
113 }
114
115 static void 
116 failover_set_clip_state( struct pipe_context *pipe,
117                          const struct pipe_clip_state *clip )
118 {
119    struct failover_context *failover = failover_context(pipe);
120
121    failover->clip = *clip;
122    failover->dirty |= FO_NEW_CLIP;
123    failover->sw->set_clip_state( failover->sw, clip );
124    failover->hw->set_clip_state( failover->hw, clip );
125 }
126
127
128 static void *
129 failover_create_depth_stencil_state(struct pipe_context *pipe,
130                               const struct pipe_depth_stencil_alpha_state *templ)
131 {
132    struct fo_state *state = malloc(sizeof(struct fo_state));
133    struct failover_context *failover = failover_context(pipe);
134
135    state->sw_state = failover->sw->create_depth_stencil_alpha_state(failover->sw, templ);
136    state->hw_state = failover->hw->create_depth_stencil_alpha_state(failover->hw, templ);
137
138    return state;
139 }
140
141 static void
142 failover_bind_depth_stencil_state(struct pipe_context *pipe,
143                                   void *depth_stencil)
144 {
145    struct failover_context *failover = failover_context(pipe);
146    struct fo_state *state = (struct fo_state *)depth_stencil;
147    failover->depth_stencil = state;
148    failover->dirty |= FO_NEW_DEPTH_STENCIL;
149    failover->sw->bind_depth_stencil_alpha_state(failover->sw, state->sw_state);
150    failover->hw->bind_depth_stencil_alpha_state(failover->hw, state->hw_state);
151 }
152
153 static void
154 failover_delete_depth_stencil_state(struct pipe_context *pipe,
155                                     void *ds)
156 {
157    struct fo_state *state = (struct fo_state*)ds;
158    struct failover_context *failover = failover_context(pipe);
159
160    failover->sw->delete_depth_stencil_alpha_state(failover->sw, state->sw_state);
161    failover->hw->delete_depth_stencil_alpha_state(failover->hw, state->hw_state);
162    state->sw_state = 0;
163    state->hw_state = 0;
164    free(state);
165 }
166
167 static void
168 failover_set_framebuffer_state(struct pipe_context *pipe,
169                                const struct pipe_framebuffer_state *framebuffer)
170 {
171    struct failover_context *failover = failover_context(pipe);
172
173    failover->framebuffer = *framebuffer;
174    failover->dirty |= FO_NEW_FRAMEBUFFER;
175    failover->sw->set_framebuffer_state( failover->sw, framebuffer );
176    failover->hw->set_framebuffer_state( failover->hw, framebuffer );
177 }
178
179
180 static void *
181 failover_create_fs_state(struct pipe_context *pipe,
182                          const struct pipe_shader_state *templ)
183 {
184    struct fo_state *state = malloc(sizeof(struct fo_state));
185    struct failover_context *failover = failover_context(pipe);
186
187    state->sw_state = failover->sw->create_fs_state(failover->sw, templ);
188    state->hw_state = failover->hw->create_fs_state(failover->hw, templ);
189
190    return state;
191 }
192
193 static void
194 failover_bind_fs_state(struct pipe_context *pipe, void *fs)
195 {
196    struct failover_context *failover = failover_context(pipe);
197    struct fo_state *state = (struct fo_state*)fs;
198    failover->fragment_shader = state;
199    failover->dirty |= FO_NEW_FRAGMENT_SHADER;
200    failover->sw->bind_fs_state(failover->sw, state->sw_state);
201    failover->hw->bind_fs_state(failover->hw, state->hw_state);
202 }
203
204 static void
205 failover_delete_fs_state(struct pipe_context *pipe,
206                          void *fs)
207 {
208    struct fo_state *state = (struct fo_state*)fs;
209    struct failover_context *failover = failover_context(pipe);
210
211    failover->sw->delete_fs_state(failover->sw, state->sw_state);
212    failover->hw->delete_fs_state(failover->hw, state->hw_state);
213    state->sw_state = 0;
214    state->hw_state = 0;
215    free(state);
216 }
217
218 static void *
219 failover_create_vs_state(struct pipe_context *pipe,
220                          const struct pipe_shader_state *templ)
221 {
222    struct fo_state *state = malloc(sizeof(struct fo_state));
223    struct failover_context *failover = failover_context(pipe);
224
225    state->sw_state = failover->sw->create_vs_state(failover->sw, templ);
226    state->hw_state = failover->hw->create_vs_state(failover->hw, templ);
227
228    return state;
229 }
230
231 static void
232 failover_bind_vs_state(struct pipe_context *pipe,
233                        void *vs)
234 {
235    struct failover_context *failover = failover_context(pipe);
236
237    struct fo_state *state = (struct fo_state*)vs;
238    failover->vertex_shader = state;
239    failover->dirty |= FO_NEW_VERTEX_SHADER;
240    failover->sw->bind_vs_state(failover->sw, state->sw_state);
241    failover->hw->bind_vs_state(failover->hw, state->hw_state);
242 }
243
244 static void
245 failover_delete_vs_state(struct pipe_context *pipe,
246                          void *vs)
247 {
248    struct fo_state *state = (struct fo_state*)vs;
249    struct failover_context *failover = failover_context(pipe);
250
251    failover->sw->delete_vs_state(failover->sw, state->sw_state);
252    failover->hw->delete_vs_state(failover->hw, state->hw_state);
253    state->sw_state = 0;
254    state->hw_state = 0;
255    free(state);
256 }
257
258
259
260 static void *
261 failover_create_vertex_elements_state( struct pipe_context *pipe,
262                                        unsigned count,
263                                        const struct pipe_vertex_element *velems )
264 {
265    struct fo_state *state = malloc(sizeof(struct fo_state));
266    struct failover_context *failover = failover_context(pipe);
267
268    state->sw_state = failover->sw->create_vertex_elements_state(failover->sw, count, velems);
269    state->hw_state = failover->hw->create_vertex_elements_state(failover->hw, count, velems);
270
271    return state;
272 }
273
274 static void
275 failover_bind_vertex_elements_state(struct pipe_context *pipe,
276                                     void *velems )
277 {
278    struct failover_context *failover = failover_context(pipe);
279    struct fo_state *state = (struct fo_state*)velems;
280
281    failover->vertex_elements = state;
282    failover->dirty |= FO_NEW_VERTEX_ELEMENT;
283    failover->sw->bind_vertex_elements_state( failover->sw, velems );
284    failover->hw->bind_vertex_elements_state( failover->hw, velems );
285 }
286
287 static void
288 failover_delete_vertex_elements_state( struct pipe_context *pipe,
289                                        void *velems )
290 {
291    struct fo_state *state = (struct fo_state*)velems;
292    struct failover_context *failover = failover_context(pipe);
293
294    failover->sw->delete_vertex_elements_state(failover->sw, state->sw_state);
295    failover->hw->delete_vertex_elements_state(failover->hw, state->hw_state);
296    state->sw_state = 0;
297    state->hw_state = 0;
298    free(state);
299 }
300
301 static void 
302 failover_set_polygon_stipple( struct pipe_context *pipe,
303                               const struct pipe_poly_stipple *stipple )
304 {
305    struct failover_context *failover = failover_context(pipe);
306
307    failover->poly_stipple = *stipple;
308    failover->dirty |= FO_NEW_STIPPLE;
309    failover->sw->set_polygon_stipple( failover->sw, stipple );
310    failover->hw->set_polygon_stipple( failover->hw, stipple );
311 }
312
313
314 static void *
315 failover_create_rasterizer_state(struct pipe_context *pipe,
316                                  const struct pipe_rasterizer_state *templ)
317 {
318    struct fo_state *state = malloc(sizeof(struct fo_state));
319    struct failover_context *failover = failover_context(pipe);
320
321    state->sw_state = failover->sw->create_rasterizer_state(failover->sw, templ);
322    state->hw_state = failover->hw->create_rasterizer_state(failover->hw, templ);
323
324    return state;
325 }
326
327 static void
328 failover_bind_rasterizer_state(struct pipe_context *pipe,
329                                void *raster)
330 {
331    struct failover_context *failover = failover_context(pipe);
332
333    struct fo_state *state = (struct fo_state*)raster;
334    failover->rasterizer = state;
335    failover->dirty |= FO_NEW_RASTERIZER;
336    failover->sw->bind_rasterizer_state(failover->sw, state->sw_state);
337    failover->hw->bind_rasterizer_state(failover->hw, state->hw_state);
338 }
339
340 static void
341 failover_delete_rasterizer_state(struct pipe_context *pipe,
342                                  void *raster)
343 {
344    struct fo_state *state = (struct fo_state*)raster;
345    struct failover_context *failover = failover_context(pipe);
346
347    failover->sw->delete_rasterizer_state(failover->sw, state->sw_state);
348    failover->hw->delete_rasterizer_state(failover->hw, state->hw_state);
349    state->sw_state = 0;
350    state->hw_state = 0;
351    free(state);
352 }
353
354
355 static void 
356 failover_set_scissor_state( struct pipe_context *pipe,
357                                  const struct pipe_scissor_state *scissor )
358 {
359    struct failover_context *failover = failover_context(pipe);
360
361    failover->scissor = *scissor;
362    failover->dirty |= FO_NEW_SCISSOR;
363    failover->sw->set_scissor_state( failover->sw, scissor );
364    failover->hw->set_scissor_state( failover->hw, scissor );
365 }
366
367
368 static void *
369 failover_create_sampler_state(struct pipe_context *pipe,
370                               const struct pipe_sampler_state *templ)
371 {
372    struct fo_state *state = malloc(sizeof(struct fo_state));
373    struct failover_context *failover = failover_context(pipe);
374
375    state->sw_state = failover->sw->create_sampler_state(failover->sw, templ);
376    state->hw_state = failover->hw->create_sampler_state(failover->hw, templ);
377
378    return state;
379 }
380
381 static void
382 failover_bind_fragment_sampler_states(struct pipe_context *pipe,
383                                       unsigned num,
384                                       void **sampler)
385 {
386    struct failover_context *failover = failover_context(pipe);
387    struct fo_state *state = (struct fo_state*)sampler;
388    uint i;
389    assert(num <= PIPE_MAX_SAMPLERS);
390    /* Check for no-op */
391    if (num == failover->num_samplers &&
392        !memcmp(failover->sampler, sampler, num * sizeof(void *)))
393       return;
394    for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
395       failover->sw_sampler_state[i] = i < num ? state[i].sw_state : NULL;
396       failover->hw_sampler_state[i] = i < num ? state[i].hw_state : NULL;
397    }
398    failover->dirty |= FO_NEW_SAMPLER;
399    failover->num_samplers = num;
400    failover->sw->bind_fragment_sampler_states(failover->sw, num,
401                                               failover->sw_sampler_state);
402    failover->hw->bind_fragment_sampler_states(failover->hw, num,
403                                               failover->hw_sampler_state);
404 }
405
406 static void
407 failover_bind_vertex_sampler_states(struct pipe_context *pipe,
408                                     unsigned num_samplers,
409                                     void **samplers)
410 {
411    struct failover_context *failover = failover_context(pipe);
412    struct fo_state *state = (struct fo_state*)samplers;
413    uint i;
414
415    assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS);
416
417    /* Check for no-op */
418    if (num_samplers == failover->num_vertex_samplers &&
419        !memcmp(failover->vertex_samplers, samplers, num_samplers * sizeof(void *))) {
420       return;
421    }
422    for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
423       failover->sw_vertex_sampler_state[i] = i < num_samplers ? state[i].sw_state : NULL;
424       failover->hw_vertex_sampler_state[i] = i < num_samplers ? state[i].hw_state : NULL;
425    }
426    failover->dirty |= FO_NEW_SAMPLER;
427    failover->num_vertex_samplers = num_samplers;
428    failover->sw->bind_vertex_sampler_states(failover->sw,
429                                             num_samplers,
430                                             failover->sw_vertex_sampler_state);
431    failover->hw->bind_vertex_sampler_states(failover->hw,
432                                             num_samplers,
433                                             failover->hw_vertex_sampler_state);
434 }
435
436 static void
437 failover_delete_sampler_state(struct pipe_context *pipe, void *sampler)
438 {
439    struct fo_state *state = (struct fo_state*)sampler;
440    struct failover_context *failover = failover_context(pipe);
441
442    failover->sw->delete_sampler_state(failover->sw, state->sw_state);
443    failover->hw->delete_sampler_state(failover->hw, state->hw_state);
444    state->sw_state = 0;
445    state->hw_state = 0;
446    free(state);
447 }
448
449
450 static struct pipe_sampler_view *
451 failover_create_sampler_view(struct pipe_context *pipe,
452                              struct pipe_texture *texture,
453                              const struct pipe_sampler_view *templ)
454 {
455    struct fo_sampler_view *view = malloc(sizeof(struct fo_sampler_view));
456    struct failover_context *failover = failover_context(pipe);
457
458    view->sw = failover->sw->create_sampler_view(failover->sw, texture, templ);
459    view->hw = failover->hw->create_sampler_view(failover->hw, texture, templ);
460
461    view->base = *templ;
462    view->base.reference.count = 1;
463    view->base.texture = NULL;
464    pipe_texture_reference(&view->base.texture, texture);
465    view->base.context = pipe;
466
467    return &view->base;
468 }
469
470 static void
471 failover_sampler_view_destroy(struct pipe_context *pipe,
472                               struct pipe_sampler_view *view)
473 {
474    struct fo_sampler_view *fo_view = (struct fo_sampler_view *)view;
475    struct failover_context *failover = failover_context(pipe);
476
477    failover->sw->sampler_view_destroy(failover->sw, fo_view->sw);
478    failover->hw->sampler_view_destroy(failover->hw, fo_view->hw);
479
480    pipe_texture_reference(&fo_view->base.texture, NULL);
481    free(fo_view);
482 }
483
484 static void
485 failover_set_fragment_sampler_views(struct pipe_context *pipe,
486                                     unsigned num,
487                                     struct pipe_sampler_view **views)
488 {
489    struct failover_context *failover = failover_context(pipe);
490    struct pipe_sampler_view *hw_views[PIPE_MAX_SAMPLERS];
491    uint i;
492
493    assert(num <= PIPE_MAX_SAMPLERS);
494
495    /* Check for no-op */
496    if (num == failover->num_fragment_sampler_views &&
497        !memcmp(failover->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
498       return;
499    for (i = 0; i < num; i++) {
500       struct fo_sampler_view *fo_view = (struct fo_sampler_view *)views[i];
501
502       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->fragment_sampler_views[i], views[i]);
503       hw_views[i] = fo_view->hw;
504    }
505    for (i = num; i < failover->num_fragment_sampler_views; i++)
506       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->fragment_sampler_views[i], NULL);
507    failover->dirty |= FO_NEW_SAMPLER_VIEW;
508    failover->num_fragment_sampler_views = num;
509    failover->hw->set_fragment_sampler_views(failover->hw, num, hw_views);
510 }
511
512
513 static void
514 failover_set_vertex_sampler_views(struct pipe_context *pipe,
515                                   unsigned num,
516                                   struct pipe_sampler_view **views)
517 {
518    struct failover_context *failover = failover_context(pipe);
519    struct pipe_sampler_view *hw_views[PIPE_MAX_VERTEX_SAMPLERS];
520    uint i;
521
522    assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
523
524    /* Check for no-op */
525    if (num == failover->num_vertex_sampler_views &&
526        !memcmp(failover->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
527       return;
528    }
529    for (i = 0; i < num; i++) {
530       struct fo_sampler_view *fo_view = (struct fo_sampler_view *)views[i];
531
532       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->vertex_sampler_views[i], views[i]);
533       hw_views[i] = fo_view->hw;
534    }
535    for (i = num; i < failover->num_vertex_sampler_views; i++)
536       pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->vertex_sampler_views[i], NULL);
537    failover->dirty |= FO_NEW_SAMPLER_VIEW;
538    failover->num_vertex_sampler_views = num;
539    failover->hw->set_vertex_sampler_views(failover->hw, num, hw_views);
540 }
541
542
543 static void 
544 failover_set_viewport_state( struct pipe_context *pipe,
545                              const struct pipe_viewport_state *viewport )
546 {
547    struct failover_context *failover = failover_context(pipe);
548
549    failover->viewport = *viewport; 
550    failover->dirty |= FO_NEW_VIEWPORT;
551    failover->sw->set_viewport_state( failover->sw, viewport );
552    failover->hw->set_viewport_state( failover->hw, viewport );
553 }
554
555
556 static void
557 failover_set_vertex_buffers(struct pipe_context *pipe,
558                             unsigned count,
559                             const struct pipe_vertex_buffer *vertex_buffers)
560 {
561    struct failover_context *failover = failover_context(pipe);
562
563    memcpy(failover->vertex_buffers, vertex_buffers,
564           count * sizeof(vertex_buffers[0]));
565    failover->dirty |= FO_NEW_VERTEX_BUFFER;
566    failover->num_vertex_buffers = count;
567    failover->sw->set_vertex_buffers( failover->sw, count, vertex_buffers );
568    failover->hw->set_vertex_buffers( failover->hw, count, vertex_buffers );
569 }
570
571
572 void
573 failover_set_constant_buffer(struct pipe_context *pipe,
574                              uint shader, uint index,
575                              struct pipe_buffer *buf)
576 {
577    struct failover_context *failover = failover_context(pipe);
578
579    assert(shader < PIPE_SHADER_TYPES);
580    assert(index == 0);
581
582    failover->sw->set_constant_buffer(failover->sw, shader, index, buf);
583    failover->hw->set_constant_buffer(failover->hw, shader, index, buf);
584 }
585
586
587 void
588 failover_init_state_functions( struct failover_context *failover )
589 {
590    failover->pipe.create_blend_state = failover_create_blend_state;
591    failover->pipe.bind_blend_state   = failover_bind_blend_state;
592    failover->pipe.delete_blend_state = failover_delete_blend_state;
593    failover->pipe.create_sampler_state = failover_create_sampler_state;
594    failover->pipe.bind_fragment_sampler_states  = failover_bind_fragment_sampler_states;
595    failover->pipe.bind_vertex_sampler_states  = failover_bind_vertex_sampler_states;
596    failover->pipe.delete_sampler_state = failover_delete_sampler_state;
597    failover->pipe.create_depth_stencil_alpha_state = failover_create_depth_stencil_state;
598    failover->pipe.bind_depth_stencil_alpha_state   = failover_bind_depth_stencil_state;
599    failover->pipe.delete_depth_stencil_alpha_state = failover_delete_depth_stencil_state;
600    failover->pipe.create_rasterizer_state = failover_create_rasterizer_state;
601    failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
602    failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state;
603    failover->pipe.create_fs_state = failover_create_fs_state;
604    failover->pipe.bind_fs_state   = failover_bind_fs_state;
605    failover->pipe.delete_fs_state = failover_delete_fs_state;
606    failover->pipe.create_vs_state = failover_create_vs_state;
607    failover->pipe.bind_vs_state   = failover_bind_vs_state;
608    failover->pipe.delete_vs_state = failover_delete_vs_state;
609    failover->pipe.create_vertex_elements_state = failover_create_vertex_elements_state;
610    failover->pipe.bind_vertex_elements_state = failover_bind_vertex_elements_state;
611    failover->pipe.delete_vertex_elements_state = failover_delete_vertex_elements_state;
612
613    failover->pipe.set_blend_color = failover_set_blend_color;
614    failover->pipe.set_stencil_ref = failover_set_stencil_ref;
615    failover->pipe.set_clip_state = failover_set_clip_state;
616    failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
617    failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
618    failover->pipe.set_scissor_state = failover_set_scissor_state;
619    failover->pipe.set_fragment_sampler_views = failover_set_fragment_sampler_views;
620    failover->pipe.set_vertex_sampler_views = failover_set_vertex_sampler_views;
621    failover->pipe.set_viewport_state = failover_set_viewport_state;
622    failover->pipe.set_vertex_buffers = failover_set_vertex_buffers;
623    failover->pipe.set_constant_buffer = failover_set_constant_buffer;
624    failover->pipe.create_sampler_view = failover_create_sampler_view;
625    failover->pipe.sampler_view_destroy = failover_sampler_view_destroy;
626 }