1 #include "pipe/p_state.h"
2 #include "pipe/p_defines.h"
3 #include "pipe/p_util.h"
4 #include "pipe/p_inlines.h"
6 #include "nv50_context.h"
9 struct pipe_texture base
;
10 struct pipe_buffer
*buffer
;
13 static INLINE
struct nv50_miptree
*
14 nv50_miptree(struct pipe_texture
*pt
)
16 return (struct nv50_miptree
*)pt
;
19 static struct pipe_texture
*
20 nv50_miptree_create(struct pipe_screen
*pscreen
, const struct pipe_texture
*pt
)
22 struct pipe_winsys
*ws
= pscreen
->winsys
;
23 struct nv50_miptree
*mt
= CALLOC_STRUCT(nv50_miptree
);
25 NOUVEAU_ERR("unimplemented\n");
28 mt
->base
.refcount
= 1;
29 mt
->base
.screen
= pscreen
;
31 mt
->buffer
= ws
->buffer_create(ws
, 256, PIPE_BUFFER_USAGE_PIXEL
,
32 pt
->width
[0] * pt
->cpp
* pt
->height
[0]);
42 nv50_miptree_release(struct pipe_screen
*pscreen
, struct pipe_texture
**ppt
)
44 struct pipe_winsys
*ws
= pscreen
->winsys
;
45 struct pipe_texture
*pt
= *ppt
;
47 NOUVEAU_ERR("unimplemented\n");
50 if (--pt
->refcount
<= 0) {
51 struct nv50_miptree
*mt
= nv50_miptree(pt
);
53 pipe_buffer_reference(ws
, &mt
->buffer
, NULL
);
58 static struct pipe_surface
*
59 nv50_miptree_surface_new(struct pipe_screen
*pscreen
, struct pipe_texture
*pt
,
60 unsigned face
, unsigned level
, unsigned zslice
,
63 struct pipe_winsys
*ws
= pscreen
->winsys
;
64 struct nv50_miptree
*mt
= nv50_miptree(pt
);
65 struct pipe_surface
*ps
;
67 NOUVEAU_ERR("unimplemented\n");
69 ps
= ws
->surface_alloc(ws
);
73 pipe_buffer_reference(ws
, &ps
->buffer
, mt
->buffer
);
74 ps
->format
= pt
->format
;
75 ps
->width
= pt
->width
[level
];
76 ps
->height
= pt
->height
[level
];
77 ps
->block
= pt
->block
;
78 ps
->nblocksx
= pt
->nblocksx
[level
];
79 ps
->nblocksy
= pt
->nblocksy
[level
];
80 ps
->stride
= ps
->width
* ps
->block
.size
;
87 nv50_miptree_surface_del(struct pipe_screen
*pscreen
,
88 struct pipe_surface
**psurface
)
93 nv50_screen_init_miptree_functions(struct pipe_screen
*pscreen
)
95 pscreen
->texture_create
= nv50_miptree_create
;
96 pscreen
->texture_release
= nv50_miptree_release
;
97 pscreen
->get_tex_surface
= nv50_miptree_surface_new
;
98 pscreen
->tex_surface_release
= nv50_miptree_surface_del
;