2 #ifndef NV50_RESOURCE_H
3 #define NV50_RESOURCE_H
5 #include "util/u_transfer.h"
7 #include "nouveau/nouveau_winsys.h"
13 /* This gets further specialized into either buffer or texture
14 * structures. In the future we'll want to remove much of that
15 * distinction, but for now try to keep as close to the existing code
16 * as possible and use the vtbl struct to choose between the two
17 * underlying implementations.
19 struct nv50_resource
{
20 struct pipe_resource base
;
21 const struct u_resource_vtbl
*vtbl
;
22 struct nouveau_bo
*bo
;
25 struct nv50_miptree_level
{
31 #define NV50_MAX_TEXTURE_LEVELS 16
34 struct nv50_resource base
;
36 struct nv50_miptree_level level
[NV50_MAX_TEXTURE_LEVELS
];
41 static INLINE
struct nv50_miptree
*
42 nv50_miptree(struct pipe_resource
*pt
)
44 return (struct nv50_miptree
*)pt
;
49 struct nv50_resource
*nv50_resource(struct pipe_resource
*resource
)
51 return (struct nv50_resource
*)resource
;
54 /* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */
56 nv50_resource_mapped_by_gpu(struct pipe_resource
*resource
)
58 return nv50_resource(resource
)->bo
->handle
;
62 nv50_init_resource_functions(struct pipe_context
*pcontext
);
65 nv50_screen_init_resource_functions(struct pipe_screen
*pscreen
);
69 struct pipe_resource
*
70 nv50_miptree_create(struct pipe_screen
*pscreen
,
71 const struct pipe_resource
*tmp
);
73 struct pipe_resource
*
74 nv50_miptree_from_handle(struct pipe_screen
*pscreen
,
75 const struct pipe_resource
*template,
76 struct winsys_handle
*whandle
);
78 struct pipe_resource
*
79 nv50_buffer_create(struct pipe_screen
*pscreen
,
80 const struct pipe_resource
*template);
82 struct pipe_resource
*
83 nv50_user_buffer_create(struct pipe_screen
*screen
,
90 nv50_miptree_surface_new(struct pipe_screen
*pscreen
, struct pipe_resource
*pt
,
91 unsigned face
, unsigned level
, unsigned zslice
,
95 nv50_miptree_surface_del(struct pipe_surface
*ps
);