static struct pipe_resource * rbug_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, struct winsys_handle *handle) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *result; result = screen->resource_from_handle(screen, templ, handle); result = rbug_resource_create(rbug_screen(_screen), result); return result; }
static const char * rbug_screen_get_vendor(struct pipe_screen *_screen) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->get_vendor(screen); }
void rbug_resource_destroy(struct rbug_resource *rb_resource) { struct rbug_screen *rb_screen = rbug_screen(rb_resource->base.screen); rbug_screen_remove_from_list(rb_screen, resources, rb_resource); pipe_resource_reference(&rb_resource->resource, NULL); FREE(rb_resource); }
static boolean rbug_screen_fence_signalled(struct pipe_screen *_screen, struct pipe_fence_handle *fence) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->fence_signalled(screen, fence); }
static void rbug_screen_destroy(struct pipe_screen *_screen) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; screen->destroy(screen); FREE(rb_screen); }
static int rbug_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader, enum pipe_shader_cap param) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->get_shader_param(screen, shader, param); }
static float rbug_screen_get_paramf(struct pipe_screen *_screen, enum pipe_capf param) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->get_paramf(screen, param); }
static int rbug_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, unsigned flags) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->fence_finish(screen, fence, flags); }
static boolean rbug_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *_resource, struct winsys_handle *handle) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct rbug_resource *rb_resource = rbug_resource(_resource); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *resource = rb_resource->resource; return screen->resource_get_handle(screen, resource, handle); }
static boolean rbug_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, uint64_t timeout) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->fence_finish(screen, fence, timeout); }
static void rbug_screen_fence_reference(struct pipe_screen *_screen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; screen->fence_reference(screen, ptr, fence); }
static struct pipe_context * rbug_screen_context_create(struct pipe_screen *_screen, void *priv) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; struct pipe_context *result; result = screen->context_create(screen, priv); if (result) return rbug_context_create(_screen, result); return NULL; }
static struct pipe_resource * rbug_screen_resource_create(struct pipe_screen *_screen, const struct pipe_resource *templat) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *result; result = screen->resource_create(screen, templat); if (result) return rbug_resource_create(rb_screen, result); return NULL; }
static void rbug_destroy(struct pipe_context *_pipe) { struct rbug_screen *rb_screen = rbug_screen(_pipe->screen); struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; rbug_screen_remove_from_list(rb_screen, contexts, rb_pipe); pipe_mutex_lock(rb_pipe->call_mutex); pipe->destroy(pipe); rb_pipe->pipe = NULL; pipe_mutex_unlock(rb_pipe->call_mutex); FREE(rb_pipe); }
static boolean rbug_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, unsigned tex_usage) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->is_format_supported(screen, format, target, sample_count, tex_usage); }
static void rbug_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *_resource, unsigned level, unsigned layer, void *context_private, struct pipe_box *sub_box) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct rbug_resource *rb_resource = rbug_resource(_resource); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *resource = rb_resource->resource; screen->flush_frontbuffer(screen, resource, level, layer, context_private, sub_box); }
static struct pipe_resource * rbug_screen_user_buffer_create(struct pipe_screen *_screen, void *ptr, unsigned bytes, unsigned usage) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *result; result = screen->user_buffer_create(screen, ptr, bytes, usage); if (result) return rbug_resource_create(rb_screen, result); return NULL; }
struct pipe_context * rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) { struct rbug_context *rb_pipe; struct rbug_screen *rb_screen = rbug_screen(_screen); if (!rb_screen) return NULL; rb_pipe = CALLOC_STRUCT(rbug_context); if (!rb_pipe) return NULL; pipe_mutex_init(rb_pipe->draw_mutex); pipe_condvar_init(rb_pipe->draw_cond); pipe_mutex_init(rb_pipe->call_mutex); pipe_mutex_init(rb_pipe->list_mutex); make_empty_list(&rb_pipe->shaders); rb_pipe->base.screen = _screen; rb_pipe->base.priv = pipe->priv; /* expose wrapped data */ rb_pipe->base.draw = NULL; rb_pipe->base.destroy = rbug_destroy; rb_pipe->base.draw_vbo = rbug_draw_vbo; rb_pipe->base.create_query = rbug_create_query; rb_pipe->base.destroy_query = rbug_destroy_query; rb_pipe->base.begin_query = rbug_begin_query; rb_pipe->base.end_query = rbug_end_query; rb_pipe->base.get_query_result = rbug_get_query_result; rb_pipe->base.create_blend_state = rbug_create_blend_state; rb_pipe->base.bind_blend_state = rbug_bind_blend_state; rb_pipe->base.delete_blend_state = rbug_delete_blend_state; rb_pipe->base.create_sampler_state = rbug_create_sampler_state; rb_pipe->base.bind_fragment_sampler_states = rbug_bind_fragment_sampler_states; rb_pipe->base.bind_vertex_sampler_states = rbug_bind_vertex_sampler_states; rb_pipe->base.delete_sampler_state = rbug_delete_sampler_state; rb_pipe->base.create_rasterizer_state = rbug_create_rasterizer_state; rb_pipe->base.bind_rasterizer_state = rbug_bind_rasterizer_state; rb_pipe->base.delete_rasterizer_state = rbug_delete_rasterizer_state; rb_pipe->base.create_depth_stencil_alpha_state = rbug_create_depth_stencil_alpha_state; rb_pipe->base.bind_depth_stencil_alpha_state = rbug_bind_depth_stencil_alpha_state; rb_pipe->base.delete_depth_stencil_alpha_state = rbug_delete_depth_stencil_alpha_state; rb_pipe->base.create_fs_state = rbug_create_fs_state; rb_pipe->base.bind_fs_state = rbug_bind_fs_state; rb_pipe->base.delete_fs_state = rbug_delete_fs_state; rb_pipe->base.create_vs_state = rbug_create_vs_state; rb_pipe->base.bind_vs_state = rbug_bind_vs_state; rb_pipe->base.delete_vs_state = rbug_delete_vs_state; rb_pipe->base.create_gs_state = rbug_create_gs_state; rb_pipe->base.bind_gs_state = rbug_bind_gs_state; rb_pipe->base.delete_gs_state = rbug_delete_gs_state; rb_pipe->base.create_vertex_elements_state = rbug_create_vertex_elements_state; rb_pipe->base.bind_vertex_elements_state = rbug_bind_vertex_elements_state; rb_pipe->base.delete_vertex_elements_state = rbug_delete_vertex_elements_state; rb_pipe->base.set_blend_color = rbug_set_blend_color; rb_pipe->base.set_stencil_ref = rbug_set_stencil_ref; rb_pipe->base.set_clip_state = rbug_set_clip_state; rb_pipe->base.set_constant_buffer = rbug_set_constant_buffer; rb_pipe->base.set_framebuffer_state = rbug_set_framebuffer_state; rb_pipe->base.set_polygon_stipple = rbug_set_polygon_stipple; rb_pipe->base.set_scissor_states = rbug_set_scissor_states; rb_pipe->base.set_viewport_states = rbug_set_viewport_states; rb_pipe->base.set_fragment_sampler_views = rbug_set_fragment_sampler_views; rb_pipe->base.set_vertex_sampler_views = rbug_set_vertex_sampler_views; rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers; rb_pipe->base.set_index_buffer = rbug_set_index_buffer; rb_pipe->base.set_sample_mask = rbug_set_sample_mask; rb_pipe->base.resource_copy_region = rbug_resource_copy_region; rb_pipe->base.flush_resource = rbug_flush_resource; rb_pipe->base.clear = rbug_clear; rb_pipe->base.clear_render_target = rbug_clear_render_target; rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; rb_pipe->base.flush = rbug_flush; rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; rb_pipe->base.create_surface = rbug_context_create_surface; rb_pipe->base.surface_destroy = rbug_context_surface_destroy; rb_pipe->base.transfer_map = rbug_context_transfer_map; rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; rb_pipe->base.transfer_inline_write = rbug_context_transfer_inline_write; rb_pipe->pipe = pipe; rbug_screen_add_to_list(rb_screen, contexts, rb_pipe); if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", FALSE)) { rb_pipe->draw_blocked = RBUG_BLOCK_BEFORE; } return &rb_pipe->base; }