summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_resource.c
blob: 069a12b27f7b78762ded1b8ca9f443a4cd68d044 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "util/u_debug.h"

#include "brw_resource.h"
#include "brw_context.h"
#include "brw_screen.h"


static struct pipe_resource *
brw_resource_create(struct pipe_screen *screen,
                    const struct pipe_resource *template)
{
   if (template->target == PIPE_BUFFER)
      return brw_buffer_create(screen, template);
   else
      return brw_texture_create(screen, template);

}

static struct pipe_resource *
brw_resource_from_handle(struct pipe_screen * screen,
			 const struct pipe_resource *template,
			 struct winsys_handle *whandle)
{
   if (template->target == PIPE_BUFFER)
      return NULL;
   else
      return brw_texture_from_handle(screen, template, whandle);
}


void
brw_init_resource_functions(struct brw_context *brw )
{
   brw->base.get_transfer = u_get_transfer_vtbl;
   brw->base.transfer_map = u_transfer_map_vtbl;
   brw->base.transfer_flush_region = u_transfer_flush_region_vtbl;
   brw->base.transfer_unmap = u_transfer_unmap_vtbl;
   brw->base.transfer_destroy = u_transfer_destroy_vtbl;
   brw->base.transfer_inline_write = u_transfer_inline_write_vtbl;
}

void
brw_init_screen_resource_functions(struct brw_screen *is)
{
   is->base.resource_create = brw_resource_create;
   is->base.resource_from_handle = brw_resource_from_handle;
   is->base.resource_get_handle = u_resource_get_handle_vtbl;
   is->base.resource_destroy = u_resource_destroy_vtbl;
   is->base.user_buffer_create = brw_user_buffer_create;
}