2 #include "pipe/p_context.h"
3 #include "nvc0_resource.h"
4 #include "nouveau/nouveau_screen.h"
7 static struct pipe_resource
*
8 nvc0_resource_create(struct pipe_screen
*screen
,
9 const struct pipe_resource
*templ
)
11 switch (templ
->target
) {
13 return nouveau_buffer_create(screen
, templ
);
15 return nvc0_miptree_create(screen
, templ
);
19 static struct pipe_resource
*
20 nvc0_resource_from_handle(struct pipe_screen
* screen
,
21 const struct pipe_resource
*templ
,
22 struct winsys_handle
*whandle
)
24 if (templ
->target
== PIPE_BUFFER
)
27 return nvc0_miptree_from_handle(screen
, templ
, whandle
);
31 nvc0_init_resource_functions(struct pipe_context
*pcontext
)
33 pcontext
->get_transfer
= u_get_transfer_vtbl
;
34 pcontext
->transfer_map
= u_transfer_map_vtbl
;
35 pcontext
->transfer_flush_region
= u_transfer_flush_region_vtbl
;
36 pcontext
->transfer_unmap
= u_transfer_unmap_vtbl
;
37 pcontext
->transfer_destroy
= u_transfer_destroy_vtbl
;
38 pcontext
->transfer_inline_write
= u_transfer_inline_write_vtbl
;
39 pcontext
->create_surface
= nvc0_miptree_surface_new
;
40 pcontext
->surface_destroy
= nvc0_miptree_surface_del
;
44 nvc0_screen_init_resource_functions(struct pipe_screen
*pscreen
)
46 pscreen
->resource_create
= nvc0_resource_create
;
47 pscreen
->resource_from_handle
= nvc0_resource_from_handle
;
48 pscreen
->resource_get_handle
= u_resource_get_handle_vtbl
;
49 pscreen
->resource_destroy
= u_resource_destroy_vtbl
;
50 pscreen
->user_buffer_create
= nouveau_user_buffer_create
;