1 /**************************************************************************
3 * Copyright 2010 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"
32 #include "util/simple_list.h"
34 #include "rbug/rbug_context.h"
36 #include "rbug_context.h"
37 #include "rbug_objects.h"
41 rbug_destroy(struct pipe_context
*_pipe
)
43 struct rbug_screen
*rb_screen
= rbug_screen(_pipe
->screen
);
44 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
45 struct pipe_context
*pipe
= rb_pipe
->pipe
;
47 rbug_screen_remove_from_list(rb_screen
, contexts
, rb_pipe
);
49 mtx_lock(&rb_pipe
->call_mutex
);
52 mtx_unlock(&rb_pipe
->call_mutex
);
58 rbug_draw_block_locked(struct rbug_context
*rb_pipe
, int flag
)
61 if (rb_pipe
->draw_blocker
& flag
) {
62 rb_pipe
->draw_blocked
|= flag
;
63 } else if ((rb_pipe
->draw_rule
.blocker
& flag
) &&
64 (rb_pipe
->draw_blocker
& RBUG_BLOCK_RULE
)) {
69 debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__
,
70 (void *) rb_pipe
->draw_rule
.shader
[PIPE_SHADER_FRAGMENT
],
71 (void *) rb_pipe
->curr
.shader
[PIPE_SHADER_FRAGMENT
],
72 (void *) rb_pipe
->draw_rule
.shader
[PIPE_SHADER_VERTEX
],
73 (void *) rb_pipe
->curr
.shader
[PIPE_SHADER_VERTEX
],
74 (void *) rb_pipe
->draw_rule
.surf
, 0,
75 (void *) rb_pipe
->draw_rule
.texture
, 0);
76 for (sh
= 0; sh
< PIPE_SHADER_TYPES
; sh
++) {
77 if (rb_pipe
->draw_rule
.shader
[sh
] &&
78 rb_pipe
->draw_rule
.shader
[sh
] == rb_pipe
->curr
.shader
[sh
])
82 if (rb_pipe
->draw_rule
.surf
&&
83 rb_pipe
->draw_rule
.surf
== rb_pipe
->curr
.zsbuf
)
85 if (rb_pipe
->draw_rule
.surf
)
86 for (k
= 0; k
< rb_pipe
->curr
.nr_cbufs
; k
++)
87 if (rb_pipe
->draw_rule
.surf
== rb_pipe
->curr
.cbufs
[k
])
89 if (rb_pipe
->draw_rule
.texture
) {
90 for (sh
= 0; sh
< ARRAY_SIZE(rb_pipe
->curr
.num_views
); sh
++) {
91 for (k
= 0; k
< rb_pipe
->curr
.num_views
[sh
]; k
++) {
92 if (rb_pipe
->draw_rule
.texture
== rb_pipe
->curr
.texs
[sh
][k
]) {
94 sh
= PIPE_SHADER_TYPES
; /* to break out of both loops */
102 rb_pipe
->draw_blocked
|= (flag
| RBUG_BLOCK_RULE
);
105 if (rb_pipe
->draw_blocked
)
106 rbug_notify_draw_blocked(rb_pipe
);
108 /* wait for rbug to clear the blocked flag */
109 while (rb_pipe
->draw_blocked
& flag
) {
110 rb_pipe
->draw_blocked
|= flag
;
111 cnd_wait(&rb_pipe
->draw_cond
, &rb_pipe
->draw_mutex
);
117 rbug_draw_vbo(struct pipe_context
*_pipe
, const struct pipe_draw_info
*_info
)
119 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
120 struct pipe_context
*pipe
= rb_pipe
->pipe
;
121 struct pipe_draw_info info
;
124 if(_info
->index_size
&& !_info
->has_user_indices
)
125 info
.index
.resource
= rbug_resource_unwrap(_info
->index
.resource
);
127 mtx_lock(&rb_pipe
->draw_mutex
);
128 rbug_draw_block_locked(rb_pipe
, RBUG_BLOCK_BEFORE
);
130 mtx_lock(&rb_pipe
->call_mutex
);
131 /* XXX loop over PIPE_SHADER_x here */
132 if (!(rb_pipe
->curr
.shader
[PIPE_SHADER_FRAGMENT
] && rb_pipe
->curr
.shader
[PIPE_SHADER_FRAGMENT
]->disabled
) &&
133 !(rb_pipe
->curr
.shader
[PIPE_SHADER_GEOMETRY
] && rb_pipe
->curr
.shader
[PIPE_SHADER_GEOMETRY
]->disabled
) &&
134 !(rb_pipe
->curr
.shader
[PIPE_SHADER_VERTEX
] && rb_pipe
->curr
.shader
[PIPE_SHADER_VERTEX
]->disabled
))
135 pipe
->draw_vbo(pipe
, &info
);
136 mtx_unlock(&rb_pipe
->call_mutex
);
138 rbug_draw_block_locked(rb_pipe
, RBUG_BLOCK_AFTER
);
139 mtx_unlock(&rb_pipe
->draw_mutex
);
142 static struct pipe_query
*
143 rbug_create_query(struct pipe_context
*_pipe
,
147 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
148 struct pipe_context
*pipe
= rb_pipe
->pipe
;
149 struct pipe_query
*query
;
151 mtx_lock(&rb_pipe
->call_mutex
);
152 query
= pipe
->create_query(pipe
,
155 mtx_unlock(&rb_pipe
->call_mutex
);
160 rbug_destroy_query(struct pipe_context
*_pipe
,
161 struct pipe_query
*query
)
163 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
164 struct pipe_context
*pipe
= rb_pipe
->pipe
;
166 mtx_lock(&rb_pipe
->call_mutex
);
167 pipe
->destroy_query(pipe
,
169 mtx_unlock(&rb_pipe
->call_mutex
);
173 rbug_begin_query(struct pipe_context
*_pipe
,
174 struct pipe_query
*query
)
176 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
177 struct pipe_context
*pipe
= rb_pipe
->pipe
;
180 mtx_lock(&rb_pipe
->call_mutex
);
181 ret
= pipe
->begin_query(pipe
, query
);
182 mtx_unlock(&rb_pipe
->call_mutex
);
187 rbug_end_query(struct pipe_context
*_pipe
,
188 struct pipe_query
*query
)
190 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
191 struct pipe_context
*pipe
= rb_pipe
->pipe
;
194 mtx_lock(&rb_pipe
->call_mutex
);
195 ret
= pipe
->end_query(pipe
,
197 mtx_unlock(&rb_pipe
->call_mutex
);
203 rbug_get_query_result(struct pipe_context
*_pipe
,
204 struct pipe_query
*query
,
206 union pipe_query_result
*result
)
208 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
209 struct pipe_context
*pipe
= rb_pipe
->pipe
;
212 mtx_lock(&rb_pipe
->call_mutex
);
213 ret
= pipe
->get_query_result(pipe
,
217 mtx_unlock(&rb_pipe
->call_mutex
);
223 rbug_set_active_query_state(struct pipe_context
*_pipe
, bool enable
)
225 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
226 struct pipe_context
*pipe
= rb_pipe
->pipe
;
228 mtx_lock(&rb_pipe
->call_mutex
);
229 pipe
->set_active_query_state(pipe
, enable
);
230 mtx_unlock(&rb_pipe
->call_mutex
);
234 rbug_create_blend_state(struct pipe_context
*_pipe
,
235 const struct pipe_blend_state
*blend
)
237 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
238 struct pipe_context
*pipe
= rb_pipe
->pipe
;
241 mtx_lock(&rb_pipe
->call_mutex
);
242 ret
= pipe
->create_blend_state(pipe
,
244 mtx_unlock(&rb_pipe
->call_mutex
);
250 rbug_bind_blend_state(struct pipe_context
*_pipe
,
253 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
254 struct pipe_context
*pipe
= rb_pipe
->pipe
;
256 mtx_lock(&rb_pipe
->call_mutex
);
257 pipe
->bind_blend_state(pipe
,
259 mtx_unlock(&rb_pipe
->call_mutex
);
263 rbug_delete_blend_state(struct pipe_context
*_pipe
,
266 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
267 struct pipe_context
*pipe
= rb_pipe
->pipe
;
269 mtx_lock(&rb_pipe
->call_mutex
);
270 pipe
->delete_blend_state(pipe
,
272 mtx_unlock(&rb_pipe
->call_mutex
);
276 rbug_create_sampler_state(struct pipe_context
*_pipe
,
277 const struct pipe_sampler_state
*sampler
)
279 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
280 struct pipe_context
*pipe
= rb_pipe
->pipe
;
283 mtx_lock(&rb_pipe
->call_mutex
);
284 ret
= pipe
->create_sampler_state(pipe
,
286 mtx_unlock(&rb_pipe
->call_mutex
);
292 rbug_bind_sampler_states(struct pipe_context
*_pipe
,
293 enum pipe_shader_type shader
,
294 unsigned start
, unsigned count
,
297 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
298 struct pipe_context
*pipe
= rb_pipe
->pipe
;
300 mtx_lock(&rb_pipe
->call_mutex
);
301 pipe
->bind_sampler_states(pipe
, shader
, start
, count
, samplers
);
302 mtx_unlock(&rb_pipe
->call_mutex
);
306 rbug_delete_sampler_state(struct pipe_context
*_pipe
,
309 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
310 struct pipe_context
*pipe
= rb_pipe
->pipe
;
312 mtx_lock(&rb_pipe
->call_mutex
);
313 pipe
->delete_sampler_state(pipe
,
315 mtx_unlock(&rb_pipe
->call_mutex
);
319 rbug_create_rasterizer_state(struct pipe_context
*_pipe
,
320 const struct pipe_rasterizer_state
*rasterizer
)
322 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
323 struct pipe_context
*pipe
= rb_pipe
->pipe
;
326 mtx_lock(&rb_pipe
->call_mutex
);
327 ret
= pipe
->create_rasterizer_state(pipe
,
329 mtx_unlock(&rb_pipe
->call_mutex
);
335 rbug_bind_rasterizer_state(struct pipe_context
*_pipe
,
338 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
339 struct pipe_context
*pipe
= rb_pipe
->pipe
;
341 mtx_lock(&rb_pipe
->call_mutex
);
342 pipe
->bind_rasterizer_state(pipe
,
344 mtx_unlock(&rb_pipe
->call_mutex
);
348 rbug_delete_rasterizer_state(struct pipe_context
*_pipe
,
351 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
352 struct pipe_context
*pipe
= rb_pipe
->pipe
;
354 mtx_lock(&rb_pipe
->call_mutex
);
355 pipe
->delete_rasterizer_state(pipe
,
357 mtx_unlock(&rb_pipe
->call_mutex
);
361 rbug_create_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
362 const struct pipe_depth_stencil_alpha_state
*depth_stencil_alpha
)
364 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
365 struct pipe_context
*pipe
= rb_pipe
->pipe
;
368 mtx_lock(&rb_pipe
->call_mutex
);
369 ret
= pipe
->create_depth_stencil_alpha_state(pipe
,
370 depth_stencil_alpha
);
371 mtx_unlock(&rb_pipe
->call_mutex
);
377 rbug_bind_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
378 void *depth_stencil_alpha
)
380 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
381 struct pipe_context
*pipe
= rb_pipe
->pipe
;
383 mtx_lock(&rb_pipe
->call_mutex
);
384 pipe
->bind_depth_stencil_alpha_state(pipe
,
385 depth_stencil_alpha
);
386 mtx_unlock(&rb_pipe
->call_mutex
);
390 rbug_delete_depth_stencil_alpha_state(struct pipe_context
*_pipe
,
391 void *depth_stencil_alpha
)
393 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
394 struct pipe_context
*pipe
= rb_pipe
->pipe
;
396 mtx_lock(&rb_pipe
->call_mutex
);
397 pipe
->delete_depth_stencil_alpha_state(pipe
,
398 depth_stencil_alpha
);
399 mtx_unlock(&rb_pipe
->call_mutex
);
403 rbug_create_fs_state(struct pipe_context
*_pipe
,
404 const struct pipe_shader_state
*state
)
406 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
407 struct pipe_context
*pipe
= rb_pipe
->pipe
;
410 mtx_lock(&rb_pipe
->call_mutex
);
411 result
= pipe
->create_fs_state(pipe
, state
);
412 mtx_unlock(&rb_pipe
->call_mutex
);
417 return rbug_shader_create(rb_pipe
, state
, result
, RBUG_SHADER_FRAGMENT
);
421 rbug_bind_fs_state(struct pipe_context
*_pipe
,
424 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
425 struct pipe_context
*pipe
= rb_pipe
->pipe
;
428 mtx_lock(&rb_pipe
->call_mutex
);
430 fs
= rbug_shader_unwrap(_fs
);
431 rb_pipe
->curr
.shader
[PIPE_SHADER_FRAGMENT
] = rbug_shader(_fs
);
432 pipe
->bind_fs_state(pipe
,
435 mtx_unlock(&rb_pipe
->call_mutex
);
439 rbug_delete_fs_state(struct pipe_context
*_pipe
,
442 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
443 struct rbug_shader
*rb_shader
= rbug_shader(_fs
);
445 mtx_lock(&rb_pipe
->call_mutex
);
446 rbug_shader_destroy(rb_pipe
, rb_shader
);
447 mtx_unlock(&rb_pipe
->call_mutex
);
451 rbug_create_vs_state(struct pipe_context
*_pipe
,
452 const struct pipe_shader_state
*state
)
454 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
455 struct pipe_context
*pipe
= rb_pipe
->pipe
;
458 mtx_lock(&rb_pipe
->call_mutex
);
459 result
= pipe
->create_vs_state(pipe
, state
);
460 mtx_unlock(&rb_pipe
->call_mutex
);
465 return rbug_shader_create(rb_pipe
, state
, result
, RBUG_SHADER_VERTEX
);
469 rbug_bind_vs_state(struct pipe_context
*_pipe
,
472 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
473 struct pipe_context
*pipe
= rb_pipe
->pipe
;
476 mtx_lock(&rb_pipe
->call_mutex
);
478 vs
= rbug_shader_unwrap(_vs
);
479 rb_pipe
->curr
.shader
[PIPE_SHADER_VERTEX
] = rbug_shader(_vs
);
480 pipe
->bind_vs_state(pipe
,
483 mtx_unlock(&rb_pipe
->call_mutex
);
487 rbug_delete_vs_state(struct pipe_context
*_pipe
,
490 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
491 struct rbug_shader
*rb_shader
= rbug_shader(_vs
);
493 mtx_unlock(&rb_pipe
->call_mutex
);
494 rbug_shader_destroy(rb_pipe
, rb_shader
);
495 mtx_unlock(&rb_pipe
->call_mutex
);
499 rbug_create_gs_state(struct pipe_context
*_pipe
,
500 const struct pipe_shader_state
*state
)
502 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
503 struct pipe_context
*pipe
= rb_pipe
->pipe
;
506 mtx_lock(&rb_pipe
->call_mutex
);
507 result
= pipe
->create_gs_state(pipe
, state
);
508 mtx_unlock(&rb_pipe
->call_mutex
);
513 return rbug_shader_create(rb_pipe
, state
, result
, RBUG_SHADER_GEOM
);
517 rbug_bind_gs_state(struct pipe_context
*_pipe
,
520 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
521 struct pipe_context
*pipe
= rb_pipe
->pipe
;
524 mtx_lock(&rb_pipe
->call_mutex
);
526 gs
= rbug_shader_unwrap(_gs
);
527 rb_pipe
->curr
.shader
[PIPE_SHADER_GEOMETRY
] = rbug_shader(_gs
);
528 pipe
->bind_gs_state(pipe
,
531 mtx_unlock(&rb_pipe
->call_mutex
);
535 rbug_delete_gs_state(struct pipe_context
*_pipe
,
538 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
539 struct rbug_shader
*rb_shader
= rbug_shader(_gs
);
541 mtx_lock(&rb_pipe
->call_mutex
);
542 rbug_shader_destroy(rb_pipe
, rb_shader
);
543 mtx_unlock(&rb_pipe
->call_mutex
);
547 rbug_create_vertex_elements_state(struct pipe_context
*_pipe
,
548 unsigned num_elements
,
549 const struct pipe_vertex_element
*vertex_elements
)
551 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
552 struct pipe_context
*pipe
= rb_pipe
->pipe
;
555 mtx_lock(&rb_pipe
->call_mutex
);
556 ret
= pipe
->create_vertex_elements_state(pipe
,
559 mtx_unlock(&rb_pipe
->call_mutex
);
565 rbug_bind_vertex_elements_state(struct pipe_context
*_pipe
,
568 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
569 struct pipe_context
*pipe
= rb_pipe
->pipe
;
571 mtx_lock(&rb_pipe
->call_mutex
);
572 pipe
->bind_vertex_elements_state(pipe
,
574 mtx_unlock(&rb_pipe
->call_mutex
);
578 rbug_delete_vertex_elements_state(struct pipe_context
*_pipe
,
581 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
582 struct pipe_context
*pipe
= rb_pipe
->pipe
;
584 mtx_lock(&rb_pipe
->call_mutex
);
585 pipe
->delete_vertex_elements_state(pipe
,
587 mtx_unlock(&rb_pipe
->call_mutex
);
591 rbug_set_blend_color(struct pipe_context
*_pipe
,
592 const struct pipe_blend_color
*blend_color
)
594 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
595 struct pipe_context
*pipe
= rb_pipe
->pipe
;
597 mtx_lock(&rb_pipe
->call_mutex
);
598 pipe
->set_blend_color(pipe
,
600 mtx_unlock(&rb_pipe
->call_mutex
);
604 rbug_set_stencil_ref(struct pipe_context
*_pipe
,
605 const struct pipe_stencil_ref
*stencil_ref
)
607 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
608 struct pipe_context
*pipe
= rb_pipe
->pipe
;
610 mtx_lock(&rb_pipe
->call_mutex
);
611 pipe
->set_stencil_ref(pipe
,
613 mtx_unlock(&rb_pipe
->call_mutex
);
617 rbug_set_clip_state(struct pipe_context
*_pipe
,
618 const struct pipe_clip_state
*clip
)
620 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
621 struct pipe_context
*pipe
= rb_pipe
->pipe
;
623 mtx_lock(&rb_pipe
->call_mutex
);
624 pipe
->set_clip_state(pipe
,
626 mtx_unlock(&rb_pipe
->call_mutex
);
630 rbug_set_constant_buffer(struct pipe_context
*_pipe
,
631 enum pipe_shader_type shader
,
633 const struct pipe_constant_buffer
*_cb
)
635 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
636 struct pipe_context
*pipe
= rb_pipe
->pipe
;
637 struct pipe_constant_buffer cb
;
639 /* XXX hmm? unwrap the input state */
642 cb
.buffer
= rbug_resource_unwrap(_cb
->buffer
);
645 mtx_lock(&rb_pipe
->call_mutex
);
646 pipe
->set_constant_buffer(pipe
,
650 mtx_unlock(&rb_pipe
->call_mutex
);
654 rbug_set_framebuffer_state(struct pipe_context
*_pipe
,
655 const struct pipe_framebuffer_state
*_state
)
657 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
658 struct pipe_context
*pipe
= rb_pipe
->pipe
;
659 struct pipe_framebuffer_state unwrapped_state
;
660 struct pipe_framebuffer_state
*state
= NULL
;
663 /* must protect curr status */
664 mtx_lock(&rb_pipe
->call_mutex
);
666 rb_pipe
->curr
.nr_cbufs
= 0;
667 memset(rb_pipe
->curr
.cbufs
, 0, sizeof(rb_pipe
->curr
.cbufs
));
668 rb_pipe
->curr
.zsbuf
= NULL
;
670 /* unwrap the input state */
672 memcpy(&unwrapped_state
, _state
, sizeof(unwrapped_state
));
674 rb_pipe
->curr
.nr_cbufs
= _state
->nr_cbufs
;
675 for(i
= 0; i
< _state
->nr_cbufs
; i
++) {
676 unwrapped_state
.cbufs
[i
] = rbug_surface_unwrap(_state
->cbufs
[i
]);
677 if (_state
->cbufs
[i
])
678 rb_pipe
->curr
.cbufs
[i
] = rbug_resource(_state
->cbufs
[i
]->texture
);
680 unwrapped_state
.zsbuf
= rbug_surface_unwrap(_state
->zsbuf
);
682 rb_pipe
->curr
.zsbuf
= rbug_resource(_state
->zsbuf
->texture
);
683 state
= &unwrapped_state
;
686 pipe
->set_framebuffer_state(pipe
,
689 mtx_unlock(&rb_pipe
->call_mutex
);
693 rbug_set_polygon_stipple(struct pipe_context
*_pipe
,
694 const struct pipe_poly_stipple
*poly_stipple
)
696 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
697 struct pipe_context
*pipe
= rb_pipe
->pipe
;
699 mtx_lock(&rb_pipe
->call_mutex
);
700 pipe
->set_polygon_stipple(pipe
,
702 mtx_unlock(&rb_pipe
->call_mutex
);
706 rbug_set_scissor_states(struct pipe_context
*_pipe
,
708 unsigned num_scissors
,
709 const struct pipe_scissor_state
*scissor
)
711 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
712 struct pipe_context
*pipe
= rb_pipe
->pipe
;
714 mtx_lock(&rb_pipe
->call_mutex
);
715 pipe
->set_scissor_states(pipe
, start_slot
, num_scissors
, scissor
);
716 mtx_unlock(&rb_pipe
->call_mutex
);
720 rbug_set_viewport_states(struct pipe_context
*_pipe
,
722 unsigned num_viewports
,
723 const struct pipe_viewport_state
*viewport
)
725 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
726 struct pipe_context
*pipe
= rb_pipe
->pipe
;
728 mtx_lock(&rb_pipe
->call_mutex
);
729 pipe
->set_viewport_states(pipe
, start_slot
, num_viewports
, viewport
);
730 mtx_unlock(&rb_pipe
->call_mutex
);
734 rbug_set_sampler_views(struct pipe_context
*_pipe
,
735 enum pipe_shader_type shader
,
738 struct pipe_sampler_view
**_views
)
740 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
741 struct pipe_context
*pipe
= rb_pipe
->pipe
;
742 struct pipe_sampler_view
*unwrapped_views
[PIPE_MAX_SHADER_SAMPLER_VIEWS
];
743 struct pipe_sampler_view
**views
= NULL
;
746 assert(start
== 0); /* XXX fix */
748 /* must protect curr status */
749 mtx_lock(&rb_pipe
->call_mutex
);
751 rb_pipe
->curr
.num_views
[shader
] = 0;
752 memset(rb_pipe
->curr
.views
[shader
], 0, sizeof(rb_pipe
->curr
.views
[shader
]));
753 memset(rb_pipe
->curr
.texs
[shader
], 0, sizeof(rb_pipe
->curr
.texs
[shader
]));
754 memset(unwrapped_views
, 0, sizeof(unwrapped_views
));
757 rb_pipe
->curr
.num_views
[shader
] = num
;
758 for (i
= 0; i
< num
; i
++) {
759 rb_pipe
->curr
.views
[shader
][i
] = rbug_sampler_view(_views
[i
]);
760 rb_pipe
->curr
.texs
[shader
][i
] = rbug_resource(_views
[i
] ? _views
[i
]->texture
: NULL
);
761 unwrapped_views
[i
] = rbug_sampler_view_unwrap(_views
[i
]);
763 views
= unwrapped_views
;
766 pipe
->set_sampler_views(pipe
, shader
, start
, num
, views
);
768 mtx_unlock(&rb_pipe
->call_mutex
);
772 rbug_set_vertex_buffers(struct pipe_context
*_pipe
,
773 unsigned start_slot
, unsigned num_buffers
,
774 const struct pipe_vertex_buffer
*_buffers
)
776 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
777 struct pipe_context
*pipe
= rb_pipe
->pipe
;
778 struct pipe_vertex_buffer unwrapped_buffers
[PIPE_MAX_SHADER_INPUTS
];
779 struct pipe_vertex_buffer
*buffers
= NULL
;
782 mtx_lock(&rb_pipe
->call_mutex
);
784 if (num_buffers
&& _buffers
) {
785 memcpy(unwrapped_buffers
, _buffers
, num_buffers
* sizeof(*_buffers
));
786 for (i
= 0; i
< num_buffers
; i
++) {
787 if (!_buffers
[i
].is_user_buffer
)
788 unwrapped_buffers
[i
].buffer
.resource
=
789 rbug_resource_unwrap(_buffers
[i
].buffer
.resource
);
791 buffers
= unwrapped_buffers
;
794 pipe
->set_vertex_buffers(pipe
, start_slot
,
798 mtx_unlock(&rb_pipe
->call_mutex
);
802 rbug_set_sample_mask(struct pipe_context
*_pipe
,
803 unsigned sample_mask
)
805 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
806 struct pipe_context
*pipe
= rb_pipe
->pipe
;
808 mtx_lock(&rb_pipe
->call_mutex
);
809 pipe
->set_sample_mask(pipe
, sample_mask
);
810 mtx_unlock(&rb_pipe
->call_mutex
);
813 static struct pipe_stream_output_target
*
814 rbug_create_stream_output_target(struct pipe_context
*_pipe
,
815 struct pipe_resource
*_res
,
816 unsigned buffer_offset
, unsigned buffer_size
)
818 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
819 struct pipe_context
*pipe
= rb_pipe
->pipe
;
820 struct pipe_resource
*res
= rbug_resource_unwrap(_res
);
821 struct pipe_stream_output_target
*target
;
823 mtx_lock(&rb_pipe
->call_mutex
);
824 target
= pipe
->create_stream_output_target(pipe
, res
, buffer_offset
,
826 mtx_unlock(&rb_pipe
->call_mutex
);
831 rbug_stream_output_target_destroy(struct pipe_context
*_pipe
,
832 struct pipe_stream_output_target
*target
)
834 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
835 struct pipe_context
*pipe
= rb_pipe
->pipe
;
837 mtx_lock(&rb_pipe
->call_mutex
);
838 pipe
->stream_output_target_destroy(pipe
, target
);
839 mtx_unlock(&rb_pipe
->call_mutex
);
843 rbug_set_stream_output_targets(struct pipe_context
*_pipe
,
844 unsigned num_targets
,
845 struct pipe_stream_output_target
**targets
,
846 const unsigned *offsets
)
848 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
849 struct pipe_context
*pipe
= rb_pipe
->pipe
;
851 mtx_lock(&rb_pipe
->call_mutex
);
852 pipe
->set_stream_output_targets(pipe
, num_targets
, targets
, offsets
);
853 mtx_unlock(&rb_pipe
->call_mutex
);
857 rbug_resource_copy_region(struct pipe_context
*_pipe
,
858 struct pipe_resource
*_dst
,
863 struct pipe_resource
*_src
,
865 const struct pipe_box
*src_box
)
867 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
868 struct rbug_resource
*rb_resource_dst
= rbug_resource(_dst
);
869 struct rbug_resource
*rb_resource_src
= rbug_resource(_src
);
870 struct pipe_context
*pipe
= rb_pipe
->pipe
;
871 struct pipe_resource
*dst
= rb_resource_dst
->resource
;
872 struct pipe_resource
*src
= rb_resource_src
->resource
;
874 mtx_lock(&rb_pipe
->call_mutex
);
875 pipe
->resource_copy_region(pipe
,
884 mtx_unlock(&rb_pipe
->call_mutex
);
888 rbug_blit(struct pipe_context
*_pipe
, const struct pipe_blit_info
*_blit_info
)
890 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
891 struct rbug_resource
*rb_resource_dst
= rbug_resource(_blit_info
->dst
.resource
);
892 struct rbug_resource
*rb_resource_src
= rbug_resource(_blit_info
->src
.resource
);
893 struct pipe_context
*pipe
= rb_pipe
->pipe
;
894 struct pipe_resource
*dst
= rb_resource_dst
->resource
;
895 struct pipe_resource
*src
= rb_resource_src
->resource
;
896 struct pipe_blit_info blit_info
;
898 blit_info
= *_blit_info
;
899 blit_info
.dst
.resource
= dst
;
900 blit_info
.src
.resource
= src
;
902 mtx_lock(&rb_pipe
->call_mutex
);
903 pipe
->blit(pipe
, &blit_info
);
904 mtx_unlock(&rb_pipe
->call_mutex
);
908 rbug_flush_resource(struct pipe_context
*_pipe
,
909 struct pipe_resource
*_res
)
911 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
912 struct rbug_resource
*rb_resource_res
= rbug_resource(_res
);
913 struct pipe_context
*pipe
= rb_pipe
->pipe
;
914 struct pipe_resource
*res
= rb_resource_res
->resource
;
916 mtx_lock(&rb_pipe
->call_mutex
);
917 pipe
->flush_resource(pipe
, res
);
918 mtx_unlock(&rb_pipe
->call_mutex
);
922 rbug_clear(struct pipe_context
*_pipe
,
924 const struct pipe_scissor_state
*scissor_state
,
925 const union pipe_color_union
*color
,
929 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
930 struct pipe_context
*pipe
= rb_pipe
->pipe
;
932 mtx_lock(&rb_pipe
->call_mutex
);
939 mtx_unlock(&rb_pipe
->call_mutex
);
943 rbug_clear_render_target(struct pipe_context
*_pipe
,
944 struct pipe_surface
*_dst
,
945 const union pipe_color_union
*color
,
946 unsigned dstx
, unsigned dsty
,
947 unsigned width
, unsigned height
,
948 bool render_condition_enabled
)
950 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
951 struct rbug_surface
*rb_surface_dst
= rbug_surface(_dst
);
952 struct pipe_context
*pipe
= rb_pipe
->pipe
;
953 struct pipe_surface
*dst
= rb_surface_dst
->surface
;
955 mtx_lock(&rb_pipe
->call_mutex
);
956 pipe
->clear_render_target(pipe
,
963 render_condition_enabled
);
964 mtx_unlock(&rb_pipe
->call_mutex
);
968 rbug_clear_depth_stencil(struct pipe_context
*_pipe
,
969 struct pipe_surface
*_dst
,
970 unsigned clear_flags
,
973 unsigned dstx
, unsigned dsty
,
974 unsigned width
, unsigned height
,
975 bool render_condition_enabled
)
977 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
978 struct rbug_surface
*rb_surface_dst
= rbug_surface(_dst
);
979 struct pipe_context
*pipe
= rb_pipe
->pipe
;
980 struct pipe_surface
*dst
= rb_surface_dst
->surface
;
982 mtx_lock(&rb_pipe
->call_mutex
);
983 pipe
->clear_depth_stencil(pipe
,
992 render_condition_enabled
);
993 mtx_unlock(&rb_pipe
->call_mutex
);
997 rbug_flush(struct pipe_context
*_pipe
,
998 struct pipe_fence_handle
**fence
,
1001 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
1002 struct pipe_context
*pipe
= rb_pipe
->pipe
;
1004 mtx_lock(&rb_pipe
->call_mutex
);
1005 pipe
->flush(pipe
, fence
, flags
);
1006 mtx_unlock(&rb_pipe
->call_mutex
);
1010 rbug_create_fence_fd(struct pipe_context
*_pipe
,
1011 struct pipe_fence_handle
**fence
, int fd
,
1012 enum pipe_fd_type type
)
1014 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
1015 struct pipe_context
*pipe
= rb_pipe
->pipe
;
1017 mtx_lock(&rb_pipe
->call_mutex
);
1018 pipe
->create_fence_fd(pipe
, fence
, fd
, type
);
1019 mtx_unlock(&rb_pipe
->call_mutex
);
1023 rbug_fence_server_sync(struct pipe_context
*_pipe
,
1024 struct pipe_fence_handle
*fence
)
1026 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
1027 struct pipe_context
*pipe
= rb_pipe
->pipe
;
1029 mtx_lock(&rb_pipe
->call_mutex
);
1030 pipe
->fence_server_sync(pipe
, fence
);
1031 mtx_unlock(&rb_pipe
->call_mutex
);
1034 static struct pipe_sampler_view
*
1035 rbug_context_create_sampler_view(struct pipe_context
*_pipe
,
1036 struct pipe_resource
*_resource
,
1037 const struct pipe_sampler_view
*templ
)
1039 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
1040 struct rbug_resource
*rb_resource
= rbug_resource(_resource
);
1041 struct pipe_context
*pipe
= rb_pipe
->pipe
;
1042 struct pipe_resource
*resource
= rb_resource
->resource
;
1043 struct pipe_sampler_view
*result
;
1045 mtx_lock(&rb_pipe
->call_mutex
);
1046 result
= pipe
->create_sampler_view(pipe
,
1049 mtx_unlock(&rb_pipe
->call_mutex
);
1052 return rbug_sampler_view_create(rb_pipe
, rb_resource
, result
);
1057 rbug_context_sampler_view_destroy(struct pipe_context
*_pipe
,
1058 struct pipe_sampler_view
*_view
)
1060 rbug_sampler_view_destroy(rbug_context(_pipe
),
1061 rbug_sampler_view(_view
));
1064 static struct pipe_surface
*
1065 rbug_context_create_surface(struct pipe_context
*_pipe
,
1066 struct pipe_resource
*_resource
,
1067 const struct pipe_surface
*surf_tmpl
)
1069 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
1070 struct rbug_resource
*rb_resource
= rbug_resource(_resource
);
1071 struct pipe_context
*pipe
= rb_pipe
->pipe
;
1072 struct pipe_resource
*resource
= rb_resource
->resource
;
1073 struct pipe_surface
*result
;
1075 mtx_lock(&rb_pipe
->call_mutex
);
1076 result
= pipe
->create_surface(pipe
,
1079 mtx_unlock(&rb_pipe
->call_mutex
);
1082 return rbug_surface_create(rb_pipe
, rb_resource
, result
);
1087 rbug_context_surface_destroy(struct pipe_context
*_pipe
,
1088 struct pipe_surface
*_surface
)
1090 struct rbug_context
*rb_pipe
= rbug_context(_pipe
);
1091 struct rbug_surface
*rb_surface
= rbug_surface(_surface
);
1093 mtx_lock(&rb_pipe
->call_mutex
);
1094 rbug_surface_destroy(rb_pipe
,
1096 mtx_unlock(&rb_pipe
->call_mutex
);
1102 rbug_context_transfer_map(struct pipe_context
*_context
,
1103 struct pipe_resource
*_resource
,
1106 const struct pipe_box
*box
,
1107 struct pipe_transfer
**transfer
)
1109 struct rbug_context
*rb_pipe
= rbug_context(_context
);
1110 struct rbug_resource
*rb_resource
= rbug_resource(_resource
);
1111 struct pipe_context
*context
= rb_pipe
->pipe
;
1112 struct pipe_resource
*resource
= rb_resource
->resource
;
1113 struct pipe_transfer
*result
;
1116 mtx_lock(&rb_pipe
->call_mutex
);
1117 map
= context
->transfer_map(context
,
1122 mtx_unlock(&rb_pipe
->call_mutex
);
1124 *transfer
= rbug_transfer_create(rb_pipe
, rb_resource
, result
);
1125 return *transfer
? map
: NULL
;
1129 rbug_context_transfer_flush_region(struct pipe_context
*_context
,
1130 struct pipe_transfer
*_transfer
,
1131 const struct pipe_box
*box
)
1133 struct rbug_context
*rb_pipe
= rbug_context(_context
);
1134 struct rbug_transfer
*rb_transfer
= rbug_transfer(_transfer
);
1135 struct pipe_context
*context
= rb_pipe
->pipe
;
1136 struct pipe_transfer
*transfer
= rb_transfer
->transfer
;
1138 mtx_lock(&rb_pipe
->call_mutex
);
1139 context
->transfer_flush_region(context
,
1142 mtx_unlock(&rb_pipe
->call_mutex
);
1147 rbug_context_transfer_unmap(struct pipe_context
*_context
,
1148 struct pipe_transfer
*_transfer
)
1150 struct rbug_context
*rb_pipe
= rbug_context(_context
);
1151 struct rbug_transfer
*rb_transfer
= rbug_transfer(_transfer
);
1152 struct pipe_context
*context
= rb_pipe
->pipe
;
1153 struct pipe_transfer
*transfer
= rb_transfer
->transfer
;
1155 mtx_lock(&rb_pipe
->call_mutex
);
1156 context
->transfer_unmap(context
,
1158 rbug_transfer_destroy(rb_pipe
,
1160 mtx_unlock(&rb_pipe
->call_mutex
);
1165 rbug_context_buffer_subdata(struct pipe_context
*_context
,
1166 struct pipe_resource
*_resource
,
1167 unsigned usage
, unsigned offset
,
1168 unsigned size
, const void *data
)
1170 struct rbug_context
*rb_pipe
= rbug_context(_context
);
1171 struct rbug_resource
*rb_resource
= rbug_resource(_resource
);
1172 struct pipe_context
*context
= rb_pipe
->pipe
;
1173 struct pipe_resource
*resource
= rb_resource
->resource
;
1175 mtx_lock(&rb_pipe
->call_mutex
);
1176 context
->buffer_subdata(context
, resource
, usage
, offset
, size
, data
);
1177 mtx_unlock(&rb_pipe
->call_mutex
);
1182 rbug_context_texture_subdata(struct pipe_context
*_context
,
1183 struct pipe_resource
*_resource
,
1186 const struct pipe_box
*box
,
1189 unsigned layer_stride
)
1191 struct rbug_context
*rb_pipe
= rbug_context(_context
);
1192 struct rbug_resource
*rb_resource
= rbug_resource(_resource
);
1193 struct pipe_context
*context
= rb_pipe
->pipe
;
1194 struct pipe_resource
*resource
= rb_resource
->resource
;
1196 mtx_lock(&rb_pipe
->call_mutex
);
1197 context
->texture_subdata(context
,
1205 mtx_unlock(&rb_pipe
->call_mutex
);
1209 rbug_context_texture_barrier(struct pipe_context
*_context
, unsigned flags
)
1211 struct rbug_context
*rb_pipe
= rbug_context(_context
);
1212 struct pipe_context
*context
= rb_pipe
->pipe
;
1214 mtx_lock(&rb_pipe
->call_mutex
);
1215 context
->texture_barrier(context
,
1217 mtx_unlock(&rb_pipe
->call_mutex
);
1220 struct pipe_context
*
1221 rbug_context_create(struct pipe_screen
*_screen
, struct pipe_context
*pipe
)
1223 struct rbug_context
*rb_pipe
;
1224 struct rbug_screen
*rb_screen
= rbug_screen(_screen
);
1229 rb_pipe
= CALLOC_STRUCT(rbug_context
);
1233 (void) mtx_init(&rb_pipe
->draw_mutex
, mtx_plain
);
1234 cnd_init(&rb_pipe
->draw_cond
);
1235 (void) mtx_init(&rb_pipe
->call_mutex
, mtx_plain
);
1236 (void) mtx_init(&rb_pipe
->list_mutex
, mtx_plain
);
1237 make_empty_list(&rb_pipe
->shaders
);
1239 rb_pipe
->base
.screen
= _screen
;
1240 rb_pipe
->base
.priv
= pipe
->priv
; /* expose wrapped data */
1241 rb_pipe
->base
.draw
= NULL
;
1242 rb_pipe
->base
.stream_uploader
= pipe
->stream_uploader
;
1243 rb_pipe
->base
.const_uploader
= pipe
->const_uploader
;
1245 rb_pipe
->base
.destroy
= rbug_destroy
;
1246 rb_pipe
->base
.draw_vbo
= rbug_draw_vbo
;
1247 rb_pipe
->base
.create_query
= rbug_create_query
;
1248 rb_pipe
->base
.destroy_query
= rbug_destroy_query
;
1249 rb_pipe
->base
.begin_query
= rbug_begin_query
;
1250 rb_pipe
->base
.end_query
= rbug_end_query
;
1251 rb_pipe
->base
.get_query_result
= rbug_get_query_result
;
1252 rb_pipe
->base
.set_active_query_state
= rbug_set_active_query_state
;
1253 rb_pipe
->base
.create_blend_state
= rbug_create_blend_state
;
1254 rb_pipe
->base
.bind_blend_state
= rbug_bind_blend_state
;
1255 rb_pipe
->base
.delete_blend_state
= rbug_delete_blend_state
;
1256 rb_pipe
->base
.create_sampler_state
= rbug_create_sampler_state
;
1257 rb_pipe
->base
.bind_sampler_states
= rbug_bind_sampler_states
;
1258 rb_pipe
->base
.delete_sampler_state
= rbug_delete_sampler_state
;
1259 rb_pipe
->base
.create_rasterizer_state
= rbug_create_rasterizer_state
;
1260 rb_pipe
->base
.bind_rasterizer_state
= rbug_bind_rasterizer_state
;
1261 rb_pipe
->base
.delete_rasterizer_state
= rbug_delete_rasterizer_state
;
1262 rb_pipe
->base
.create_depth_stencil_alpha_state
= rbug_create_depth_stencil_alpha_state
;
1263 rb_pipe
->base
.bind_depth_stencil_alpha_state
= rbug_bind_depth_stencil_alpha_state
;
1264 rb_pipe
->base
.delete_depth_stencil_alpha_state
= rbug_delete_depth_stencil_alpha_state
;
1265 rb_pipe
->base
.create_fs_state
= rbug_create_fs_state
;
1266 rb_pipe
->base
.bind_fs_state
= rbug_bind_fs_state
;
1267 rb_pipe
->base
.delete_fs_state
= rbug_delete_fs_state
;
1268 rb_pipe
->base
.create_vs_state
= rbug_create_vs_state
;
1269 rb_pipe
->base
.bind_vs_state
= rbug_bind_vs_state
;
1270 rb_pipe
->base
.delete_vs_state
= rbug_delete_vs_state
;
1271 rb_pipe
->base
.create_gs_state
= rbug_create_gs_state
;
1272 rb_pipe
->base
.bind_gs_state
= rbug_bind_gs_state
;
1273 rb_pipe
->base
.delete_gs_state
= rbug_delete_gs_state
;
1274 rb_pipe
->base
.create_vertex_elements_state
= rbug_create_vertex_elements_state
;
1275 rb_pipe
->base
.bind_vertex_elements_state
= rbug_bind_vertex_elements_state
;
1276 rb_pipe
->base
.delete_vertex_elements_state
= rbug_delete_vertex_elements_state
;
1277 rb_pipe
->base
.set_blend_color
= rbug_set_blend_color
;
1278 rb_pipe
->base
.set_stencil_ref
= rbug_set_stencil_ref
;
1279 rb_pipe
->base
.set_clip_state
= rbug_set_clip_state
;
1280 rb_pipe
->base
.set_constant_buffer
= rbug_set_constant_buffer
;
1281 rb_pipe
->base
.set_framebuffer_state
= rbug_set_framebuffer_state
;
1282 rb_pipe
->base
.set_polygon_stipple
= rbug_set_polygon_stipple
;
1283 rb_pipe
->base
.set_scissor_states
= rbug_set_scissor_states
;
1284 rb_pipe
->base
.set_viewport_states
= rbug_set_viewport_states
;
1285 rb_pipe
->base
.set_sampler_views
= rbug_set_sampler_views
;
1286 rb_pipe
->base
.set_vertex_buffers
= rbug_set_vertex_buffers
;
1287 rb_pipe
->base
.set_sample_mask
= rbug_set_sample_mask
;
1288 rb_pipe
->base
.create_stream_output_target
= rbug_create_stream_output_target
;
1289 rb_pipe
->base
.stream_output_target_destroy
= rbug_stream_output_target_destroy
;
1290 rb_pipe
->base
.set_stream_output_targets
= rbug_set_stream_output_targets
;
1291 rb_pipe
->base
.resource_copy_region
= rbug_resource_copy_region
;
1292 rb_pipe
->base
.blit
= rbug_blit
;
1293 rb_pipe
->base
.clear
= rbug_clear
;
1294 rb_pipe
->base
.clear_render_target
= rbug_clear_render_target
;
1295 rb_pipe
->base
.clear_depth_stencil
= rbug_clear_depth_stencil
;
1296 rb_pipe
->base
.flush
= rbug_flush
;
1297 rb_pipe
->base
.create_fence_fd
= rbug_create_fence_fd
;
1298 rb_pipe
->base
.fence_server_sync
= rbug_fence_server_sync
;
1299 rb_pipe
->base
.create_sampler_view
= rbug_context_create_sampler_view
;
1300 rb_pipe
->base
.sampler_view_destroy
= rbug_context_sampler_view_destroy
;
1301 rb_pipe
->base
.create_surface
= rbug_context_create_surface
;
1302 rb_pipe
->base
.surface_destroy
= rbug_context_surface_destroy
;
1303 rb_pipe
->base
.transfer_map
= rbug_context_transfer_map
;
1304 rb_pipe
->base
.transfer_unmap
= rbug_context_transfer_unmap
;
1305 rb_pipe
->base
.transfer_flush_region
= rbug_context_transfer_flush_region
;
1306 rb_pipe
->base
.buffer_subdata
= rbug_context_buffer_subdata
;
1307 rb_pipe
->base
.texture_subdata
= rbug_context_texture_subdata
;
1308 rb_pipe
->base
.texture_barrier
= rbug_context_texture_barrier
;
1309 rb_pipe
->base
.flush_resource
= rbug_flush_resource
;
1311 rb_pipe
->pipe
= pipe
;
1313 rbug_screen_add_to_list(rb_screen
, contexts
, rb_pipe
);
1315 if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", false)) {
1316 rb_pipe
->draw_blocked
= RBUG_BLOCK_BEFORE
;
1319 return &rb_pipe
->base
;