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 "glhd_context.h"
34 #include "glhd_objects.h"
38 galahad_destroy(struct pipe_context
*_pipe
)
40 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
41 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
49 galahad_draw_arrays(struct pipe_context
*_pipe
,
54 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
55 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
57 pipe
->draw_arrays(pipe
,
64 galahad_draw_elements(struct pipe_context
*_pipe
,
65 struct pipe_resource
*_indexResource
,
72 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
73 struct galahad_resource
*glhd_resource
= galahad_resource(_indexResource
);
74 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
75 struct pipe_resource
*indexResource
= glhd_resource
->resource
;
77 pipe
->draw_elements(pipe
,
87 galahad_draw_range_elements(struct pipe_context
*_pipe
,
88 struct pipe_resource
*_indexResource
,
97 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
98 struct galahad_resource
*glhd_resource
= galahad_resource(_indexResource
);
99 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
100 struct pipe_resource
*indexResource
= glhd_resource
->resource
;
102 pipe
->draw_range_elements(pipe
,
113 static struct pipe_query
*
114 galahad_create_query(struct pipe_context
*_pipe
,
117 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
118 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
120 return pipe
->create_query(pipe
,
125 galahad_destroy_query(struct pipe_context
*_pipe
,
126 struct pipe_query
*query
)
128 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
129 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
131 pipe
->destroy_query(pipe
,
136 galahad_begin_query(struct pipe_context
*_pipe
,
137 struct pipe_query
*query
)
139 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
140 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
142 pipe
->begin_query(pipe
,
147 galahad_end_query(struct pipe_context
*_pipe
,
148 struct pipe_query
*query
)
150 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
151 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
153 pipe
->end_query(pipe
,
158 galahad_get_query_result(struct pipe_context
*_pipe
,
159 struct pipe_query
*query
,
163 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
164 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
166 return pipe
->get_query_result(pipe
,
173 galahad_create_blend_state(struct pipe_context
*_pipe
,
174 const struct pipe_blend_state
*blend
)
176 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
177 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
179 return pipe
->create_blend_state(pipe
,
184 galahad_bind_blend_state(struct pipe_context
*_pipe
,
187 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
188 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
190 pipe
->bind_blend_state(pipe
,
195 galahad_delete_blend_state(struct pipe_context
*_pipe
,
198 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
199 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
201 pipe
->delete_blend_state(pipe
,
206 galahad_create_sampler_state(struct pipe_context
*_pipe
,
207 const struct pipe_sampler_state
*sampler
)
209 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
210 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
212 return pipe
->create_sampler_state(pipe
,
217 galahad_bind_fragment_sampler_states(struct pipe_context
*_pipe
,
218 unsigned num_samplers
,
221 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
222 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
224 pipe
->bind_fragment_sampler_states(pipe
,
230 galahad_bind_vertex_sampler_states(struct pipe_context
*_pipe
,
231 unsigned num_samplers
,
234 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
235 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
237 pipe
->bind_vertex_sampler_states(pipe
,
243 galahad_delete_sampler_state(struct pipe_context
*_pipe
,
246 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
247 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
249 pipe
->delete_sampler_state(pipe
,
254 galahad_create_rasterizer_state(struct pipe_context
*_pipe
,
255 const struct pipe_rasterizer_state
*rasterizer
)
257 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
258 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
260 return pipe
->create_rasterizer_state(pipe
,
265 galahad_bind_rasterizer_state(struct pipe_context
*_pipe
,
268 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
269 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
271 pipe
->bind_rasterizer_state(pipe
,
276 galahad_delete_rasterizer_state(struct pipe_context
*_pipe
,
279 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
280 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
282 pipe
->delete_rasterizer_state(pipe
,
287 galahad_create_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
288 const struct pipe_depth_stencil_alpha_state
*depth_stencil_alpha
)
290 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
291 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
293 return pipe
->create_depth_stencil_alpha_state(pipe
,
294 depth_stencil_alpha
);
298 galahad_bind_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
299 void *depth_stencil_alpha
)
301 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
302 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
304 pipe
->bind_depth_stencil_alpha_state(pipe
,
305 depth_stencil_alpha
);
309 galahad_delete_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
310 void *depth_stencil_alpha
)
312 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
313 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
315 pipe
->delete_depth_stencil_alpha_state(pipe
,
316 depth_stencil_alpha
);
320 galahad_create_fs_state(struct pipe_context
*_pipe
,
321 const struct pipe_shader_state
*fs
)
323 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
324 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
326 return pipe
->create_fs_state(pipe
,
331 galahad_bind_fs_state(struct pipe_context
*_pipe
,
334 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
335 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
337 pipe
->bind_fs_state(pipe
,
342 galahad_delete_fs_state(struct pipe_context
*_pipe
,
345 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
346 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
348 pipe
->delete_fs_state(pipe
,
353 galahad_create_vs_state(struct pipe_context
*_pipe
,
354 const struct pipe_shader_state
*vs
)
356 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
357 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
359 return pipe
->create_vs_state(pipe
,
364 galahad_bind_vs_state(struct pipe_context
*_pipe
,
367 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
368 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
370 pipe
->bind_vs_state(pipe
,
375 galahad_delete_vs_state(struct pipe_context
*_pipe
,
378 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
379 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
381 pipe
->delete_vs_state(pipe
,
387 galahad_create_vertex_elements_state(struct pipe_context
*_pipe
,
388 unsigned num_elements
,
389 const struct pipe_vertex_element
*vertex_elements
)
391 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
392 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
394 return pipe
->create_vertex_elements_state(pipe
,
400 galahad_bind_vertex_elements_state(struct pipe_context
*_pipe
,
403 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
404 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
406 pipe
->bind_vertex_elements_state(pipe
,
411 galahad_delete_vertex_elements_state(struct pipe_context
*_pipe
,
414 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
415 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
417 pipe
->delete_vertex_elements_state(pipe
,
422 galahad_set_blend_color(struct pipe_context
*_pipe
,
423 const struct pipe_blend_color
*blend_color
)
425 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
426 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
428 pipe
->set_blend_color(pipe
,
433 galahad_set_stencil_ref(struct pipe_context
*_pipe
,
434 const struct pipe_stencil_ref
*stencil_ref
)
436 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
437 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
439 pipe
->set_stencil_ref(pipe
,
444 galahad_set_clip_state(struct pipe_context
*_pipe
,
445 const struct pipe_clip_state
*clip
)
447 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
448 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
450 pipe
->set_clip_state(pipe
,
455 galahad_set_sample_mask(struct pipe_context
*_pipe
,
456 unsigned sample_mask
)
458 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
459 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
461 pipe
->set_sample_mask(pipe
,
466 galahad_set_constant_buffer(struct pipe_context
*_pipe
,
469 struct pipe_resource
*_resource
)
471 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
472 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
473 struct pipe_resource
*unwrapped_resource
;
474 struct pipe_resource
*resource
= NULL
;
476 /* XXX hmm? unwrap the input state */
478 unwrapped_resource
= galahad_resource_unwrap(_resource
);
479 resource
= unwrapped_resource
;
482 pipe
->set_constant_buffer(pipe
,
489 galahad_set_framebuffer_state(struct pipe_context
*_pipe
,
490 const struct pipe_framebuffer_state
*_state
)
492 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
493 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
494 struct pipe_framebuffer_state unwrapped_state
;
495 struct pipe_framebuffer_state
*state
= NULL
;
498 /* unwrap the input state */
500 memcpy(&unwrapped_state
, _state
, sizeof(unwrapped_state
));
501 for(i
= 0; i
< _state
->nr_cbufs
; i
++)
502 unwrapped_state
.cbufs
[i
] = galahad_surface_unwrap(_state
->cbufs
[i
]);
503 for (; i
< PIPE_MAX_COLOR_BUFS
; i
++)
504 unwrapped_state
.cbufs
[i
] = NULL
;
505 unwrapped_state
.zsbuf
= galahad_surface_unwrap(_state
->zsbuf
);
506 state
= &unwrapped_state
;
509 pipe
->set_framebuffer_state(pipe
,
514 galahad_set_polygon_stipple(struct pipe_context
*_pipe
,
515 const struct pipe_poly_stipple
*poly_stipple
)
517 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
518 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
520 pipe
->set_polygon_stipple(pipe
,
525 galahad_set_scissor_state(struct pipe_context
*_pipe
,
526 const struct pipe_scissor_state
*scissor
)
528 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
529 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
531 pipe
->set_scissor_state(pipe
,
536 galahad_set_viewport_state(struct pipe_context
*_pipe
,
537 const struct pipe_viewport_state
*viewport
)
539 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
540 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
542 pipe
->set_viewport_state(pipe
,
547 galahad_set_fragment_sampler_views(struct pipe_context
*_pipe
,
549 struct pipe_sampler_view
**_views
)
551 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
552 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
553 struct pipe_sampler_view
*unwrapped_views
[PIPE_MAX_SAMPLERS
];
554 struct pipe_sampler_view
**views
= NULL
;
558 for (i
= 0; i
< num
; i
++)
559 unwrapped_views
[i
] = galahad_sampler_view_unwrap(_views
[i
]);
560 for (; i
< PIPE_MAX_SAMPLERS
; i
++)
561 unwrapped_views
[i
] = NULL
;
563 views
= unwrapped_views
;
566 pipe
->set_fragment_sampler_views(pipe
, num
, views
);
570 galahad_set_vertex_sampler_views(struct pipe_context
*_pipe
,
572 struct pipe_sampler_view
**_views
)
574 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
575 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
576 struct pipe_sampler_view
*unwrapped_views
[PIPE_MAX_VERTEX_SAMPLERS
];
577 struct pipe_sampler_view
**views
= NULL
;
581 for (i
= 0; i
< num
; i
++)
582 unwrapped_views
[i
] = galahad_sampler_view_unwrap(_views
[i
]);
583 for (; i
< PIPE_MAX_VERTEX_SAMPLERS
; i
++)
584 unwrapped_views
[i
] = NULL
;
586 views
= unwrapped_views
;
589 pipe
->set_vertex_sampler_views(pipe
, num
, views
);
593 galahad_set_vertex_buffers(struct pipe_context
*_pipe
,
594 unsigned num_buffers
,
595 const struct pipe_vertex_buffer
*_buffers
)
597 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
598 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
599 struct pipe_vertex_buffer unwrapped_buffers
[PIPE_MAX_SHADER_INPUTS
];
600 struct pipe_vertex_buffer
*buffers
= NULL
;
604 memcpy(unwrapped_buffers
, _buffers
, num_buffers
* sizeof(*_buffers
));
605 for (i
= 0; i
< num_buffers
; i
++)
606 unwrapped_buffers
[i
].buffer
= galahad_resource_unwrap(_buffers
[i
].buffer
);
607 buffers
= unwrapped_buffers
;
610 pipe
->set_vertex_buffers(pipe
,
615 galahad_resource_copy_region(struct pipe_context
*_pipe
,
616 struct pipe_resource
*_dst
,
617 struct pipe_subresource subdst
,
621 struct pipe_resource
*_src
,
622 struct pipe_subresource subsrc
,
629 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
630 struct galahad_resource
*glhd_resource_dst
= galahad_resource(_dst
);
631 struct galahad_resource
*glhd_resource_src
= galahad_resource(_src
);
632 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
633 struct pipe_resource
*dst
= glhd_resource_dst
->resource
;
634 struct pipe_resource
*src
= glhd_resource_src
->resource
;
636 pipe
->resource_copy_region(pipe
,
652 galahad_clear(struct pipe_context
*_pipe
,
658 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
659 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
669 galahad_clear_render_target(struct pipe_context
*_pipe
,
670 struct pipe_surface
*_dst
,
672 unsigned dstx
, unsigned dsty
,
673 unsigned width
, unsigned height
)
675 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
676 struct galahad_surface
*glhd_surface_dst
= galahad_surface(_dst
);
677 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
678 struct pipe_surface
*dst
= glhd_surface_dst
->surface
;
680 pipe
->clear_render_target(pipe
,
689 galahad_clear_depth_stencil(struct pipe_context
*_pipe
,
690 struct pipe_surface
*_dst
,
691 unsigned clear_flags
,
694 unsigned dstx
, unsigned dsty
,
695 unsigned width
, unsigned height
)
697 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
698 struct galahad_surface
*glhd_surface_dst
= galahad_surface(_dst
);
699 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
700 struct pipe_surface
*dst
= glhd_surface_dst
->surface
;
702 pipe
->clear_depth_stencil(pipe
,
715 galahad_flush(struct pipe_context
*_pipe
,
717 struct pipe_fence_handle
**fence
)
719 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
720 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
728 galahad_is_resource_referenced(struct pipe_context
*_pipe
,
729 struct pipe_resource
*_resource
,
733 struct galahad_context
*glhd_pipe
= galahad_context(_pipe
);
734 struct galahad_resource
*glhd_resource
= galahad_resource(_resource
);
735 struct pipe_context
*pipe
= glhd_pipe
->pipe
;
736 struct pipe_resource
*resource
= glhd_resource
->resource
;
738 return pipe
->is_resource_referenced(pipe
,
744 static struct pipe_sampler_view
*
745 galahad_context_create_sampler_view(struct pipe_context
*_pipe
,
746 struct pipe_resource
*_resource
,
747 const struct pipe_sampler_view
*templ
)
749 struct galahad_context
*glhd_context
= galahad_context(_pipe
);
750 struct galahad_resource
*glhd_resource
= galahad_resource(_resource
);
751 struct pipe_context
*pipe
= glhd_context
->pipe
;
752 struct pipe_resource
*resource
= glhd_resource
->resource
;
753 struct pipe_sampler_view
*result
;
755 result
= pipe
->create_sampler_view(pipe
,
760 return galahad_sampler_view_create(glhd_context
, glhd_resource
, result
);
765 galahad_context_sampler_view_destroy(struct pipe_context
*_pipe
,
766 struct pipe_sampler_view
*_view
)
768 galahad_sampler_view_destroy(galahad_context(_pipe
),
769 galahad_sampler_view(_view
));
772 static struct pipe_transfer
*
773 galahad_context_get_transfer(struct pipe_context
*_context
,
774 struct pipe_resource
*_resource
,
775 struct pipe_subresource sr
,
777 const struct pipe_box
*box
)
779 struct galahad_context
*glhd_context
= galahad_context(_context
);
780 struct galahad_resource
*glhd_resource
= galahad_resource(_resource
);
781 struct pipe_context
*context
= glhd_context
->pipe
;
782 struct pipe_resource
*resource
= glhd_resource
->resource
;
783 struct pipe_transfer
*result
;
785 result
= context
->get_transfer(context
,
792 return galahad_transfer_create(glhd_context
, glhd_resource
, result
);
797 galahad_context_transfer_destroy(struct pipe_context
*_pipe
,
798 struct pipe_transfer
*_transfer
)
800 galahad_transfer_destroy(galahad_context(_pipe
),
801 galahad_transfer(_transfer
));
805 galahad_context_transfer_map(struct pipe_context
*_context
,
806 struct pipe_transfer
*_transfer
)
808 struct galahad_context
*glhd_context
= galahad_context(_context
);
809 struct galahad_transfer
*glhd_transfer
= galahad_transfer(_transfer
);
810 struct pipe_context
*context
= glhd_context
->pipe
;
811 struct pipe_transfer
*transfer
= glhd_transfer
->transfer
;
813 return context
->transfer_map(context
,
820 galahad_context_transfer_flush_region(struct pipe_context
*_context
,
821 struct pipe_transfer
*_transfer
,
822 const struct pipe_box
*box
)
824 struct galahad_context
*glhd_context
= galahad_context(_context
);
825 struct galahad_transfer
*glhd_transfer
= galahad_transfer(_transfer
);
826 struct pipe_context
*context
= glhd_context
->pipe
;
827 struct pipe_transfer
*transfer
= glhd_transfer
->transfer
;
829 context
->transfer_flush_region(context
,
836 galahad_context_transfer_unmap(struct pipe_context
*_context
,
837 struct pipe_transfer
*_transfer
)
839 struct galahad_context
*glhd_context
= galahad_context(_context
);
840 struct galahad_transfer
*glhd_transfer
= galahad_transfer(_transfer
);
841 struct pipe_context
*context
= glhd_context
->pipe
;
842 struct pipe_transfer
*transfer
= glhd_transfer
->transfer
;
844 context
->transfer_unmap(context
,
850 galahad_context_transfer_inline_write(struct pipe_context
*_context
,
851 struct pipe_resource
*_resource
,
852 struct pipe_subresource sr
,
854 const struct pipe_box
*box
,
857 unsigned slice_stride
)
859 struct galahad_context
*glhd_context
= galahad_context(_context
);
860 struct galahad_resource
*glhd_resource
= galahad_resource(_resource
);
861 struct pipe_context
*context
= glhd_context
->pipe
;
862 struct pipe_resource
*resource
= glhd_resource
->resource
;
864 context
->transfer_inline_write(context
,
875 struct pipe_context
*
876 galahad_context_create(struct pipe_screen
*_screen
, struct pipe_context
*pipe
)
878 struct galahad_context
*glhd_pipe
;
879 (void)galahad_screen(_screen
);
881 glhd_pipe
= CALLOC_STRUCT(galahad_context
);
886 glhd_pipe
->base
.winsys
= NULL
;
887 glhd_pipe
->base
.screen
= _screen
;
888 glhd_pipe
->base
.priv
= pipe
->priv
; /* expose wrapped data */
889 glhd_pipe
->base
.draw
= NULL
;
891 glhd_pipe
->base
.destroy
= galahad_destroy
;
892 glhd_pipe
->base
.draw_arrays
= galahad_draw_arrays
;
893 glhd_pipe
->base
.draw_elements
= galahad_draw_elements
;
894 glhd_pipe
->base
.draw_range_elements
= galahad_draw_range_elements
;
895 glhd_pipe
->base
.create_query
= galahad_create_query
;
896 glhd_pipe
->base
.destroy_query
= galahad_destroy_query
;
897 glhd_pipe
->base
.begin_query
= galahad_begin_query
;
898 glhd_pipe
->base
.end_query
= galahad_end_query
;
899 glhd_pipe
->base
.get_query_result
= galahad_get_query_result
;
900 glhd_pipe
->base
.create_blend_state
= galahad_create_blend_state
;
901 glhd_pipe
->base
.bind_blend_state
= galahad_bind_blend_state
;
902 glhd_pipe
->base
.delete_blend_state
= galahad_delete_blend_state
;
903 glhd_pipe
->base
.create_sampler_state
= galahad_create_sampler_state
;
904 glhd_pipe
->base
.bind_fragment_sampler_states
= galahad_bind_fragment_sampler_states
;
905 glhd_pipe
->base
.bind_vertex_sampler_states
= galahad_bind_vertex_sampler_states
;
906 glhd_pipe
->base
.delete_sampler_state
= galahad_delete_sampler_state
;
907 glhd_pipe
->base
.create_rasterizer_state
= galahad_create_rasterizer_state
;
908 glhd_pipe
->base
.bind_rasterizer_state
= galahad_bind_rasterizer_state
;
909 glhd_pipe
->base
.delete_rasterizer_state
= galahad_delete_rasterizer_state
;
910 glhd_pipe
->base
.create_depth_stencil_alpha_state
= galahad_create_depth_stencil_alpha_state
;
911 glhd_pipe
->base
.bind_depth_stencil_alpha_state
= galahad_bind_depth_stencil_alpha_state
;
912 glhd_pipe
->base
.delete_depth_stencil_alpha_state
= galahad_delete_depth_stencil_alpha_state
;
913 glhd_pipe
->base
.create_fs_state
= galahad_create_fs_state
;
914 glhd_pipe
->base
.bind_fs_state
= galahad_bind_fs_state
;
915 glhd_pipe
->base
.delete_fs_state
= galahad_delete_fs_state
;
916 glhd_pipe
->base
.create_vs_state
= galahad_create_vs_state
;
917 glhd_pipe
->base
.bind_vs_state
= galahad_bind_vs_state
;
918 glhd_pipe
->base
.delete_vs_state
= galahad_delete_vs_state
;
919 glhd_pipe
->base
.create_vertex_elements_state
= galahad_create_vertex_elements_state
;
920 glhd_pipe
->base
.bind_vertex_elements_state
= galahad_bind_vertex_elements_state
;
921 glhd_pipe
->base
.delete_vertex_elements_state
= galahad_delete_vertex_elements_state
;
922 glhd_pipe
->base
.set_blend_color
= galahad_set_blend_color
;
923 glhd_pipe
->base
.set_stencil_ref
= galahad_set_stencil_ref
;
924 glhd_pipe
->base
.set_clip_state
= galahad_set_clip_state
;
925 glhd_pipe
->base
.set_sample_mask
= galahad_set_sample_mask
;
926 glhd_pipe
->base
.set_constant_buffer
= galahad_set_constant_buffer
;
927 glhd_pipe
->base
.set_framebuffer_state
= galahad_set_framebuffer_state
;
928 glhd_pipe
->base
.set_polygon_stipple
= galahad_set_polygon_stipple
;
929 glhd_pipe
->base
.set_scissor_state
= galahad_set_scissor_state
;
930 glhd_pipe
->base
.set_viewport_state
= galahad_set_viewport_state
;
931 glhd_pipe
->base
.set_fragment_sampler_views
= galahad_set_fragment_sampler_views
;
932 glhd_pipe
->base
.set_vertex_sampler_views
= galahad_set_vertex_sampler_views
;
933 glhd_pipe
->base
.set_vertex_buffers
= galahad_set_vertex_buffers
;
934 glhd_pipe
->base
.resource_copy_region
= galahad_resource_copy_region
;
935 glhd_pipe
->base
.clear
= galahad_clear
;
936 glhd_pipe
->base
.clear_render_target
= galahad_clear_render_target
;
937 glhd_pipe
->base
.clear_depth_stencil
= galahad_clear_depth_stencil
;
938 glhd_pipe
->base
.flush
= galahad_flush
;
939 glhd_pipe
->base
.is_resource_referenced
= galahad_is_resource_referenced
;
940 glhd_pipe
->base
.create_sampler_view
= galahad_context_create_sampler_view
;
941 glhd_pipe
->base
.sampler_view_destroy
= galahad_context_sampler_view_destroy
;
942 glhd_pipe
->base
.get_transfer
= galahad_context_get_transfer
;
943 glhd_pipe
->base
.transfer_destroy
= galahad_context_transfer_destroy
;
944 glhd_pipe
->base
.transfer_map
= galahad_context_transfer_map
;
945 glhd_pipe
->base
.transfer_unmap
= galahad_context_transfer_unmap
;
946 glhd_pipe
->base
.transfer_flush_region
= galahad_context_transfer_flush_region
;
947 glhd_pipe
->base
.transfer_inline_write
= galahad_context_transfer_inline_write
;
949 glhd_pipe
->pipe
= pipe
;
951 return &glhd_pipe
->base
;