1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
29 #include "pipe/p_context.h"
30 #include "util/u_memory.h"
31 #include "util/u_inlines.h"
33 #include "id_context.h"
34 #include "id_objects.h"
38 identity_destroy(struct pipe_context
*_pipe
)
40 struct identity_context
*id_pipe
= identity_context(_pipe
);
41 struct pipe_context
*pipe
= id_pipe
->pipe
;
49 identity_draw_arrays(struct pipe_context
*_pipe
,
54 struct identity_context
*id_pipe
= identity_context(_pipe
);
55 struct pipe_context
*pipe
= id_pipe
->pipe
;
57 pipe
->draw_arrays(pipe
,
64 identity_draw_elements(struct pipe_context
*_pipe
,
65 struct pipe_resource
*_indexResource
,
72 struct identity_context
*id_pipe
= identity_context(_pipe
);
73 struct identity_resource
*id_resource
= identity_resource(_indexResource
);
74 struct pipe_context
*pipe
= id_pipe
->pipe
;
75 struct pipe_resource
*indexResource
= id_resource
->resource
;
77 pipe
->draw_elements(pipe
,
87 identity_draw_range_elements(struct pipe_context
*_pipe
,
88 struct pipe_resource
*_indexResource
,
97 struct identity_context
*id_pipe
= identity_context(_pipe
);
98 struct identity_resource
*id_resource
= identity_resource(_indexResource
);
99 struct pipe_context
*pipe
= id_pipe
->pipe
;
100 struct pipe_resource
*indexResource
= id_resource
->resource
;
102 pipe
->draw_range_elements(pipe
,
114 identity_draw_vbo(struct pipe_context
*_pipe
,
115 const struct pipe_draw_info
*info
)
117 struct identity_context
*id_pipe
= identity_context(_pipe
);
118 struct pipe_context
*pipe
= id_pipe
->pipe
;
120 pipe
->draw_vbo(pipe
, info
);
123 static struct pipe_query
*
124 identity_create_query(struct pipe_context
*_pipe
,
127 struct identity_context
*id_pipe
= identity_context(_pipe
);
128 struct pipe_context
*pipe
= id_pipe
->pipe
;
130 return pipe
->create_query(pipe
,
135 identity_destroy_query(struct pipe_context
*_pipe
,
136 struct pipe_query
*query
)
138 struct identity_context
*id_pipe
= identity_context(_pipe
);
139 struct pipe_context
*pipe
= id_pipe
->pipe
;
141 pipe
->destroy_query(pipe
,
146 identity_begin_query(struct pipe_context
*_pipe
,
147 struct pipe_query
*query
)
149 struct identity_context
*id_pipe
= identity_context(_pipe
);
150 struct pipe_context
*pipe
= id_pipe
->pipe
;
152 pipe
->begin_query(pipe
,
157 identity_end_query(struct pipe_context
*_pipe
,
158 struct pipe_query
*query
)
160 struct identity_context
*id_pipe
= identity_context(_pipe
);
161 struct pipe_context
*pipe
= id_pipe
->pipe
;
163 pipe
->end_query(pipe
,
168 identity_get_query_result(struct pipe_context
*_pipe
,
169 struct pipe_query
*query
,
173 struct identity_context
*id_pipe
= identity_context(_pipe
);
174 struct pipe_context
*pipe
= id_pipe
->pipe
;
176 return pipe
->get_query_result(pipe
,
183 identity_create_blend_state(struct pipe_context
*_pipe
,
184 const struct pipe_blend_state
*blend
)
186 struct identity_context
*id_pipe
= identity_context(_pipe
);
187 struct pipe_context
*pipe
= id_pipe
->pipe
;
189 return pipe
->create_blend_state(pipe
,
194 identity_bind_blend_state(struct pipe_context
*_pipe
,
197 struct identity_context
*id_pipe
= identity_context(_pipe
);
198 struct pipe_context
*pipe
= id_pipe
->pipe
;
200 pipe
->bind_blend_state(pipe
,
205 identity_delete_blend_state(struct pipe_context
*_pipe
,
208 struct identity_context
*id_pipe
= identity_context(_pipe
);
209 struct pipe_context
*pipe
= id_pipe
->pipe
;
211 pipe
->delete_blend_state(pipe
,
216 identity_create_sampler_state(struct pipe_context
*_pipe
,
217 const struct pipe_sampler_state
*sampler
)
219 struct identity_context
*id_pipe
= identity_context(_pipe
);
220 struct pipe_context
*pipe
= id_pipe
->pipe
;
222 return pipe
->create_sampler_state(pipe
,
227 identity_bind_fragment_sampler_states(struct pipe_context
*_pipe
,
228 unsigned num_samplers
,
231 struct identity_context
*id_pipe
= identity_context(_pipe
);
232 struct pipe_context
*pipe
= id_pipe
->pipe
;
234 pipe
->bind_fragment_sampler_states(pipe
,
240 identity_bind_vertex_sampler_states(struct pipe_context
*_pipe
,
241 unsigned num_samplers
,
244 struct identity_context
*id_pipe
= identity_context(_pipe
);
245 struct pipe_context
*pipe
= id_pipe
->pipe
;
247 pipe
->bind_vertex_sampler_states(pipe
,
253 identity_delete_sampler_state(struct pipe_context
*_pipe
,
256 struct identity_context
*id_pipe
= identity_context(_pipe
);
257 struct pipe_context
*pipe
= id_pipe
->pipe
;
259 pipe
->delete_sampler_state(pipe
,
264 identity_create_rasterizer_state(struct pipe_context
*_pipe
,
265 const struct pipe_rasterizer_state
*rasterizer
)
267 struct identity_context
*id_pipe
= identity_context(_pipe
);
268 struct pipe_context
*pipe
= id_pipe
->pipe
;
270 return pipe
->create_rasterizer_state(pipe
,
275 identity_bind_rasterizer_state(struct pipe_context
*_pipe
,
278 struct identity_context
*id_pipe
= identity_context(_pipe
);
279 struct pipe_context
*pipe
= id_pipe
->pipe
;
281 pipe
->bind_rasterizer_state(pipe
,
286 identity_delete_rasterizer_state(struct pipe_context
*_pipe
,
289 struct identity_context
*id_pipe
= identity_context(_pipe
);
290 struct pipe_context
*pipe
= id_pipe
->pipe
;
292 pipe
->delete_rasterizer_state(pipe
,
297 identity_create_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
298 const struct pipe_depth_stencil_alpha_state
*depth_stencil_alpha
)
300 struct identity_context
*id_pipe
= identity_context(_pipe
);
301 struct pipe_context
*pipe
= id_pipe
->pipe
;
303 return pipe
->create_depth_stencil_alpha_state(pipe
,
304 depth_stencil_alpha
);
308 identity_bind_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
309 void *depth_stencil_alpha
)
311 struct identity_context
*id_pipe
= identity_context(_pipe
);
312 struct pipe_context
*pipe
= id_pipe
->pipe
;
314 pipe
->bind_depth_stencil_alpha_state(pipe
,
315 depth_stencil_alpha
);
319 identity_delete_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
320 void *depth_stencil_alpha
)
322 struct identity_context
*id_pipe
= identity_context(_pipe
);
323 struct pipe_context
*pipe
= id_pipe
->pipe
;
325 pipe
->delete_depth_stencil_alpha_state(pipe
,
326 depth_stencil_alpha
);
330 identity_create_fs_state(struct pipe_context
*_pipe
,
331 const struct pipe_shader_state
*fs
)
333 struct identity_context
*id_pipe
= identity_context(_pipe
);
334 struct pipe_context
*pipe
= id_pipe
->pipe
;
336 return pipe
->create_fs_state(pipe
,
341 identity_bind_fs_state(struct pipe_context
*_pipe
,
344 struct identity_context
*id_pipe
= identity_context(_pipe
);
345 struct pipe_context
*pipe
= id_pipe
->pipe
;
347 pipe
->bind_fs_state(pipe
,
352 identity_delete_fs_state(struct pipe_context
*_pipe
,
355 struct identity_context
*id_pipe
= identity_context(_pipe
);
356 struct pipe_context
*pipe
= id_pipe
->pipe
;
358 pipe
->delete_fs_state(pipe
,
363 identity_create_vs_state(struct pipe_context
*_pipe
,
364 const struct pipe_shader_state
*vs
)
366 struct identity_context
*id_pipe
= identity_context(_pipe
);
367 struct pipe_context
*pipe
= id_pipe
->pipe
;
369 return pipe
->create_vs_state(pipe
,
374 identity_bind_vs_state(struct pipe_context
*_pipe
,
377 struct identity_context
*id_pipe
= identity_context(_pipe
);
378 struct pipe_context
*pipe
= id_pipe
->pipe
;
380 pipe
->bind_vs_state(pipe
,
385 identity_delete_vs_state(struct pipe_context
*_pipe
,
388 struct identity_context
*id_pipe
= identity_context(_pipe
);
389 struct pipe_context
*pipe
= id_pipe
->pipe
;
391 pipe
->delete_vs_state(pipe
,
397 identity_create_vertex_elements_state(struct pipe_context
*_pipe
,
398 unsigned num_elements
,
399 const struct pipe_vertex_element
*vertex_elements
)
401 struct identity_context
*id_pipe
= identity_context(_pipe
);
402 struct pipe_context
*pipe
= id_pipe
->pipe
;
404 return pipe
->create_vertex_elements_state(pipe
,
410 identity_bind_vertex_elements_state(struct pipe_context
*_pipe
,
413 struct identity_context
*id_pipe
= identity_context(_pipe
);
414 struct pipe_context
*pipe
= id_pipe
->pipe
;
416 pipe
->bind_vertex_elements_state(pipe
,
421 identity_delete_vertex_elements_state(struct pipe_context
*_pipe
,
424 struct identity_context
*id_pipe
= identity_context(_pipe
);
425 struct pipe_context
*pipe
= id_pipe
->pipe
;
427 pipe
->delete_vertex_elements_state(pipe
,
432 identity_set_blend_color(struct pipe_context
*_pipe
,
433 const struct pipe_blend_color
*blend_color
)
435 struct identity_context
*id_pipe
= identity_context(_pipe
);
436 struct pipe_context
*pipe
= id_pipe
->pipe
;
438 pipe
->set_blend_color(pipe
,
443 identity_set_stencil_ref(struct pipe_context
*_pipe
,
444 const struct pipe_stencil_ref
*stencil_ref
)
446 struct identity_context
*id_pipe
= identity_context(_pipe
);
447 struct pipe_context
*pipe
= id_pipe
->pipe
;
449 pipe
->set_stencil_ref(pipe
,
454 identity_set_clip_state(struct pipe_context
*_pipe
,
455 const struct pipe_clip_state
*clip
)
457 struct identity_context
*id_pipe
= identity_context(_pipe
);
458 struct pipe_context
*pipe
= id_pipe
->pipe
;
460 pipe
->set_clip_state(pipe
,
465 identity_set_sample_mask(struct pipe_context
*_pipe
,
466 unsigned sample_mask
)
468 struct identity_context
*id_pipe
= identity_context(_pipe
);
469 struct pipe_context
*pipe
= id_pipe
->pipe
;
471 pipe
->set_sample_mask(pipe
,
476 identity_set_constant_buffer(struct pipe_context
*_pipe
,
479 struct pipe_resource
*_resource
)
481 struct identity_context
*id_pipe
= identity_context(_pipe
);
482 struct pipe_context
*pipe
= id_pipe
->pipe
;
483 struct pipe_resource
*unwrapped_resource
;
484 struct pipe_resource
*resource
= NULL
;
486 /* XXX hmm? unwrap the input state */
488 unwrapped_resource
= identity_resource_unwrap(_resource
);
489 resource
= unwrapped_resource
;
492 pipe
->set_constant_buffer(pipe
,
499 identity_set_framebuffer_state(struct pipe_context
*_pipe
,
500 const struct pipe_framebuffer_state
*_state
)
502 struct identity_context
*id_pipe
= identity_context(_pipe
);
503 struct pipe_context
*pipe
= id_pipe
->pipe
;
504 struct pipe_framebuffer_state unwrapped_state
;
505 struct pipe_framebuffer_state
*state
= NULL
;
508 /* unwrap the input state */
510 memcpy(&unwrapped_state
, _state
, sizeof(unwrapped_state
));
511 for(i
= 0; i
< _state
->nr_cbufs
; i
++)
512 unwrapped_state
.cbufs
[i
] = identity_surface_unwrap(_state
->cbufs
[i
]);
513 for (; i
< PIPE_MAX_COLOR_BUFS
; i
++)
514 unwrapped_state
.cbufs
[i
] = NULL
;
515 unwrapped_state
.zsbuf
= identity_surface_unwrap(_state
->zsbuf
);
516 state
= &unwrapped_state
;
519 pipe
->set_framebuffer_state(pipe
,
524 identity_set_polygon_stipple(struct pipe_context
*_pipe
,
525 const struct pipe_poly_stipple
*poly_stipple
)
527 struct identity_context
*id_pipe
= identity_context(_pipe
);
528 struct pipe_context
*pipe
= id_pipe
->pipe
;
530 pipe
->set_polygon_stipple(pipe
,
535 identity_set_scissor_state(struct pipe_context
*_pipe
,
536 const struct pipe_scissor_state
*scissor
)
538 struct identity_context
*id_pipe
= identity_context(_pipe
);
539 struct pipe_context
*pipe
= id_pipe
->pipe
;
541 pipe
->set_scissor_state(pipe
,
546 identity_set_viewport_state(struct pipe_context
*_pipe
,
547 const struct pipe_viewport_state
*viewport
)
549 struct identity_context
*id_pipe
= identity_context(_pipe
);
550 struct pipe_context
*pipe
= id_pipe
->pipe
;
552 pipe
->set_viewport_state(pipe
,
557 identity_set_fragment_sampler_views(struct pipe_context
*_pipe
,
559 struct pipe_sampler_view
**_views
)
561 struct identity_context
*id_pipe
= identity_context(_pipe
);
562 struct pipe_context
*pipe
= id_pipe
->pipe
;
563 struct pipe_sampler_view
*unwrapped_views
[PIPE_MAX_SAMPLERS
];
564 struct pipe_sampler_view
**views
= NULL
;
568 for (i
= 0; i
< num
; i
++)
569 unwrapped_views
[i
] = identity_sampler_view_unwrap(_views
[i
]);
570 for (; i
< PIPE_MAX_SAMPLERS
; i
++)
571 unwrapped_views
[i
] = NULL
;
573 views
= unwrapped_views
;
576 pipe
->set_fragment_sampler_views(pipe
, num
, views
);
580 identity_set_vertex_sampler_views(struct pipe_context
*_pipe
,
582 struct pipe_sampler_view
**_views
)
584 struct identity_context
*id_pipe
= identity_context(_pipe
);
585 struct pipe_context
*pipe
= id_pipe
->pipe
;
586 struct pipe_sampler_view
*unwrapped_views
[PIPE_MAX_VERTEX_SAMPLERS
];
587 struct pipe_sampler_view
**views
= NULL
;
591 for (i
= 0; i
< num
; i
++)
592 unwrapped_views
[i
] = identity_sampler_view_unwrap(_views
[i
]);
593 for (; i
< PIPE_MAX_VERTEX_SAMPLERS
; i
++)
594 unwrapped_views
[i
] = NULL
;
596 views
= unwrapped_views
;
599 pipe
->set_vertex_sampler_views(pipe
, num
, views
);
603 identity_set_vertex_buffers(struct pipe_context
*_pipe
,
604 unsigned num_buffers
,
605 const struct pipe_vertex_buffer
*_buffers
)
607 struct identity_context
*id_pipe
= identity_context(_pipe
);
608 struct pipe_context
*pipe
= id_pipe
->pipe
;
609 struct pipe_vertex_buffer unwrapped_buffers
[PIPE_MAX_SHADER_INPUTS
];
610 struct pipe_vertex_buffer
*buffers
= NULL
;
614 memcpy(unwrapped_buffers
, _buffers
, num_buffers
* sizeof(*_buffers
));
615 for (i
= 0; i
< num_buffers
; i
++)
616 unwrapped_buffers
[i
].buffer
= identity_resource_unwrap(_buffers
[i
].buffer
);
617 buffers
= unwrapped_buffers
;
620 pipe
->set_vertex_buffers(pipe
,
626 identity_set_index_buffer(struct pipe_context
*_pipe
,
627 const struct pipe_index_buffer
*_ib
)
629 struct identity_context
*id_pipe
= identity_context(_pipe
);
630 struct pipe_context
*pipe
= id_pipe
->pipe
;
631 struct pipe_index_buffer unwrapped_ib
, *ib
= NULL
;
635 unwrapped_ib
.buffer
= identity_resource_unwrap(_ib
->buffer
);
639 pipe
->set_index_buffer(pipe
, ib
);
643 identity_resource_copy_region(struct pipe_context
*_pipe
,
644 struct pipe_resource
*_dst
,
645 struct pipe_subresource subdst
,
649 struct pipe_resource
*_src
,
650 struct pipe_subresource subsrc
,
657 struct identity_context
*id_pipe
= identity_context(_pipe
);
658 struct identity_resource
*id_resource_dst
= identity_resource(_dst
);
659 struct identity_resource
*id_resource_src
= identity_resource(_src
);
660 struct pipe_context
*pipe
= id_pipe
->pipe
;
661 struct pipe_resource
*dst
= id_resource_dst
->resource
;
662 struct pipe_resource
*src
= id_resource_src
->resource
;
664 pipe
->resource_copy_region(pipe
,
680 identity_clear(struct pipe_context
*_pipe
,
686 struct identity_context
*id_pipe
= identity_context(_pipe
);
687 struct pipe_context
*pipe
= id_pipe
->pipe
;
697 identity_clear_render_target(struct pipe_context
*_pipe
,
698 struct pipe_surface
*_dst
,
700 unsigned dstx
, unsigned dsty
,
701 unsigned width
, unsigned height
)
703 struct identity_context
*id_pipe
= identity_context(_pipe
);
704 struct identity_surface
*id_surface_dst
= identity_surface(_dst
);
705 struct pipe_context
*pipe
= id_pipe
->pipe
;
706 struct pipe_surface
*dst
= id_surface_dst
->surface
;
708 pipe
->clear_render_target(pipe
,
717 identity_clear_depth_stencil(struct pipe_context
*_pipe
,
718 struct pipe_surface
*_dst
,
719 unsigned clear_flags
,
722 unsigned dstx
, unsigned dsty
,
723 unsigned width
, unsigned height
)
725 struct identity_context
*id_pipe
= identity_context(_pipe
);
726 struct identity_surface
*id_surface_dst
= identity_surface(_dst
);
727 struct pipe_context
*pipe
= id_pipe
->pipe
;
728 struct pipe_surface
*dst
= id_surface_dst
->surface
;
730 pipe
->clear_depth_stencil(pipe
,
743 identity_flush(struct pipe_context
*_pipe
,
745 struct pipe_fence_handle
**fence
)
747 struct identity_context
*id_pipe
= identity_context(_pipe
);
748 struct pipe_context
*pipe
= id_pipe
->pipe
;
756 identity_is_resource_referenced(struct pipe_context
*_pipe
,
757 struct pipe_resource
*_resource
,
761 struct identity_context
*id_pipe
= identity_context(_pipe
);
762 struct identity_resource
*id_resource
= identity_resource(_resource
);
763 struct pipe_context
*pipe
= id_pipe
->pipe
;
764 struct pipe_resource
*resource
= id_resource
->resource
;
766 return pipe
->is_resource_referenced(pipe
,
772 static struct pipe_sampler_view
*
773 identity_context_create_sampler_view(struct pipe_context
*_pipe
,
774 struct pipe_resource
*_resource
,
775 const struct pipe_sampler_view
*templ
)
777 struct identity_context
*id_context
= identity_context(_pipe
);
778 struct identity_resource
*id_resource
= identity_resource(_resource
);
779 struct pipe_context
*pipe
= id_context
->pipe
;
780 struct pipe_resource
*resource
= id_resource
->resource
;
781 struct pipe_sampler_view
*result
;
783 result
= pipe
->create_sampler_view(pipe
,
788 return identity_sampler_view_create(id_context
, id_resource
, result
);
793 identity_context_sampler_view_destroy(struct pipe_context
*_pipe
,
794 struct pipe_sampler_view
*_view
)
796 identity_sampler_view_destroy(identity_context(_pipe
),
797 identity_sampler_view(_view
));
800 static struct pipe_transfer
*
801 identity_context_get_transfer(struct pipe_context
*_context
,
802 struct pipe_resource
*_resource
,
803 struct pipe_subresource sr
,
805 const struct pipe_box
*box
)
807 struct identity_context
*id_context
= identity_context(_context
);
808 struct identity_resource
*id_resource
= identity_resource(_resource
);
809 struct pipe_context
*context
= id_context
->pipe
;
810 struct pipe_resource
*resource
= id_resource
->resource
;
811 struct pipe_transfer
*result
;
813 result
= context
->get_transfer(context
,
820 return identity_transfer_create(id_context
, id_resource
, result
);
825 identity_context_transfer_destroy(struct pipe_context
*_pipe
,
826 struct pipe_transfer
*_transfer
)
828 identity_transfer_destroy(identity_context(_pipe
),
829 identity_transfer(_transfer
));
833 identity_context_transfer_map(struct pipe_context
*_context
,
834 struct pipe_transfer
*_transfer
)
836 struct identity_context
*id_context
= identity_context(_context
);
837 struct identity_transfer
*id_transfer
= identity_transfer(_transfer
);
838 struct pipe_context
*context
= id_context
->pipe
;
839 struct pipe_transfer
*transfer
= id_transfer
->transfer
;
841 return context
->transfer_map(context
,
848 identity_context_transfer_flush_region(struct pipe_context
*_context
,
849 struct pipe_transfer
*_transfer
,
850 const struct pipe_box
*box
)
852 struct identity_context
*id_context
= identity_context(_context
);
853 struct identity_transfer
*id_transfer
= identity_transfer(_transfer
);
854 struct pipe_context
*context
= id_context
->pipe
;
855 struct pipe_transfer
*transfer
= id_transfer
->transfer
;
857 context
->transfer_flush_region(context
,
864 identity_context_transfer_unmap(struct pipe_context
*_context
,
865 struct pipe_transfer
*_transfer
)
867 struct identity_context
*id_context
= identity_context(_context
);
868 struct identity_transfer
*id_transfer
= identity_transfer(_transfer
);
869 struct pipe_context
*context
= id_context
->pipe
;
870 struct pipe_transfer
*transfer
= id_transfer
->transfer
;
872 context
->transfer_unmap(context
,
878 identity_context_transfer_inline_write(struct pipe_context
*_context
,
879 struct pipe_resource
*_resource
,
880 struct pipe_subresource sr
,
882 const struct pipe_box
*box
,
885 unsigned slice_stride
)
887 struct identity_context
*id_context
= identity_context(_context
);
888 struct identity_resource
*id_resource
= identity_resource(_resource
);
889 struct pipe_context
*context
= id_context
->pipe
;
890 struct pipe_resource
*resource
= id_resource
->resource
;
892 context
->transfer_inline_write(context
,
903 struct pipe_context
*
904 identity_context_create(struct pipe_screen
*_screen
, struct pipe_context
*pipe
)
906 struct identity_context
*id_pipe
;
907 (void)identity_screen(_screen
);
909 id_pipe
= CALLOC_STRUCT(identity_context
);
914 id_pipe
->base
.winsys
= NULL
;
915 id_pipe
->base
.screen
= _screen
;
916 id_pipe
->base
.priv
= pipe
->priv
; /* expose wrapped data */
917 id_pipe
->base
.draw
= NULL
;
919 id_pipe
->base
.destroy
= identity_destroy
;
920 id_pipe
->base
.draw_arrays
= identity_draw_arrays
;
921 id_pipe
->base
.draw_elements
= identity_draw_elements
;
922 id_pipe
->base
.draw_range_elements
= identity_draw_range_elements
;
923 id_pipe
->base
.draw_vbo
= identity_draw_vbo
;
924 id_pipe
->base
.create_query
= identity_create_query
;
925 id_pipe
->base
.destroy_query
= identity_destroy_query
;
926 id_pipe
->base
.begin_query
= identity_begin_query
;
927 id_pipe
->base
.end_query
= identity_end_query
;
928 id_pipe
->base
.get_query_result
= identity_get_query_result
;
929 id_pipe
->base
.create_blend_state
= identity_create_blend_state
;
930 id_pipe
->base
.bind_blend_state
= identity_bind_blend_state
;
931 id_pipe
->base
.delete_blend_state
= identity_delete_blend_state
;
932 id_pipe
->base
.create_sampler_state
= identity_create_sampler_state
;
933 id_pipe
->base
.bind_fragment_sampler_states
= identity_bind_fragment_sampler_states
;
934 id_pipe
->base
.bind_vertex_sampler_states
= identity_bind_vertex_sampler_states
;
935 id_pipe
->base
.delete_sampler_state
= identity_delete_sampler_state
;
936 id_pipe
->base
.create_rasterizer_state
= identity_create_rasterizer_state
;
937 id_pipe
->base
.bind_rasterizer_state
= identity_bind_rasterizer_state
;
938 id_pipe
->base
.delete_rasterizer_state
= identity_delete_rasterizer_state
;
939 id_pipe
->base
.create_depth_stencil_alpha_state
= identity_create_depth_stencil_alpha_state
;
940 id_pipe
->base
.bind_depth_stencil_alpha_state
= identity_bind_depth_stencil_alpha_state
;
941 id_pipe
->base
.delete_depth_stencil_alpha_state
= identity_delete_depth_stencil_alpha_state
;
942 id_pipe
->base
.create_fs_state
= identity_create_fs_state
;
943 id_pipe
->base
.bind_fs_state
= identity_bind_fs_state
;
944 id_pipe
->base
.delete_fs_state
= identity_delete_fs_state
;
945 id_pipe
->base
.create_vs_state
= identity_create_vs_state
;
946 id_pipe
->base
.bind_vs_state
= identity_bind_vs_state
;
947 id_pipe
->base
.delete_vs_state
= identity_delete_vs_state
;
948 id_pipe
->base
.create_vertex_elements_state
= identity_create_vertex_elements_state
;
949 id_pipe
->base
.bind_vertex_elements_state
= identity_bind_vertex_elements_state
;
950 id_pipe
->base
.delete_vertex_elements_state
= identity_delete_vertex_elements_state
;
951 id_pipe
->base
.set_blend_color
= identity_set_blend_color
;
952 id_pipe
->base
.set_stencil_ref
= identity_set_stencil_ref
;
953 id_pipe
->base
.set_clip_state
= identity_set_clip_state
;
954 id_pipe
->base
.set_sample_mask
= identity_set_sample_mask
;
955 id_pipe
->base
.set_constant_buffer
= identity_set_constant_buffer
;
956 id_pipe
->base
.set_framebuffer_state
= identity_set_framebuffer_state
;
957 id_pipe
->base
.set_polygon_stipple
= identity_set_polygon_stipple
;
958 id_pipe
->base
.set_scissor_state
= identity_set_scissor_state
;
959 id_pipe
->base
.set_viewport_state
= identity_set_viewport_state
;
960 id_pipe
->base
.set_fragment_sampler_views
= identity_set_fragment_sampler_views
;
961 id_pipe
->base
.set_vertex_sampler_views
= identity_set_vertex_sampler_views
;
962 id_pipe
->base
.set_vertex_buffers
= identity_set_vertex_buffers
;
963 id_pipe
->base
.set_index_buffer
= identity_set_index_buffer
;
964 id_pipe
->base
.resource_copy_region
= identity_resource_copy_region
;
965 id_pipe
->base
.clear
= identity_clear
;
966 id_pipe
->base
.clear_render_target
= identity_clear_render_target
;
967 id_pipe
->base
.clear_depth_stencil
= identity_clear_depth_stencil
;
968 id_pipe
->base
.flush
= identity_flush
;
969 id_pipe
->base
.is_resource_referenced
= identity_is_resource_referenced
;
970 id_pipe
->base
.create_sampler_view
= identity_context_create_sampler_view
;
971 id_pipe
->base
.sampler_view_destroy
= identity_context_sampler_view_destroy
;
972 id_pipe
->base
.get_transfer
= identity_context_get_transfer
;
973 id_pipe
->base
.transfer_destroy
= identity_context_transfer_destroy
;
974 id_pipe
->base
.transfer_map
= identity_context_transfer_map
;
975 id_pipe
->base
.transfer_unmap
= identity_context_transfer_unmap
;
976 id_pipe
->base
.transfer_flush_region
= identity_context_transfer_flush_region
;
977 id_pipe
->base
.transfer_inline_write
= identity_context_transfer_inline_write
;
979 id_pipe
->pipe
= pipe
;
981 return &id_pipe
->base
;