#include "pipe/p_inlines.h"
#include "nv30_context.h"
-#include "nv30_screen.h"
static void
nv30_miptree_layout(struct nv30_miptree *nv30mt)
boolean swizzled = FALSE;
uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
uint offset = 0;
- int nr_faces, l, f;
+ int nr_faces, l, f, pitch;
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
nr_faces = 1;
}
+ pitch = pt->width[0];
for (l = 0; l <= pt->last_level; l++) {
pt->width[l] = width;
pt->height[l] = height;
pt->depth[l] = depth;
if (swizzled)
- nv30mt->level[l].pitch = pt->width[l] * pt->cpp;
- else
- nv30mt->level[l].pitch = pt->width[0] * pt->cpp;
- nv30mt->level[l].pitch = (nv30mt->level[l].pitch + 63) & ~63;
+ pitch = pt->width[l];
+ pitch = (pitch + 63) & ~63;
+ nv30mt->level[l].pitch = pitch * pt->cpp;
nv30mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
}
static struct pipe_texture *
-nv30_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
+nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
{
- struct pipe_winsys *ws = screen->winsys;
+ struct pipe_winsys *ws = pscreen->winsys;
struct nv30_miptree *mt;
mt = MALLOC(sizeof(struct nv30_miptree));
return NULL;
mt->base = *pt;
mt->base.refcount = 1;
- mt->base.screen = screen;
+ mt->base.screen = pscreen;
nv30_miptree_layout(mt);
- mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
- mt->total_size);
+ mt->buffer = ws->buffer_create(ws, 256,
+ PIPE_BUFFER_USAGE_PIXEL |
+ NOUVEAU_BUFFER_USAGE_TEXTURE,
+ mt->total_size);
if (!mt->buffer) {
FREE(mt);
return NULL;
}
-
+
return &mt->base;
}
static void
-nv30_miptree_release(struct pipe_screen *screen, struct pipe_texture **pt)
+nv30_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **pt)
{
- struct pipe_winsys *ws = screen->winsys;
+ struct pipe_winsys *ws = pscreen->winsys;
struct pipe_texture *mt = *pt;
*pt = NULL;
}
static struct pipe_surface *
-nv30_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
- unsigned face, unsigned level, unsigned zslice)
+nv30_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice)
{
- struct pipe_winsys *ws = screen->winsys;
+ struct pipe_winsys *ws = pscreen->winsys;
struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt;
struct pipe_surface *ps;
{
pscreen->texture_create = nv30_miptree_create;
pscreen->texture_release = nv30_miptree_release;
- pscreen->get_tex_surface = nv30_miptree_surface_get;
+ pscreen->get_tex_surface = nv30_miptree_surface;
}