nv50: plug in miptree resource vtbl
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 10 Apr 2010 17:07:28 +0000 (19:07 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 10 Apr 2010 17:08:45 +0000 (19:08 +0200)
src/gallium/drivers/nv50/nv50_buffer.c
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_resource.h

index 094e05e9bbfb63d9a432e22b67dd8bc7addaa8e2..0bda7f78fb56826f817f615b7bea7720a058ddd0 100644 (file)
@@ -67,7 +67,7 @@ static void nv50_buffer_transfer_unmap( struct pipe_context *pipe,
 
 
 
-struct u_resource_vtbl nv50_buffer_vtbl = 
+const struct u_resource_vtbl nv50_buffer_vtbl =
 {
        u_default_resource_get_handle,      /* get_handle */
        nv50_buffer_destroy,                /* resource_destroy */
index 6484f924d0ba1eb5993712dcc3876304496ce6d5..b7cd92158febb35c55b138d29d3ad7e80a27e7bd 100644 (file)
@@ -111,7 +111,7 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
 }
 
 
-struct u_resource_vtbl nv50_miptree_vtbl = 
+const struct u_resource_vtbl nv50_miptree_vtbl =
 {
    nv50_miptree_get_handle,          /* get_handle */
    nv50_miptree_destroy,             /* resource_destroy */
@@ -137,7 +137,11 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *tmp
        uint32_t tile_flags;
        int ret, i, l;
 
+       if (!mt)
+               return NULL;
+
        *pt = *tmp;
+       mt->base.vtbl = &nv50_miptree_vtbl;
        pipe_reference_init(&pt->reference, 1);
        pt->screen = pscreen;
 
@@ -248,6 +252,7 @@ nv50_miptree_from_handle(struct pipe_screen *pscreen,
 
 
        mt->base.base = *template;
+       mt->base.vtbl = &nv50_miptree_vtbl;
        pipe_reference_init(&mt->base.base.reference, 1);
        mt->base.base.screen = pscreen;
        mt->image_nr = 1;
index 963a1100ce89a00d704649e0b2516b7cd201c120..6cf7662124b4d638891bdb76a6db479fd0656c82 100644 (file)
@@ -16,7 +16,7 @@ struct nouveau_bo;
  */
 struct nv50_resource {
        struct pipe_resource base;
-       struct u_resource_vtbl *vtbl;
+       const struct u_resource_vtbl *vtbl;
        struct nouveau_bo *bo;
 };