Merge branch '7.8'
[profile/ivi/mesa.git] / src / gallium / drivers / svga / svga_resource.c
1 #include "util/u_debug.h"
2
3 #include "svga_resource.h"
4 #include "svga_resource_buffer.h"
5 #include "svga_resource_texture.h"
6 #include "svga_context.h"
7 #include "svga_screen.h"
8
9
10 static struct pipe_resource *
11 svga_resource_create(struct pipe_screen *screen,
12                     const struct pipe_resource *template)
13 {
14    if (template->target == PIPE_BUFFER)
15       return svga_buffer_create(screen, template);
16    else
17       return svga_resource_create(screen, template);
18
19 }
20
21 static struct pipe_resource *
22 svga_resource_from_handle(struct pipe_screen * screen,
23                          const struct pipe_resource *template,
24                          struct winsys_handle *whandle)
25 {
26    if (template->target == PIPE_BUFFER)
27       return NULL;
28    else
29       return svga_resource_from_handle(screen, template, whandle);
30 }
31
32
33 void
34 svga_init_resource_functions(struct svga_context *svga)
35 {
36    svga->pipe.get_transfer = u_get_transfer_vtbl;
37    svga->pipe.transfer_map = u_transfer_map_vtbl;
38    svga->pipe.transfer_flush_region = u_transfer_flush_region_vtbl;
39    svga->pipe.transfer_unmap = u_transfer_unmap_vtbl;
40    svga->pipe.transfer_destroy = u_transfer_destroy_vtbl;
41    svga->pipe.transfer_inline_write = u_transfer_inline_write_vtbl;
42 }
43
44 void
45 svga_init_screen_resource_functions(struct svga_screen *is)
46 {
47    is->screen.resource_create = svga_resource_create;
48    is->screen.resource_from_handle = svga_resource_from_handle;
49    is->screen.resource_get_handle = u_resource_get_handle_vtbl;
50    is->screen.resource_destroy = u_resource_destroy_vtbl;
51    is->screen.user_buffer_create = svga_user_buffer_create;
52 }
53
54
55