static void galahad_context_resource_copy_region(struct pipe_context *_pipe, struct pipe_resource *_dst, unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *_src, unsigned src_level, const struct pipe_box *src_box) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct galahad_resource *glhd_resource_dst = galahad_resource(_dst); struct galahad_resource *glhd_resource_src = galahad_resource(_src); struct pipe_context *pipe = glhd_pipe->pipe; struct pipe_resource *dst = glhd_resource_dst->resource; struct pipe_resource *src = glhd_resource_src->resource; if (_dst->format != _src->format) { const struct util_format_description *src_desc = util_format_description(_src->format); const struct util_format_description *dst_desc = util_format_description(_dst->format); if (!util_is_format_compatible(src_desc, dst_desc)) glhd_warn("Format mismatch: Source is %s, destination is %s", src_desc->short_name, dst_desc->short_name); } if ((_src->target == PIPE_BUFFER && _dst->target != PIPE_BUFFER) || (_src->target != PIPE_BUFFER && _dst->target == PIPE_BUFFER)) { glhd_warn("Resource target mismatch: Source is %i, destination is %i", _src->target, _dst->target); } pipe->resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, src, src_level, src_box); }
static void galahad_redefine_user_buffer(struct pipe_context *_context, struct pipe_resource *_resource, unsigned offset, unsigned size) { struct galahad_context *glhd_context = galahad_context(_context); struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_context *context = glhd_context->pipe; struct pipe_resource *resource = glhd_resource->resource; context->redefine_user_buffer(context, resource, offset, size); }
static boolean galahad_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *_resource, struct winsys_handle *handle) { struct galahad_screen *glhd_screen = galahad_screen(_screen); struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_screen *screen = glhd_screen->screen; struct pipe_resource *resource = glhd_resource->resource; /* TODO trace call */ return screen->resource_get_handle(screen, resource, handle); }
static void * galahad_context_transfer_map(struct pipe_context *_context, struct pipe_transfer *_transfer) { struct galahad_context *glhd_context = galahad_context(_context); struct galahad_transfer *glhd_transfer = galahad_transfer(_transfer); struct pipe_context *context = glhd_context->pipe; struct pipe_transfer *transfer = glhd_transfer->transfer; struct galahad_resource *glhd_resource = galahad_resource(_transfer->resource); glhd_resource->map_count++; return context->transfer_map(context, transfer); }
static void galahad_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *_resource, unsigned level, unsigned layer, void *context_private) { struct galahad_screen *glhd_screen = galahad_screen(_screen); struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_screen *screen = glhd_screen->screen; struct pipe_resource *resource = glhd_resource->resource; screen->flush_frontbuffer(screen, resource, level, layer, context_private); }
static struct pipe_surface * galahad_context_create_surface(struct pipe_context *_pipe, struct pipe_resource *_resource, const struct pipe_surface *templ) { struct galahad_context *glhd_context = galahad_context(_pipe); struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_context *pipe = glhd_context->pipe; struct pipe_resource *resource = glhd_resource->resource; struct pipe_surface *result; result = pipe->create_surface(pipe, resource, templ); if (result) return galahad_surface_create(glhd_context, glhd_resource, result); return NULL; }
static void galahad_context_transfer_unmap(struct pipe_context *_context, struct pipe_transfer *_transfer) { struct galahad_context *glhd_context = galahad_context(_context); struct galahad_transfer *glhd_transfer = galahad_transfer(_transfer); struct pipe_context *context = glhd_context->pipe; struct pipe_transfer *transfer = glhd_transfer->transfer; struct galahad_resource *glhd_resource = galahad_resource(_transfer->resource); if (glhd_resource->map_count < 1) { glhd_warn("context::transfer_unmap() called too many times" " (count = %d)\n", glhd_resource->map_count); } glhd_resource->map_count--; context->transfer_unmap(context, transfer); }
static struct pipe_transfer * galahad_context_get_transfer(struct pipe_context *_context, struct pipe_resource *_resource, unsigned level, unsigned usage, const struct pipe_box *box) { struct galahad_context *glhd_context = galahad_context(_context); struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_context *context = glhd_context->pipe; struct pipe_resource *resource = glhd_resource->resource; struct pipe_transfer *result; result = context->get_transfer(context, resource, level, usage, box); if (result) return galahad_transfer_create(glhd_context, glhd_resource, result); return NULL; }
static void galahad_context_transfer_inline_write(struct pipe_context *_context, struct pipe_resource *_resource, unsigned level, unsigned usage, const struct pipe_box *box, const void *data, unsigned stride, unsigned slice_stride) { struct galahad_context *glhd_context = galahad_context(_context); struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_context *context = glhd_context->pipe; struct pipe_resource *resource = glhd_resource->resource; context->transfer_inline_write(context, resource, level, usage, box, data, stride, slice_stride); }
static void galahad_screen_resource_destroy(struct pipe_screen *screen, struct pipe_resource *_resource) { galahad_resource_destroy(galahad_resource(_resource)); }