revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mesa / src / gallium / drivers / nvfx / nvfx_resource.c
blob42e77c536216381f550025c8b81644c457f99e72
2 #include "pipe/p_context.h"
3 #include "util/u_staging.h"
4 #include "nvfx_resource.h"
5 #include "nouveau/nouveau_screen.h"
8 static struct pipe_resource *
9 nvfx_resource_create(struct pipe_screen *screen,
10 const struct pipe_resource *template)
12 if (template->target == PIPE_BUFFER)
13 return nvfx_buffer_create(screen, template);
14 else
15 return nvfx_miptree_create(screen, template);
18 static void
19 nvfx_resource_destroy(struct pipe_screen *screen, struct pipe_resource *pr)
21 if (pr->target == PIPE_BUFFER)
22 return nvfx_buffer_destroy(screen, pr);
23 else
24 return nvfx_miptree_destroy(screen, pr);
27 static struct pipe_resource *
28 nvfx_resource_from_handle(struct pipe_screen * screen,
29 const struct pipe_resource *template,
30 struct winsys_handle *whandle)
32 if (template->target == PIPE_BUFFER)
33 return NULL;
34 else
35 return nvfx_miptree_from_handle(screen, template, whandle);
38 static boolean
39 nvfx_resource_get_handle(struct pipe_screen *pscreen,
40 struct pipe_resource *pr,
41 struct winsys_handle *whandle)
43 struct nvfx_resource* res = (struct nvfx_resource*)pr;
45 if (!res || !res->bo)
46 return FALSE;
48 return nouveau_screen_bo_get_handle(pscreen, res->bo, nvfx_subresource_pitch(pr, 0), whandle);
51 void
52 nvfx_init_resource_functions(struct pipe_context *pipe)
54 pipe->create_surface = nvfx_miptree_surface_new;
55 pipe->surface_destroy = nvfx_miptree_surface_del;
58 void
59 nvfx_screen_init_resource_functions(struct pipe_screen *pscreen)
61 pscreen->resource_create = nvfx_resource_create;
62 pscreen->resource_from_handle = nvfx_resource_from_handle;
63 pscreen->resource_get_handle = nvfx_resource_get_handle;
64 pscreen->resource_destroy = nvfx_resource_destroy;
65 pscreen->user_buffer_create = nvfx_user_buffer_create;