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_vbo(struct pipe_context
*_pipe
,
50 const struct pipe_draw_info
*info
)
52 struct identity_context
*id_pipe
= identity_context(_pipe
);
53 struct pipe_context
*pipe
= id_pipe
->pipe
;
55 pipe
->draw_vbo(pipe
, info
);
58 static struct pipe_query
*
59 identity_create_query(struct pipe_context
*_pipe
,
62 struct identity_context
*id_pipe
= identity_context(_pipe
);
63 struct pipe_context
*pipe
= id_pipe
->pipe
;
65 return pipe
->create_query(pipe
,
70 identity_destroy_query(struct pipe_context
*_pipe
,
71 struct pipe_query
*query
)
73 struct identity_context
*id_pipe
= identity_context(_pipe
);
74 struct pipe_context
*pipe
= id_pipe
->pipe
;
76 pipe
->destroy_query(pipe
,
81 identity_begin_query(struct pipe_context
*_pipe
,
82 struct pipe_query
*query
)
84 struct identity_context
*id_pipe
= identity_context(_pipe
);
85 struct pipe_context
*pipe
= id_pipe
->pipe
;
87 pipe
->begin_query(pipe
,
92 identity_end_query(struct pipe_context
*_pipe
,
93 struct pipe_query
*query
)
95 struct identity_context
*id_pipe
= identity_context(_pipe
);
96 struct pipe_context
*pipe
= id_pipe
->pipe
;
103 identity_get_query_result(struct pipe_context
*_pipe
,
104 struct pipe_query
*query
,
106 union pipe_query_result
*result
)
108 struct identity_context
*id_pipe
= identity_context(_pipe
);
109 struct pipe_context
*pipe
= id_pipe
->pipe
;
111 return pipe
->get_query_result(pipe
,
118 identity_create_blend_state(struct pipe_context
*_pipe
,
119 const struct pipe_blend_state
*blend
)
121 struct identity_context
*id_pipe
= identity_context(_pipe
);
122 struct pipe_context
*pipe
= id_pipe
->pipe
;
124 return pipe
->create_blend_state(pipe
,
129 identity_bind_blend_state(struct pipe_context
*_pipe
,
132 struct identity_context
*id_pipe
= identity_context(_pipe
);
133 struct pipe_context
*pipe
= id_pipe
->pipe
;
135 pipe
->bind_blend_state(pipe
,
140 identity_delete_blend_state(struct pipe_context
*_pipe
,
143 struct identity_context
*id_pipe
= identity_context(_pipe
);
144 struct pipe_context
*pipe
= id_pipe
->pipe
;
146 pipe
->delete_blend_state(pipe
,
151 identity_create_sampler_state(struct pipe_context
*_pipe
,
152 const struct pipe_sampler_state
*sampler
)
154 struct identity_context
*id_pipe
= identity_context(_pipe
);
155 struct pipe_context
*pipe
= id_pipe
->pipe
;
157 return pipe
->create_sampler_state(pipe
,
162 identity_bind_sampler_states(struct pipe_context
*_pipe
,
165 unsigned num_samplers
,
168 struct identity_context
*id_pipe
= identity_context(_pipe
);
169 struct pipe_context
*pipe
= id_pipe
->pipe
;
171 /* remove this when we have pipe->bind_sampler_states(..., start, ...) */
175 case PIPE_SHADER_VERTEX
:
176 pipe
->bind_vertex_sampler_states(pipe
, num_samplers
, samplers
);
178 case PIPE_SHADER_GEOMETRY
:
179 pipe
->bind_geometry_sampler_states(pipe
, num_samplers
, samplers
);
181 case PIPE_SHADER_FRAGMENT
:
182 pipe
->bind_fragment_sampler_states(pipe
, num_samplers
, samplers
);
185 debug_error("Unexpected shader in identity_bind_sampler_states()");
190 identity_bind_fragment_sampler_states(struct pipe_context
*_pipe
,
191 unsigned num_samplers
,
194 identity_bind_sampler_states(_pipe
, PIPE_SHADER_FRAGMENT
,
195 0, num_samplers
, samplers
);
199 identity_bind_vertex_sampler_states(struct pipe_context
*_pipe
,
200 unsigned num_samplers
,
203 identity_bind_sampler_states(_pipe
, PIPE_SHADER_VERTEX
,
204 0, num_samplers
, samplers
);
208 identity_delete_sampler_state(struct pipe_context
*_pipe
,
211 struct identity_context
*id_pipe
= identity_context(_pipe
);
212 struct pipe_context
*pipe
= id_pipe
->pipe
;
214 pipe
->delete_sampler_state(pipe
,
219 identity_create_rasterizer_state(struct pipe_context
*_pipe
,
220 const struct pipe_rasterizer_state
*rasterizer
)
222 struct identity_context
*id_pipe
= identity_context(_pipe
);
223 struct pipe_context
*pipe
= id_pipe
->pipe
;
225 return pipe
->create_rasterizer_state(pipe
,
230 identity_bind_rasterizer_state(struct pipe_context
*_pipe
,
233 struct identity_context
*id_pipe
= identity_context(_pipe
);
234 struct pipe_context
*pipe
= id_pipe
->pipe
;
236 pipe
->bind_rasterizer_state(pipe
,
241 identity_delete_rasterizer_state(struct pipe_context
*_pipe
,
244 struct identity_context
*id_pipe
= identity_context(_pipe
);
245 struct pipe_context
*pipe
= id_pipe
->pipe
;
247 pipe
->delete_rasterizer_state(pipe
,
252 identity_create_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
253 const struct pipe_depth_stencil_alpha_state
*depth_stencil_alpha
)
255 struct identity_context
*id_pipe
= identity_context(_pipe
);
256 struct pipe_context
*pipe
= id_pipe
->pipe
;
258 return pipe
->create_depth_stencil_alpha_state(pipe
,
259 depth_stencil_alpha
);
263 identity_bind_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
264 void *depth_stencil_alpha
)
266 struct identity_context
*id_pipe
= identity_context(_pipe
);
267 struct pipe_context
*pipe
= id_pipe
->pipe
;
269 pipe
->bind_depth_stencil_alpha_state(pipe
,
270 depth_stencil_alpha
);
274 identity_delete_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
275 void *depth_stencil_alpha
)
277 struct identity_context
*id_pipe
= identity_context(_pipe
);
278 struct pipe_context
*pipe
= id_pipe
->pipe
;
280 pipe
->delete_depth_stencil_alpha_state(pipe
,
281 depth_stencil_alpha
);
285 identity_create_fs_state(struct pipe_context
*_pipe
,
286 const struct pipe_shader_state
*fs
)
288 struct identity_context
*id_pipe
= identity_context(_pipe
);
289 struct pipe_context
*pipe
= id_pipe
->pipe
;
291 return pipe
->create_fs_state(pipe
,
296 identity_bind_fs_state(struct pipe_context
*_pipe
,
299 struct identity_context
*id_pipe
= identity_context(_pipe
);
300 struct pipe_context
*pipe
= id_pipe
->pipe
;
302 pipe
->bind_fs_state(pipe
,
307 identity_delete_fs_state(struct pipe_context
*_pipe
,
310 struct identity_context
*id_pipe
= identity_context(_pipe
);
311 struct pipe_context
*pipe
= id_pipe
->pipe
;
313 pipe
->delete_fs_state(pipe
,
318 identity_create_vs_state(struct pipe_context
*_pipe
,
319 const struct pipe_shader_state
*vs
)
321 struct identity_context
*id_pipe
= identity_context(_pipe
);
322 struct pipe_context
*pipe
= id_pipe
->pipe
;
324 return pipe
->create_vs_state(pipe
,
329 identity_bind_vs_state(struct pipe_context
*_pipe
,
332 struct identity_context
*id_pipe
= identity_context(_pipe
);
333 struct pipe_context
*pipe
= id_pipe
->pipe
;
335 pipe
->bind_vs_state(pipe
,
340 identity_delete_vs_state(struct pipe_context
*_pipe
,
343 struct identity_context
*id_pipe
= identity_context(_pipe
);
344 struct pipe_context
*pipe
= id_pipe
->pipe
;
346 pipe
->delete_vs_state(pipe
,
352 identity_create_vertex_elements_state(struct pipe_context
*_pipe
,
353 unsigned num_elements
,
354 const struct pipe_vertex_element
*vertex_elements
)
356 struct identity_context
*id_pipe
= identity_context(_pipe
);
357 struct pipe_context
*pipe
= id_pipe
->pipe
;
359 return pipe
->create_vertex_elements_state(pipe
,
365 identity_bind_vertex_elements_state(struct pipe_context
*_pipe
,
368 struct identity_context
*id_pipe
= identity_context(_pipe
);
369 struct pipe_context
*pipe
= id_pipe
->pipe
;
371 pipe
->bind_vertex_elements_state(pipe
,
376 identity_delete_vertex_elements_state(struct pipe_context
*_pipe
,
379 struct identity_context
*id_pipe
= identity_context(_pipe
);
380 struct pipe_context
*pipe
= id_pipe
->pipe
;
382 pipe
->delete_vertex_elements_state(pipe
,
387 identity_set_blend_color(struct pipe_context
*_pipe
,
388 const struct pipe_blend_color
*blend_color
)
390 struct identity_context
*id_pipe
= identity_context(_pipe
);
391 struct pipe_context
*pipe
= id_pipe
->pipe
;
393 pipe
->set_blend_color(pipe
,
398 identity_set_stencil_ref(struct pipe_context
*_pipe
,
399 const struct pipe_stencil_ref
*stencil_ref
)
401 struct identity_context
*id_pipe
= identity_context(_pipe
);
402 struct pipe_context
*pipe
= id_pipe
->pipe
;
404 pipe
->set_stencil_ref(pipe
,
409 identity_set_clip_state(struct pipe_context
*_pipe
,
410 const struct pipe_clip_state
*clip
)
412 struct identity_context
*id_pipe
= identity_context(_pipe
);
413 struct pipe_context
*pipe
= id_pipe
->pipe
;
415 pipe
->set_clip_state(pipe
,
420 identity_set_sample_mask(struct pipe_context
*_pipe
,
421 unsigned sample_mask
)
423 struct identity_context
*id_pipe
= identity_context(_pipe
);
424 struct pipe_context
*pipe
= id_pipe
->pipe
;
426 pipe
->set_sample_mask(pipe
,
431 identity_set_constant_buffer(struct pipe_context
*_pipe
,
434 struct pipe_constant_buffer
*_cb
)
436 struct identity_context
*id_pipe
= identity_context(_pipe
);
437 struct pipe_context
*pipe
= id_pipe
->pipe
;
438 struct pipe_constant_buffer cb
;
440 /* XXX hmm? unwrap the input state */
443 cb
.buffer
= identity_resource_unwrap(_cb
->buffer
);
446 pipe
->set_constant_buffer(pipe
,
453 identity_set_framebuffer_state(struct pipe_context
*_pipe
,
454 const struct pipe_framebuffer_state
*_state
)
456 struct identity_context
*id_pipe
= identity_context(_pipe
);
457 struct pipe_context
*pipe
= id_pipe
->pipe
;
458 struct pipe_framebuffer_state unwrapped_state
;
459 struct pipe_framebuffer_state
*state
= NULL
;
462 /* unwrap the input state */
464 memcpy(&unwrapped_state
, _state
, sizeof(unwrapped_state
));
465 for(i
= 0; i
< _state
->nr_cbufs
; i
++)
466 unwrapped_state
.cbufs
[i
] = identity_surface_unwrap(_state
->cbufs
[i
]);
467 for (; i
< PIPE_MAX_COLOR_BUFS
; i
++)
468 unwrapped_state
.cbufs
[i
] = NULL
;
469 unwrapped_state
.zsbuf
= identity_surface_unwrap(_state
->zsbuf
);
470 state
= &unwrapped_state
;
473 pipe
->set_framebuffer_state(pipe
,
478 identity_set_polygon_stipple(struct pipe_context
*_pipe
,
479 const struct pipe_poly_stipple
*poly_stipple
)
481 struct identity_context
*id_pipe
= identity_context(_pipe
);
482 struct pipe_context
*pipe
= id_pipe
->pipe
;
484 pipe
->set_polygon_stipple(pipe
,
489 identity_set_scissor_state(struct pipe_context
*_pipe
,
490 const struct pipe_scissor_state
*scissor
)
492 struct identity_context
*id_pipe
= identity_context(_pipe
);
493 struct pipe_context
*pipe
= id_pipe
->pipe
;
495 pipe
->set_scissor_state(pipe
,
500 identity_set_viewport_state(struct pipe_context
*_pipe
,
501 const struct pipe_viewport_state
*viewport
)
503 struct identity_context
*id_pipe
= identity_context(_pipe
);
504 struct pipe_context
*pipe
= id_pipe
->pipe
;
506 pipe
->set_viewport_state(pipe
,
511 identity_set_sampler_views(struct pipe_context
*_pipe
,
515 struct pipe_sampler_view
**_views
)
517 struct identity_context
*id_pipe
= identity_context(_pipe
);
518 struct pipe_context
*pipe
= id_pipe
->pipe
;
519 struct pipe_sampler_view
*unwrapped_views
[PIPE_MAX_SAMPLERS
];
520 struct pipe_sampler_view
**views
= NULL
;
523 /* remove this when we have pipe->set_sampler_views(..., start, ...) */
527 for (i
= 0; i
< num
; i
++)
528 unwrapped_views
[i
] = identity_sampler_view_unwrap(_views
[i
]);
529 for (; i
< PIPE_MAX_SAMPLERS
; i
++)
530 unwrapped_views
[i
] = NULL
;
532 views
= unwrapped_views
;
536 case PIPE_SHADER_VERTEX
:
537 pipe
->set_vertex_sampler_views(pipe
, num
, views
);
539 case PIPE_SHADER_GEOMETRY
:
540 pipe
->set_geometry_sampler_views(pipe
, num
, views
);
542 case PIPE_SHADER_FRAGMENT
:
543 pipe
->set_fragment_sampler_views(pipe
, num
, views
);
546 debug_error("Unexpected shader in identity_set_sampler_views()");
551 identity_set_fragment_sampler_views(struct pipe_context
*_pipe
,
553 struct pipe_sampler_view
**_views
)
555 identity_set_sampler_views(_pipe
, PIPE_SHADER_FRAGMENT
, 0, num
, _views
);
559 identity_set_vertex_sampler_views(struct pipe_context
*_pipe
,
561 struct pipe_sampler_view
**_views
)
563 identity_set_sampler_views(_pipe
, PIPE_SHADER_VERTEX
, 0, num
, _views
);
567 identity_set_vertex_buffers(struct pipe_context
*_pipe
,
568 unsigned num_buffers
,
569 const struct pipe_vertex_buffer
*_buffers
)
571 struct identity_context
*id_pipe
= identity_context(_pipe
);
572 struct pipe_context
*pipe
= id_pipe
->pipe
;
573 struct pipe_vertex_buffer unwrapped_buffers
[PIPE_MAX_SHADER_INPUTS
];
574 struct pipe_vertex_buffer
*buffers
= NULL
;
578 memcpy(unwrapped_buffers
, _buffers
, num_buffers
* sizeof(*_buffers
));
579 for (i
= 0; i
< num_buffers
; i
++)
580 unwrapped_buffers
[i
].buffer
= identity_resource_unwrap(_buffers
[i
].buffer
);
581 buffers
= unwrapped_buffers
;
584 pipe
->set_vertex_buffers(pipe
,
590 identity_set_index_buffer(struct pipe_context
*_pipe
,
591 const struct pipe_index_buffer
*_ib
)
593 struct identity_context
*id_pipe
= identity_context(_pipe
);
594 struct pipe_context
*pipe
= id_pipe
->pipe
;
595 struct pipe_index_buffer unwrapped_ib
, *ib
= NULL
;
599 unwrapped_ib
.buffer
= identity_resource_unwrap(_ib
->buffer
);
603 pipe
->set_index_buffer(pipe
, ib
);
607 identity_resource_copy_region(struct pipe_context
*_pipe
,
608 struct pipe_resource
*_dst
,
613 struct pipe_resource
*_src
,
615 const struct pipe_box
*src_box
)
617 struct identity_context
*id_pipe
= identity_context(_pipe
);
618 struct identity_resource
*id_resource_dst
= identity_resource(_dst
);
619 struct identity_resource
*id_resource_src
= identity_resource(_src
);
620 struct pipe_context
*pipe
= id_pipe
->pipe
;
621 struct pipe_resource
*dst
= id_resource_dst
->resource
;
622 struct pipe_resource
*src
= id_resource_src
->resource
;
624 pipe
->resource_copy_region(pipe
,
636 identity_blit(struct pipe_context
*_pipe
,
637 const struct pipe_blit_info
*info
)
639 struct identity_context
*id_pipe
= identity_context(_pipe
);
640 struct pipe_context
*pipe
= id_pipe
->pipe
;
641 struct pipe_blit_info blit
= *info
;
643 blit
.src
.resource
= identity_resource(blit
.src
.resource
)->resource
;
644 blit
.dst
.resource
= identity_resource(blit
.dst
.resource
)->resource
;
646 pipe
->blit(pipe
, &blit
);
650 identity_clear(struct pipe_context
*_pipe
,
652 const union pipe_color_union
*color
,
656 struct identity_context
*id_pipe
= identity_context(_pipe
);
657 struct pipe_context
*pipe
= id_pipe
->pipe
;
667 identity_clear_render_target(struct pipe_context
*_pipe
,
668 struct pipe_surface
*_dst
,
669 const union pipe_color_union
*color
,
670 unsigned dstx
, unsigned dsty
,
671 unsigned width
, unsigned height
)
673 struct identity_context
*id_pipe
= identity_context(_pipe
);
674 struct identity_surface
*id_surface_dst
= identity_surface(_dst
);
675 struct pipe_context
*pipe
= id_pipe
->pipe
;
676 struct pipe_surface
*dst
= id_surface_dst
->surface
;
678 pipe
->clear_render_target(pipe
,
687 identity_clear_depth_stencil(struct pipe_context
*_pipe
,
688 struct pipe_surface
*_dst
,
689 unsigned clear_flags
,
692 unsigned dstx
, unsigned dsty
,
693 unsigned width
, unsigned height
)
695 struct identity_context
*id_pipe
= identity_context(_pipe
);
696 struct identity_surface
*id_surface_dst
= identity_surface(_dst
);
697 struct pipe_context
*pipe
= id_pipe
->pipe
;
698 struct pipe_surface
*dst
= id_surface_dst
->surface
;
700 pipe
->clear_depth_stencil(pipe
,
713 identity_flush(struct pipe_context
*_pipe
,
714 struct pipe_fence_handle
**fence
)
716 struct identity_context
*id_pipe
= identity_context(_pipe
);
717 struct pipe_context
*pipe
= id_pipe
->pipe
;
723 static struct pipe_sampler_view
*
724 identity_context_create_sampler_view(struct pipe_context
*_pipe
,
725 struct pipe_resource
*_resource
,
726 const struct pipe_sampler_view
*templ
)
728 struct identity_context
*id_context
= identity_context(_pipe
);
729 struct identity_resource
*id_resource
= identity_resource(_resource
);
730 struct pipe_context
*pipe
= id_context
->pipe
;
731 struct pipe_resource
*resource
= id_resource
->resource
;
732 struct pipe_sampler_view
*result
;
734 result
= pipe
->create_sampler_view(pipe
,
739 return identity_sampler_view_create(id_context
, id_resource
, result
);
744 identity_context_sampler_view_destroy(struct pipe_context
*_pipe
,
745 struct pipe_sampler_view
*_view
)
747 identity_sampler_view_destroy(identity_context(_pipe
),
748 identity_sampler_view(_view
));
751 static struct pipe_surface
*
752 identity_context_create_surface(struct pipe_context
*_pipe
,
753 struct pipe_resource
*_resource
,
754 const struct pipe_surface
*templ
)
756 struct identity_context
*id_context
= identity_context(_pipe
);
757 struct identity_resource
*id_resource
= identity_resource(_resource
);
758 struct pipe_context
*pipe
= id_context
->pipe
;
759 struct pipe_resource
*resource
= id_resource
->resource
;
760 struct pipe_surface
*result
;
762 result
= pipe
->create_surface(pipe
,
767 return identity_surface_create(id_context
, id_resource
, result
);
772 identity_context_surface_destroy(struct pipe_context
*_pipe
,
773 struct pipe_surface
*_surf
)
775 identity_surface_destroy(identity_context(_pipe
),
776 identity_surface(_surf
));
779 static struct pipe_transfer
*
780 identity_context_get_transfer(struct pipe_context
*_context
,
781 struct pipe_resource
*_resource
,
784 const struct pipe_box
*box
)
786 struct identity_context
*id_context
= identity_context(_context
);
787 struct identity_resource
*id_resource
= identity_resource(_resource
);
788 struct pipe_context
*context
= id_context
->pipe
;
789 struct pipe_resource
*resource
= id_resource
->resource
;
790 struct pipe_transfer
*result
;
792 result
= context
->get_transfer(context
,
799 return identity_transfer_create(id_context
, id_resource
, result
);
804 identity_context_transfer_destroy(struct pipe_context
*_pipe
,
805 struct pipe_transfer
*_transfer
)
807 identity_transfer_destroy(identity_context(_pipe
),
808 identity_transfer(_transfer
));
812 identity_context_transfer_map(struct pipe_context
*_context
,
813 struct pipe_transfer
*_transfer
)
815 struct identity_context
*id_context
= identity_context(_context
);
816 struct identity_transfer
*id_transfer
= identity_transfer(_transfer
);
817 struct pipe_context
*context
= id_context
->pipe
;
818 struct pipe_transfer
*transfer
= id_transfer
->transfer
;
820 return context
->transfer_map(context
,
827 identity_context_transfer_flush_region(struct pipe_context
*_context
,
828 struct pipe_transfer
*_transfer
,
829 const struct pipe_box
*box
)
831 struct identity_context
*id_context
= identity_context(_context
);
832 struct identity_transfer
*id_transfer
= identity_transfer(_transfer
);
833 struct pipe_context
*context
= id_context
->pipe
;
834 struct pipe_transfer
*transfer
= id_transfer
->transfer
;
836 context
->transfer_flush_region(context
,
843 identity_context_transfer_unmap(struct pipe_context
*_context
,
844 struct pipe_transfer
*_transfer
)
846 struct identity_context
*id_context
= identity_context(_context
);
847 struct identity_transfer
*id_transfer
= identity_transfer(_transfer
);
848 struct pipe_context
*context
= id_context
->pipe
;
849 struct pipe_transfer
*transfer
= id_transfer
->transfer
;
851 context
->transfer_unmap(context
,
857 identity_context_transfer_inline_write(struct pipe_context
*_context
,
858 struct pipe_resource
*_resource
,
861 const struct pipe_box
*box
,
864 unsigned layer_stride
)
866 struct identity_context
*id_context
= identity_context(_context
);
867 struct identity_resource
*id_resource
= identity_resource(_resource
);
868 struct pipe_context
*context
= id_context
->pipe
;
869 struct pipe_resource
*resource
= id_resource
->resource
;
871 context
->transfer_inline_write(context
,
882 struct pipe_context
*
883 identity_context_create(struct pipe_screen
*_screen
, struct pipe_context
*pipe
)
885 struct identity_context
*id_pipe
;
886 (void)identity_screen(_screen
);
888 id_pipe
= CALLOC_STRUCT(identity_context
);
893 id_pipe
->base
.screen
= _screen
;
894 id_pipe
->base
.priv
= pipe
->priv
; /* expose wrapped data */
895 id_pipe
->base
.draw
= NULL
;
897 id_pipe
->base
.destroy
= identity_destroy
;
898 id_pipe
->base
.draw_vbo
= identity_draw_vbo
;
899 id_pipe
->base
.create_query
= identity_create_query
;
900 id_pipe
->base
.destroy_query
= identity_destroy_query
;
901 id_pipe
->base
.begin_query
= identity_begin_query
;
902 id_pipe
->base
.end_query
= identity_end_query
;
903 id_pipe
->base
.get_query_result
= identity_get_query_result
;
904 id_pipe
->base
.create_blend_state
= identity_create_blend_state
;
905 id_pipe
->base
.bind_blend_state
= identity_bind_blend_state
;
906 id_pipe
->base
.delete_blend_state
= identity_delete_blend_state
;
907 id_pipe
->base
.create_sampler_state
= identity_create_sampler_state
;
908 id_pipe
->base
.bind_fragment_sampler_states
= identity_bind_fragment_sampler_states
;
909 id_pipe
->base
.bind_vertex_sampler_states
= identity_bind_vertex_sampler_states
;
910 id_pipe
->base
.delete_sampler_state
= identity_delete_sampler_state
;
911 id_pipe
->base
.create_rasterizer_state
= identity_create_rasterizer_state
;
912 id_pipe
->base
.bind_rasterizer_state
= identity_bind_rasterizer_state
;
913 id_pipe
->base
.delete_rasterizer_state
= identity_delete_rasterizer_state
;
914 id_pipe
->base
.create_depth_stencil_alpha_state
= identity_create_depth_stencil_alpha_state
;
915 id_pipe
->base
.bind_depth_stencil_alpha_state
= identity_bind_depth_stencil_alpha_state
;
916 id_pipe
->base
.delete_depth_stencil_alpha_state
= identity_delete_depth_stencil_alpha_state
;
917 id_pipe
->base
.create_fs_state
= identity_create_fs_state
;
918 id_pipe
->base
.bind_fs_state
= identity_bind_fs_state
;
919 id_pipe
->base
.delete_fs_state
= identity_delete_fs_state
;
920 id_pipe
->base
.create_vs_state
= identity_create_vs_state
;
921 id_pipe
->base
.bind_vs_state
= identity_bind_vs_state
;
922 id_pipe
->base
.delete_vs_state
= identity_delete_vs_state
;
923 id_pipe
->base
.create_vertex_elements_state
= identity_create_vertex_elements_state
;
924 id_pipe
->base
.bind_vertex_elements_state
= identity_bind_vertex_elements_state
;
925 id_pipe
->base
.delete_vertex_elements_state
= identity_delete_vertex_elements_state
;
926 id_pipe
->base
.set_blend_color
= identity_set_blend_color
;
927 id_pipe
->base
.set_stencil_ref
= identity_set_stencil_ref
;
928 id_pipe
->base
.set_clip_state
= identity_set_clip_state
;
929 id_pipe
->base
.set_sample_mask
= identity_set_sample_mask
;
930 id_pipe
->base
.set_constant_buffer
= identity_set_constant_buffer
;
931 id_pipe
->base
.set_framebuffer_state
= identity_set_framebuffer_state
;
932 id_pipe
->base
.set_polygon_stipple
= identity_set_polygon_stipple
;
933 id_pipe
->base
.set_scissor_state
= identity_set_scissor_state
;
934 id_pipe
->base
.set_viewport_state
= identity_set_viewport_state
;
935 id_pipe
->base
.set_fragment_sampler_views
= identity_set_fragment_sampler_views
;
936 id_pipe
->base
.set_vertex_sampler_views
= identity_set_vertex_sampler_views
;
937 id_pipe
->base
.set_vertex_buffers
= identity_set_vertex_buffers
;
938 id_pipe
->base
.set_index_buffer
= identity_set_index_buffer
;
939 id_pipe
->base
.resource_copy_region
= identity_resource_copy_region
;
940 id_pipe
->base
.clear
= identity_clear
;
941 id_pipe
->base
.clear_render_target
= identity_clear_render_target
;
942 id_pipe
->base
.clear_depth_stencil
= identity_clear_depth_stencil
;
943 id_pipe
->base
.flush
= identity_flush
;
944 id_pipe
->base
.create_surface
= identity_context_create_surface
;
945 id_pipe
->base
.surface_destroy
= identity_context_surface_destroy
;
946 id_pipe
->base
.create_sampler_view
= identity_context_create_sampler_view
;
947 id_pipe
->base
.sampler_view_destroy
= identity_context_sampler_view_destroy
;
948 id_pipe
->base
.get_transfer
= identity_context_get_transfer
;
949 id_pipe
->base
.transfer_destroy
= identity_context_transfer_destroy
;
950 id_pipe
->base
.transfer_map
= identity_context_transfer_map
;
951 id_pipe
->base
.transfer_unmap
= identity_context_transfer_unmap
;
952 id_pipe
->base
.transfer_flush_region
= identity_context_transfer_flush_region
;
953 id_pipe
->base
.transfer_inline_write
= identity_context_transfer_inline_write
;
954 id_pipe
->base
.blit
= identity_blit
;
956 id_pipe
->pipe
= pipe
;
958 return &id_pipe
->base
;