#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "nv10_context.h"
static void
nv10_miptree_release(struct pipe_screen *screen, struct pipe_texture **pt)
{
- struct pipe_winsys *ws = screen->winsys;
struct pipe_texture *mt = *pt;
*pt = NULL;
struct nv10_miptree *nv10mt = (struct nv10_miptree *)mt;
int l;
- pipe_buffer_reference(ws, &nv10mt->buffer, NULL);
+ pipe_buffer_reference(screen, &nv10mt->buffer, NULL);
for (l = 0; l <= mt->last_level; l++) {
if (nv10mt->level[l].image_offset)
FREE(nv10mt->level[l].image_offset);
struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
struct pipe_surface *ps;
- ps = ws->surface_alloc(ws);
+ ps = CALLOC_STRUCT(pipe_surface);
if (!ps)
return NULL;
- pipe_buffer_reference(ws, &ps->buffer, nv10mt->buffer);
+ pipe_texture_reference(&ps->texture, pt);
+ pipe_buffer_reference(screen, &ps->buffer, nv10mt->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];
ps->nblocksx = pt->nblocksx[level];
ps->nblocksy = pt->nblocksy[level];
ps->stride = nv10mt->level[level].pitch;
+ ps->refcount = 1;
if (pt->target == PIPE_TEXTURE_CUBE) {
ps->offset = nv10mt->level[level].image_offset[face];