ARB prog parser: Delete the old parser
[profile/ivi/mesa.git] / src / gallium / drivers / identity / id_context.c
1 /**************************************************************************
2  *
3  * Copyright 2009 VMware, Inc.
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 VMWARE 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
29 #include "pipe/p_context.h"
30 #include "util/u_memory.h"
31
32 #include "id_public.h"
33 #include "id_context.h"
34 #include "id_objects.h"
35
36
37 static void
38 identity_destroy(struct pipe_context *_pipe)
39 {
40    struct identity_context *id_pipe = identity_context(_pipe);
41    struct pipe_context *pipe = id_pipe->pipe;
42
43    pipe->destroy(pipe);
44
45    free(id_pipe);
46 }
47
48 static void
49 identity_set_edgeflags(struct pipe_context *_pipe,
50                        const unsigned *bitfield)
51 {
52    struct identity_context *id_pipe = identity_context(_pipe);
53    struct pipe_context *pipe = id_pipe->pipe;
54
55    pipe->set_edgeflags(pipe,
56                        bitfield);
57 }
58
59 static boolean
60 identity_draw_arrays(struct pipe_context *_pipe,
61                      unsigned prim,
62                      unsigned start,
63                      unsigned count)
64 {
65    struct identity_context *id_pipe = identity_context(_pipe);
66    struct pipe_context *pipe = id_pipe->pipe;
67
68    return pipe->draw_arrays(pipe,
69                             prim,
70                             start,
71                             count);
72 }
73
74 static boolean
75 identity_draw_elements(struct pipe_context *_pipe,
76                        struct pipe_buffer *_indexBuffer,
77                        unsigned indexSize,
78                        unsigned prim,
79                        unsigned start,
80                        unsigned count)
81 {
82    struct identity_context *id_pipe = identity_context(_pipe);
83    struct identity_buffer *id_buffer = identity_buffer(_indexBuffer);
84    struct pipe_context *pipe = id_pipe->pipe;
85    struct pipe_buffer *indexBuffer = id_buffer->buffer;
86
87    return pipe->draw_elements(pipe,
88                               indexBuffer,
89                               indexSize,
90                               prim,
91                               start,
92                               count);
93 }
94
95 static boolean
96 identity_draw_range_elements(struct pipe_context *_pipe,
97                              struct pipe_buffer *_indexBuffer,
98                              unsigned indexSize,
99                              unsigned minIndex,
100                              unsigned maxIndex,
101                              unsigned mode,
102                              unsigned start,
103                              unsigned count)
104 {
105    struct identity_context *id_pipe = identity_context(_pipe);
106    struct identity_buffer *id_buffer = identity_buffer(_indexBuffer);
107    struct pipe_context *pipe = id_pipe->pipe;
108    struct pipe_buffer *indexBuffer = id_buffer->buffer;
109
110    return pipe->draw_range_elements(pipe,
111                                     indexBuffer,
112                                     indexSize,
113                                     minIndex,
114                                     maxIndex,
115                                     mode,
116                                     start,
117                                     count);
118 }
119
120 static struct pipe_query *
121 identity_create_query(struct pipe_context *_pipe,
122                       unsigned query_type)
123 {
124    struct identity_context *id_pipe = identity_context(_pipe);
125    struct pipe_context *pipe = id_pipe->pipe;
126
127    return pipe->create_query(pipe,
128                              query_type);
129 }
130
131 static void
132 identity_destroy_query(struct pipe_context *_pipe,
133                        struct pipe_query *query)
134 {
135    struct identity_context *id_pipe = identity_context(_pipe);
136    struct pipe_context *pipe = id_pipe->pipe;
137
138    pipe->destroy_query(pipe,
139                        query);
140 }
141
142 static void
143 identity_begin_query(struct pipe_context *_pipe,
144                      struct pipe_query *query)
145 {
146    struct identity_context *id_pipe = identity_context(_pipe);
147    struct pipe_context *pipe = id_pipe->pipe;
148
149    pipe->begin_query(pipe,
150                      query);
151 }
152
153 static void
154 identity_end_query(struct pipe_context *_pipe,
155                    struct pipe_query *query)
156 {
157    struct identity_context *id_pipe = identity_context(_pipe);
158    struct pipe_context *pipe = id_pipe->pipe;
159
160    pipe->end_query(pipe,
161                    query);
162 }
163
164 static boolean
165 identity_get_query_result(struct pipe_context *_pipe,
166                           struct pipe_query *query,
167                           boolean wait,
168                           uint64_t *result)
169 {
170    struct identity_context *id_pipe = identity_context(_pipe);
171    struct pipe_context *pipe = id_pipe->pipe;
172
173    return pipe->get_query_result(pipe,
174                                  query,
175                                  wait,
176                                  result);
177 }
178
179 static void *
180 identity_create_blend_state(struct pipe_context *_pipe,
181                             const struct pipe_blend_state *blend)
182 {
183    struct identity_context *id_pipe = identity_context(_pipe);
184    struct pipe_context *pipe = id_pipe->pipe;
185
186    return pipe->create_blend_state(pipe,
187                                    blend);
188 }
189
190 static void
191 identity_bind_blend_state(struct pipe_context *_pipe,
192                           void *blend)
193 {
194    struct identity_context *id_pipe = identity_context(_pipe);
195    struct pipe_context *pipe = id_pipe->pipe;
196
197    pipe->bind_blend_state(pipe,
198                               blend);
199 }
200
201 static void
202 identity_delete_blend_state(struct pipe_context *_pipe,
203                             void *blend)
204 {
205    struct identity_context *id_pipe = identity_context(_pipe);
206    struct pipe_context *pipe = id_pipe->pipe;
207
208    pipe->delete_blend_state(pipe,
209                             blend);
210 }
211
212 static void *
213 identity_create_sampler_state(struct pipe_context *_pipe,
214                               const struct pipe_sampler_state *sampler)
215 {
216    struct identity_context *id_pipe = identity_context(_pipe);
217    struct pipe_context *pipe = id_pipe->pipe;
218
219    return pipe->create_sampler_state(pipe,
220                                      sampler);
221 }
222
223 static void
224 identity_bind_sampler_states(struct pipe_context *_pipe,
225                              unsigned num,
226                              void **samplers)
227 {
228    struct identity_context *id_pipe = identity_context(_pipe);
229    struct pipe_context *pipe = id_pipe->pipe;
230
231    pipe->bind_sampler_states(pipe,
232                              num,
233                              samplers);
234 }
235
236 static void
237 identity_delete_sampler_state(struct pipe_context *_pipe,
238                               void *sampler)
239 {
240    struct identity_context *id_pipe = identity_context(_pipe);
241    struct pipe_context *pipe = id_pipe->pipe;
242
243    pipe->delete_sampler_state(pipe,
244                               sampler);
245 }
246
247 static void *
248 identity_create_rasterizer_state(struct pipe_context *_pipe,
249                                  const struct pipe_rasterizer_state *rasterizer)
250 {
251    struct identity_context *id_pipe = identity_context(_pipe);
252    struct pipe_context *pipe = id_pipe->pipe;
253
254    return pipe->create_rasterizer_state(pipe,
255                                         rasterizer);
256 }
257
258 static void
259 identity_bind_rasterizer_state(struct pipe_context *_pipe,
260                                void *rasterizer)
261 {
262    struct identity_context *id_pipe = identity_context(_pipe);
263    struct pipe_context *pipe = id_pipe->pipe;
264
265    pipe->bind_rasterizer_state(pipe,
266                                rasterizer);
267 }
268
269 static void
270 identity_delete_rasterizer_state(struct pipe_context *_pipe,
271                                  void *rasterizer)
272 {
273    struct identity_context *id_pipe = identity_context(_pipe);
274    struct pipe_context *pipe = id_pipe->pipe;
275
276    pipe->delete_rasterizer_state(pipe,
277                                  rasterizer);
278 }
279
280 static void *
281 identity_create_depth_stencil_alpha_state(struct pipe_context *_pipe,
282                                           const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha)
283 {
284    struct identity_context *id_pipe = identity_context(_pipe);
285    struct pipe_context *pipe = id_pipe->pipe;
286
287    return pipe->create_depth_stencil_alpha_state(pipe,
288                                                  depth_stencil_alpha);
289 }
290
291 static void
292 identity_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
293                                         void *depth_stencil_alpha)
294 {
295    struct identity_context *id_pipe = identity_context(_pipe);
296    struct pipe_context *pipe = id_pipe->pipe;
297
298    pipe->bind_depth_stencil_alpha_state(pipe,
299                                         depth_stencil_alpha);
300 }
301
302 static void
303 identity_delete_depth_stencil_alpha_state(struct pipe_context *_pipe,
304                                           void *depth_stencil_alpha)
305 {
306    struct identity_context *id_pipe = identity_context(_pipe);
307    struct pipe_context *pipe = id_pipe->pipe;
308
309    pipe->delete_depth_stencil_alpha_state(pipe,
310                                           depth_stencil_alpha);
311 }
312
313 static void *
314 identity_create_fs_state(struct pipe_context *_pipe,
315                          const struct pipe_shader_state *fs)
316 {
317    struct identity_context *id_pipe = identity_context(_pipe);
318    struct pipe_context *pipe = id_pipe->pipe;
319
320    return pipe->create_fs_state(pipe,
321                                 fs);
322 }
323
324 static void
325 identity_bind_fs_state(struct pipe_context *_pipe,
326                        void *fs)
327 {
328    struct identity_context *id_pipe = identity_context(_pipe);
329    struct pipe_context *pipe = id_pipe->pipe;
330
331    pipe->bind_fs_state(pipe,
332                        fs);
333 }
334
335 static void
336 identity_delete_fs_state(struct pipe_context *_pipe,
337                          void *fs)
338 {
339    struct identity_context *id_pipe = identity_context(_pipe);
340    struct pipe_context *pipe = id_pipe->pipe;
341
342    pipe->delete_fs_state(pipe,
343                          fs);
344 }
345
346 static void *
347 identity_create_vs_state(struct pipe_context *_pipe,
348                          const struct pipe_shader_state *vs)
349 {
350    struct identity_context *id_pipe = identity_context(_pipe);
351    struct pipe_context *pipe = id_pipe->pipe;
352
353    return pipe->create_vs_state(pipe,
354                                 vs);
355 }
356
357 static void
358 identity_bind_vs_state(struct pipe_context *_pipe,
359                        void *vs)
360 {
361    struct identity_context *id_pipe = identity_context(_pipe);
362    struct pipe_context *pipe = id_pipe->pipe;
363
364    pipe->bind_vs_state(pipe,
365                        vs);
366 }
367
368 static void
369 identity_delete_vs_state(struct pipe_context *_pipe,
370                          void *vs)
371 {
372    struct identity_context *id_pipe = identity_context(_pipe);
373    struct pipe_context *pipe = id_pipe->pipe;
374
375    pipe->delete_vs_state(pipe,
376                          vs);
377 }
378
379 static void
380 identity_set_blend_color(struct pipe_context *_pipe,
381                          const struct pipe_blend_color *blend_color)
382 {
383    struct identity_context *id_pipe = identity_context(_pipe);
384    struct pipe_context *pipe = id_pipe->pipe;
385
386    pipe->set_blend_color(pipe,
387                          blend_color);
388 }
389
390 static void
391 identity_set_clip_state(struct pipe_context *_pipe,
392                         const struct pipe_clip_state *clip)
393 {
394    struct identity_context *id_pipe = identity_context(_pipe);
395    struct pipe_context *pipe = id_pipe->pipe;
396
397    pipe->set_clip_state(pipe,
398                         clip);
399 }
400
401 static void
402 identity_set_constant_buffer(struct pipe_context *_pipe,
403                              uint shader,
404                              uint index,
405                              const struct pipe_constant_buffer *_buffer)
406 {
407    struct identity_context *id_pipe = identity_context(_pipe);
408    struct pipe_context *pipe = id_pipe->pipe;
409    struct pipe_constant_buffer unwrapped_buffer;
410    struct pipe_constant_buffer *buffer = NULL;
411
412    /* unwrap the input state */
413    if (_buffer) {
414       unwrapped_buffer.buffer = identity_buffer_unwrap(_buffer->buffer);
415       buffer = &unwrapped_buffer;
416    }
417
418    pipe->set_constant_buffer(pipe,
419                              shader,
420                              index,
421                              buffer);
422 }
423
424 static void
425 identity_set_framebuffer_state(struct pipe_context *_pipe,
426                                const struct pipe_framebuffer_state *_state)
427 {
428    struct identity_context *id_pipe = identity_context(_pipe);
429    struct pipe_context *pipe = id_pipe->pipe;
430    struct pipe_framebuffer_state unwrapped_state;
431    struct pipe_framebuffer_state *state = NULL;
432    unsigned i;
433
434    /* unwrap the input state */
435    if (_state) {
436       memcpy(&unwrapped_state, _state, sizeof(unwrapped_state));
437       for(i = 0; i < _state->nr_cbufs; i++)
438          unwrapped_state.cbufs[i] = identity_surface_unwrap(_state->cbufs[i]);
439       for (; i < PIPE_MAX_COLOR_BUFS; i++)
440          unwrapped_state.cbufs[i] = NULL;
441       unwrapped_state.zsbuf = identity_surface_unwrap(_state->zsbuf);
442       state = &unwrapped_state;
443    }
444
445    pipe->set_framebuffer_state(pipe,
446                                state);
447 }
448
449 static void
450 identity_set_polygon_stipple(struct pipe_context *_pipe,
451                              const struct pipe_poly_stipple *poly_stipple)
452 {
453    struct identity_context *id_pipe = identity_context(_pipe);
454    struct pipe_context *pipe = id_pipe->pipe;
455
456    pipe->set_polygon_stipple(pipe,
457                              poly_stipple);
458 }
459
460 static void
461 identity_set_scissor_state(struct pipe_context *_pipe,
462                            const struct pipe_scissor_state *scissor)
463 {
464    struct identity_context *id_pipe = identity_context(_pipe);
465    struct pipe_context *pipe = id_pipe->pipe;
466
467    pipe->set_scissor_state(pipe,
468                            scissor);
469 }
470
471 static void
472 identity_set_viewport_state(struct pipe_context *_pipe,
473                             const struct pipe_viewport_state *viewport)
474 {
475    struct identity_context *id_pipe = identity_context(_pipe);
476    struct pipe_context *pipe = id_pipe->pipe;
477
478    pipe->set_viewport_state(pipe,
479                             viewport);
480 }
481
482 static void
483 identity_set_sampler_textures(struct pipe_context *_pipe,
484                               unsigned num_textures,
485                               struct pipe_texture **_textures)
486 {
487    struct identity_context *id_pipe = identity_context(_pipe);
488    struct pipe_context *pipe = id_pipe->pipe;
489    struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS];
490    struct pipe_texture **textures = NULL;
491    unsigned i;
492
493    if (_textures) {
494       for (i = 0; i < num_textures; i++)
495          unwrapped_textures[i] = identity_texture_unwrap(_textures[i]);
496       for (; i < PIPE_MAX_SAMPLERS; i++)
497          unwrapped_textures[i] = NULL;
498
499       textures = unwrapped_textures;
500    }
501
502    pipe->set_sampler_textures(pipe,
503                               num_textures,
504                               _textures);
505 }
506
507 static void
508 identity_set_vertex_buffers(struct pipe_context *_pipe,
509                             unsigned num_buffers,
510                             const struct pipe_vertex_buffer *_buffers)
511 {
512    struct identity_context *id_pipe = identity_context(_pipe);
513    struct pipe_context *pipe = id_pipe->pipe;
514    struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS];
515    struct pipe_vertex_buffer *buffers = NULL;
516    unsigned i;
517
518    if (num_buffers) {
519       memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers));
520       for (i = 0; i < num_buffers; i++)
521          unwrapped_buffers[i].buffer = identity_buffer_unwrap(_buffers[i].buffer);
522       buffers = unwrapped_buffers;
523    }
524
525    pipe->set_vertex_buffers(pipe,
526                             num_buffers,
527                             buffers);
528 }
529
530 static void
531 identity_set_vertex_elements(struct pipe_context *_pipe,
532                              unsigned num_elements,
533                              const struct pipe_vertex_element *vertex_elements)
534 {
535    struct identity_context *id_pipe = identity_context(_pipe);
536    struct pipe_context *pipe = id_pipe->pipe;
537
538    pipe->set_vertex_elements(pipe,
539                              num_elements,
540                              vertex_elements);
541 }
542
543 static void
544 identity_surface_copy(struct pipe_context *_pipe,
545                       struct pipe_surface *_dst,
546                       unsigned dstx,
547                       unsigned dsty,
548                       struct pipe_surface *_src,
549                       unsigned srcx,
550                       unsigned srcy,
551                       unsigned width,
552                       unsigned height)
553 {
554    struct identity_context *id_pipe = identity_context(_pipe);
555    struct identity_surface *id_surface_dst = identity_surface(_dst);
556    struct identity_surface *id_surface_src = identity_surface(_src);
557    struct pipe_context *pipe = id_pipe->pipe;
558    struct pipe_surface *dst = id_surface_dst->surface;
559    struct pipe_surface *src = id_surface_src->surface;
560
561    pipe->surface_copy(pipe,
562                       dst,
563                       dstx,
564                       dsty,
565                       src,
566                       srcx,
567                       srcy,
568                       width,
569                       height);
570 }
571
572 static void
573 identity_surface_fill(struct pipe_context *_pipe,
574                       struct pipe_surface *_dst,
575                       unsigned dstx,
576                       unsigned dsty,
577                       unsigned width,
578                       unsigned height,
579                       unsigned value)
580 {
581    struct identity_context *id_pipe = identity_context(_pipe);
582    struct identity_surface *id_surface_dst = identity_surface(_dst);
583    struct pipe_context *pipe = id_pipe->pipe;
584    struct pipe_surface *dst = id_surface_dst->surface;
585
586    pipe->surface_fill(pipe,
587                       dst,
588                       dstx,
589                       dsty,
590                       width,
591                       height,
592                       value);
593 }
594
595 static void
596 identity_clear(struct pipe_context *_pipe,
597                unsigned buffers,
598                const float *rgba,
599                double depth,
600                unsigned stencil)
601 {
602    struct identity_context *id_pipe = identity_context(_pipe);
603    struct pipe_context *pipe = id_pipe->pipe;
604
605    pipe->clear(pipe,
606                buffers,
607                rgba,
608                depth,
609                stencil);
610 }
611
612 static void
613 identity_flush(struct pipe_context *_pipe,
614                unsigned flags,
615                struct pipe_fence_handle **fence)
616 {
617    struct identity_context *id_pipe = identity_context(_pipe);
618    struct pipe_context *pipe = id_pipe->pipe;
619
620    pipe->flush(pipe,
621                flags,
622                fence);
623 }
624
625 static unsigned int
626 identity_is_texture_referenced(struct pipe_context *_pipe,
627                                struct pipe_texture *_texture,
628                                unsigned face,
629                                unsigned level)
630 {
631    struct identity_context *id_pipe = identity_context(_pipe);
632    struct identity_texture *id_texture = identity_texture(_texture);
633    struct pipe_context *pipe = id_pipe->pipe;
634    struct pipe_texture *texture = id_texture->texture;
635
636    return pipe->is_texture_referenced(pipe,
637                                       texture,
638                                       face,
639                                       level);
640 }
641
642 static unsigned int
643 identity_is_buffer_referenced(struct pipe_context *_pipe,
644                               struct pipe_buffer *_buffer)
645 {
646    struct identity_context *id_pipe = identity_context(_pipe);
647    struct identity_buffer *id_buffer = identity_buffer(_buffer);
648    struct pipe_context *pipe = id_pipe->pipe;
649    struct pipe_buffer *buffer = id_buffer->buffer;
650
651    return pipe->is_buffer_referenced(pipe,
652                                      buffer);
653 }
654
655 struct pipe_context *
656 identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
657 {
658    struct identity_context *id_pipe;
659    (void)identity_screen(_screen);
660
661    id_pipe = CALLOC_STRUCT(identity_context);
662    if (!id_pipe) {
663       return NULL;
664    }
665
666    id_pipe->base.winsys = NULL;
667    id_pipe->base.screen = _screen;
668    id_pipe->base.priv = pipe->priv;
669    id_pipe->base.draw = NULL;
670
671    id_pipe->base.destroy = identity_destroy;
672    id_pipe->base.set_edgeflags = identity_set_edgeflags;
673    id_pipe->base.draw_arrays = identity_draw_arrays;
674    id_pipe->base.draw_elements = identity_draw_elements;
675    id_pipe->base.draw_range_elements = identity_draw_range_elements;
676    id_pipe->base.create_query = identity_create_query;
677    id_pipe->base.destroy_query = identity_destroy_query;
678    id_pipe->base.begin_query = identity_begin_query;
679    id_pipe->base.end_query = identity_end_query;
680    id_pipe->base.get_query_result = identity_get_query_result;
681    id_pipe->base.create_blend_state = identity_create_blend_state;
682    id_pipe->base.bind_blend_state = identity_bind_blend_state;
683    id_pipe->base.delete_blend_state = identity_delete_blend_state;
684    id_pipe->base.create_sampler_state = identity_create_sampler_state;
685    id_pipe->base.bind_sampler_states = identity_bind_sampler_states;
686    id_pipe->base.delete_sampler_state = identity_delete_sampler_state;
687    id_pipe->base.create_rasterizer_state = identity_create_rasterizer_state;
688    id_pipe->base.bind_rasterizer_state = identity_bind_rasterizer_state;
689    id_pipe->base.delete_rasterizer_state = identity_delete_rasterizer_state;
690    id_pipe->base.create_depth_stencil_alpha_state = identity_create_depth_stencil_alpha_state;
691    id_pipe->base.bind_depth_stencil_alpha_state = identity_bind_depth_stencil_alpha_state;
692    id_pipe->base.delete_depth_stencil_alpha_state = identity_delete_depth_stencil_alpha_state;
693    id_pipe->base.create_fs_state = identity_create_fs_state;
694    id_pipe->base.bind_fs_state = identity_bind_fs_state;
695    id_pipe->base.delete_fs_state = identity_delete_fs_state;
696    id_pipe->base.create_vs_state = identity_create_vs_state;
697    id_pipe->base.bind_vs_state = identity_bind_vs_state;
698    id_pipe->base.delete_vs_state = identity_delete_vs_state;
699    id_pipe->base.set_blend_color = identity_set_blend_color;
700    id_pipe->base.set_clip_state = identity_set_clip_state;
701    id_pipe->base.set_constant_buffer = identity_set_constant_buffer;
702    id_pipe->base.set_framebuffer_state = identity_set_framebuffer_state;
703    id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
704    id_pipe->base.set_scissor_state = identity_set_scissor_state;
705    id_pipe->base.set_viewport_state = identity_set_viewport_state;
706    id_pipe->base.set_sampler_textures = identity_set_sampler_textures;
707    id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
708    id_pipe->base.set_vertex_elements = identity_set_vertex_elements;
709    id_pipe->base.surface_copy = identity_surface_copy;
710    id_pipe->base.surface_fill = identity_surface_fill;
711    id_pipe->base.clear = identity_clear;
712    id_pipe->base.flush = identity_flush;
713    id_pipe->base.is_texture_referenced = identity_is_texture_referenced;
714    id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced;
715
716    id_pipe->pipe = pipe;
717
718    return &id_pipe->base;
719 }