2 #ifndef NVFX_RESOURCE_H
3 #define NVFX_RESOURCE_H
5 #include "util/u_transfer.h"
11 /* This gets further specialized into either buffer or texture
12 * structures. In the future we'll want to remove much of that
13 * distinction, but for now try to keep as close to the existing code
14 * as possible and use the vtbl struct to choose between the two
15 * underlying implementations.
17 struct nvfx_resource
{
18 struct pipe_resource base
;
19 struct u_resource_vtbl
*vtbl
;
20 struct nouveau_bo
*bo
;
23 #define NVFX_MAX_TEXTURE_LEVELS 16
26 struct nvfx_resource base
;
32 } level
[NVFX_MAX_TEXTURE_LEVELS
];
38 struct nvfx_resource
*nvfx_resource(struct pipe_resource
*resource
)
40 return (struct nvfx_resource
*)resource
;
43 static INLINE
struct nouveau_bo
*
44 nvfx_surface_buffer(struct pipe_surface
*surf
)
46 struct nvfx_resource
*mt
= nvfx_resource(surf
->texture
);
53 nvfx_init_resource_functions(struct pipe_context
*pipe
);
56 nvfx_screen_init_resource_functions(struct pipe_screen
*pscreen
);
62 struct pipe_resource
*
63 nvfx_miptree_create(struct pipe_screen
*pscreen
, const struct pipe_resource
*pt
);
65 struct pipe_resource
*
66 nvfx_miptree_from_handle(struct pipe_screen
*pscreen
,
67 const struct pipe_resource
*template,
68 struct winsys_handle
*whandle
);
70 struct pipe_resource
*
71 nvfx_buffer_create(struct pipe_screen
*pscreen
,
72 const struct pipe_resource
*template);
74 struct pipe_resource
*
75 nvfx_user_buffer_create(struct pipe_screen
*screen
,
83 nvfx_miptree_surface_del(struct pipe_surface
*ps
);
86 nvfx_miptree_surface_new(struct pipe_screen
*pscreen
, struct pipe_resource
*pt
,
87 unsigned face
, unsigned level
, unsigned zslice
,