blob: 3ffb0b7a5d234f82b1563f3fe3448ca4524297ff (
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
51
52
|
#include "util/u_debug.h"
#include "i915_resource.h"
#include "i915_context.h"
#include "i915_screen.h"
static struct pipe_resource *
i915_resource_create(struct pipe_screen *screen,
const struct pipe_resource *template)
{
if (template->target == PIPE_BUFFER)
return i915_buffer_create(screen, template);
else
{
if (!(template->bind & PIPE_BIND_LINEAR))
return i915_texture_create(screen, template, FALSE);
else
return i915_texture_create(screen, template, TRUE);
}
}
static struct pipe_resource *
i915_resource_from_handle(struct pipe_screen * screen,
const struct pipe_resource *template,
struct winsys_handle *whandle,
unsigned usage)
{
if (template->target == PIPE_BUFFER)
return NULL;
else
return i915_texture_from_handle(screen, template, whandle);
}
void
i915_init_resource_functions(struct i915_context *i915 )
{
i915->base.transfer_map = u_transfer_map_vtbl;
i915->base.transfer_flush_region = u_transfer_flush_region_vtbl;
i915->base.transfer_unmap = u_transfer_unmap_vtbl;
i915->base.transfer_inline_write = u_transfer_inline_write_vtbl;
}
void
i915_init_screen_resource_functions(struct i915_screen *is)
{
is->base.resource_create = i915_resource_create;
is->base.resource_from_handle = i915_resource_from_handle;
is->base.resource_get_handle = u_resource_get_handle_vtbl;
is->base.resource_destroy = u_resource_destroy_vtbl;
}
|