u_vbuf: remove u_vbuf_resource
authorMarek Olšák <maraeo@gmail.com>
Tue, 10 Apr 2012 19:29:06 +0000 (21:29 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 23 Apr 2012 23:39:21 +0000 (01:39 +0200)
20 files changed:
src/gallium/auxiliary/util/u_vbuf.h
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture_desc.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600.h
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_hw_context.c
src/gallium/drivers/r600/r600_query.c
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/r600/r600_texture.c

index b5b7298b2cca4c7749a0e473abe21fb38b963f1a..a17d64ae7ad0a22c575e802cf6bdd037dfb2d2f4 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
-#include "util/u_transfer.h"
 
 /* Hardware vertex fetcher limitations can be described by this structure. */
 struct u_vbuf_caps {
@@ -78,12 +77,6 @@ struct u_vbuf {
    void *vertex_elements;
 };
 
-/* XXX this is no longer needed and can be removed */
-struct u_vbuf_resource {
-   struct u_resource b;
-   uint8_t *user_ptr;
-};
-
 enum u_fetch_alignment {
    U_VERTEX_FETCH_BYTE_ALIGNED,
    U_VERTEX_FETCH_DWORD_ALIGNED
@@ -101,10 +94,4 @@ void u_vbuf_destroy(struct u_vbuf *mgr);
 
 unsigned u_vbuf_draw_max_vertex_count(struct u_vbuf *mgr);
 
-
-static INLINE struct u_vbuf_resource *u_vbuf_resource(struct pipe_resource *r)
-{
-   return (struct u_vbuf_resource*)r;
-}
-
 #endif
index 9367fc05ca27b7b3f745669171d8738bbe2a8c94..29f2717707723edcd203ec5ea1019bcfe7a834f6 100644 (file)
@@ -383,7 +383,7 @@ struct r300_texture_desc {
 
 struct r300_resource
 {
-    struct u_vbuf_resource b;
+    struct u_resource b;
 
     /* Winsys buffer backing this resource. */
     struct pb_buffer *buf;
index 467339f6a626257c765747e4c950f9720797840b..4c0daa6c56dd90045aa9cfd55b3d01881fea1e0d 100644 (file)
@@ -120,9 +120,9 @@ static void get_rc_constant_state(
         case RC_STATE_R300_TEXSCALE_FACTOR:
             tex = r300_resource(texstate->sampler_views[constant->u.State[1]]->base.texture);
             /* Add a small number to the texture size to work around rounding errors in hw. */
-            vec[0] = tex->b.b.b.width0  / (tex->tex.width0  + 0.001f);
-            vec[1] = tex->b.b.b.height0 / (tex->tex.height0 + 0.001f);
-            vec[2] = tex->b.b.b.depth0  / (tex->tex.depth0  + 0.001f);
+            vec[0] = tex->b.b.width0  / (tex->tex.width0  + 0.001f);
+            vec[1] = tex->b.b.height0 / (tex->tex.height0 + 0.001f);
+            vec[2] = tex->b.b.depth0  / (tex->tex.depth0  + 0.001f);
             vec[3] = 1;
             break;
 
index 051b29217ad18479021553be89799aa2794b4475..8a492d2b40d1be6e26b4c8b9c1b05500b792ab7e 100644 (file)
@@ -212,7 +212,7 @@ static void get_external_state(
                 state->unit[i].wrap_mode = RC_WRAP_NONE;
             }
 
-            if (t->b.b.b.target == PIPE_TEXTURE_3D)
+            if (t->b.b.target == PIPE_TEXTURE_3D)
                 state->unit[i].clamp_and_scale_before_fetch = TRUE;
         }
     }
index c0f5687d80ac79fa1999b204a87dc32eba08923a..d5ba4fab499ecccc0fbb7498fea003d65d6d7558 100644 (file)
@@ -529,7 +529,7 @@ static void r300_draw_elements_immediate(struct r300_context *r300,
 
     switch (index_size) {
     case 1:
-        ptr1 = r300_resource(r300->index_buffer.buffer)->b.user_ptr;
+        ptr1 = r300->index_buffer.buffer->user_ptr;
         ptr1 += info->start;
 
         OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) |
@@ -553,7 +553,7 @@ static void r300_draw_elements_immediate(struct r300_context *r300,
         break;
 
     case 2:
-        ptr2 = (uint16_t*)r300_resource(r300->index_buffer.buffer)->b.user_ptr;
+        ptr2 = (uint16_t*)r300->index_buffer.buffer->user_ptr;
         ptr2 += info->start;
 
         OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) |
@@ -572,7 +572,7 @@ static void r300_draw_elements_immediate(struct r300_context *r300,
         break;
 
     case 4:
-        ptr4 = (uint32_t*)r300_resource(r300->index_buffer.buffer)->b.user_ptr;
+        ptr4 = (uint32_t*)r300->index_buffer.buffer->user_ptr;
         ptr4 += info->start;
 
         OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) |
@@ -614,7 +614,7 @@ static void r300_draw_elements(struct r300_context *r300,
 
     /* Fallback for misaligned ushort indices. */
     if (indexSize == 2 && (start & 1) &&
-        !r300_resource(indexBuffer)->b.user_ptr) {
+        !indexBuffer->user_ptr) {
         /* If we got here, then orgIndexBuffer == indexBuffer. */
         uint16_t *ptr = r300->rws->buffer_map(r300_resource(orgIndexBuffer)->buf,
                                               r300->cs,
@@ -632,10 +632,10 @@ static void r300_draw_elements(struct r300_context *r300,
         }
         r300->rws->buffer_unmap(r300_resource(orgIndexBuffer)->buf);
     } else {
-        if (r300_resource(indexBuffer)->b.user_ptr)
+        if (indexBuffer->user_ptr)
             r300_upload_index_buffer(r300, &indexBuffer, indexSize,
                                      &start, count,
-                                     r300_resource(indexBuffer)->b.user_ptr);
+                                     indexBuffer->user_ptr);
     }
 
     /* 19 dwords for emit_draw_elements. Give up if the function fails. */
@@ -775,7 +775,7 @@ static void r300_draw_vbo(struct pipe_context* pipe,
 
         if (info.instance_count <= 1) {
             if (info.count <= 8 &&
-                r300_resource(r300->index_buffer.buffer)->b.user_ptr) {
+                r300->index_buffer.buffer->user_ptr) {
                 r300_draw_elements_immediate(r300, &info);
             } else {
                 r300_draw_elements(r300, &info, -1);
index fba17a277202072bed149f343ed596d06b5ed889..c92b83146c0b0ed6eae19691c14fde3d71311e57 100644 (file)
@@ -108,8 +108,8 @@ r300_buffer_transfer_map( struct pipe_context *pipe,
     uint8_t *map;
     enum pipe_transfer_usage usage;
 
-    if (rbuf->b.user_ptr)
-        return (uint8_t *) rbuf->b.user_ptr + transfer->box.x;
+    if (rbuf->b.b.user_ptr)
+        return rbuf->b.b.user_ptr + transfer->box.x;
     if (rbuf->constant_buffer)
         return (uint8_t *) rbuf->constant_buffer + transfer->box.x;
 
@@ -158,7 +158,7 @@ static void r300_buffer_transfer_inline_write(struct pipe_context *pipe,
         memcpy(rbuf->constant_buffer + box->x, data, box->width);
         return;
     }
-    assert(rbuf->b.user_ptr == NULL);
+    assert(rbuf->b.b.user_ptr == NULL);
 
     map = rws->buffer_map(rbuf->buf, r300->cs,
                           PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage);
@@ -189,12 +189,11 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
 
     rbuf = util_slab_alloc(&r300screen->pool_buffers);
 
-    rbuf->b.b.b = *templ;
-    rbuf->b.b.vtbl = &r300_buffer_vtbl;
-    pipe_reference_init(&rbuf->b.b.b.reference, 1);
-    rbuf->b.b.b.screen = screen;
-    rbuf->b.b.b.user_ptr = NULL;
-    rbuf->b.user_ptr = NULL;
+    rbuf->b.b = *templ;
+    rbuf->b.vtbl = &r300_buffer_vtbl;
+    pipe_reference_init(&rbuf->b.b.reference, 1);
+    rbuf->b.b.screen = screen;
+    rbuf->b.b.user_ptr = NULL;
     rbuf->domain = RADEON_DOMAIN_GTT;
     rbuf->buf = NULL;
     rbuf->constant_buffer = NULL;
@@ -202,13 +201,13 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     /* Alloc constant buffers in RAM. */
     if (templ->bind & PIPE_BIND_CONSTANT_BUFFER) {
         rbuf->constant_buffer = MALLOC(templ->width0);
-        return &rbuf->b.b.b;
+        return &rbuf->b.b;
     }
 
     rbuf->buf =
         r300screen->rws->buffer_create(r300screen->rws,
-                                       rbuf->b.b.b.width0, alignment,
-                                       rbuf->b.b.b.bind, rbuf->domain);
+                                       rbuf->b.b.width0, alignment,
+                                       rbuf->b.b.bind, rbuf->domain);
     if (!rbuf->buf) {
         util_slab_free(&r300screen->pool_buffers, rbuf);
         return NULL;
@@ -217,7 +216,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     rbuf->cs_buf =
         r300screen->rws->buffer_get_cs_handle(rbuf->buf);
 
-    return &rbuf->b.b.b;
+    return &rbuf->b.b;
 }
 
 struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
@@ -229,22 +228,21 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
 
     rbuf = util_slab_alloc(&r300screen->pool_buffers);
 
-    pipe_reference_init(&rbuf->b.b.b.reference, 1);
-    rbuf->b.b.b.screen = screen;
-    rbuf->b.b.b.target = PIPE_BUFFER;
-    rbuf->b.b.b.format = PIPE_FORMAT_R8_UNORM;
-    rbuf->b.b.b.usage = PIPE_USAGE_IMMUTABLE;
-    rbuf->b.b.b.bind = bind;
-    rbuf->b.b.b.width0 = ~0;
-    rbuf->b.b.b.height0 = 1;
-    rbuf->b.b.b.depth0 = 1;
-    rbuf->b.b.b.array_size = 1;
-    rbuf->b.b.b.flags = 0;
-    rbuf->b.b.b.user_ptr = ptr;
-    rbuf->b.b.vtbl = &r300_buffer_vtbl;
-    rbuf->b.user_ptr = ptr;
+    pipe_reference_init(&rbuf->b.b.reference, 1);
+    rbuf->b.b.screen = screen;
+    rbuf->b.b.target = PIPE_BUFFER;
+    rbuf->b.b.format = PIPE_FORMAT_R8_UNORM;
+    rbuf->b.b.usage = PIPE_USAGE_IMMUTABLE;
+    rbuf->b.b.bind = bind;
+    rbuf->b.b.width0 = ~0;
+    rbuf->b.b.height0 = 1;
+    rbuf->b.b.depth0 = 1;
+    rbuf->b.b.array_size = 1;
+    rbuf->b.b.flags = 0;
+    rbuf->b.b.user_ptr = ptr;
+    rbuf->b.vtbl = &r300_buffer_vtbl;
     rbuf->domain = RADEON_DOMAIN_GTT;
     rbuf->buf = NULL;
     rbuf->constant_buffer = NULL;
-    return &rbuf->b.b.b;
+    return &rbuf->b.b;
 }
index a5bc662f5fdb7fdd75e87f8e01ed754052b7aac5..337008be47ee6102f2ff9cbcd6b1369ad5b9c853 100644 (file)
@@ -1840,8 +1840,8 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
     if (buf == NULL || buf->width0 == 0)
         return;
 
-    if (rbuf->b.user_ptr)
-        mapped = (uint32_t*)rbuf->b.user_ptr;
+    if (rbuf->b.b.user_ptr)
+        mapped = (uint32_t*)rbuf->b.b.user_ptr;
     else if (rbuf->constant_buffer)
         mapped = (uint32_t*)rbuf->constant_buffer;
     else
index 2dabf18d5e80f7c6fe6097c14e49cc4bd7ecc880..940179c6e9d99a577e38b8f55924160ab5c7d23c 100644 (file)
@@ -769,7 +769,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
             base_level = view->base.u.tex.first_level;
             min_level = sampler->min_lod;
             level_count = MIN3(sampler->max_lod,
-                               tex->b.b.b.last_level - base_level,
+                               tex->b.b.last_level - base_level,
                                view->base.u.tex.last_level - base_level);
 
             if (base_level + min_level) {
@@ -832,14 +832,14 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
             }
 
             /* to emulate 1D textures through 2D ones correctly */
-            if (tex->b.b.b.target == PIPE_TEXTURE_1D) {
+            if (tex->b.b.target == PIPE_TEXTURE_1D) {
                 texstate->filter0 &= ~R300_TX_WRAP_T_MASK;
                 texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
             }
 
             /* The hardware doesn't like CLAMP and CLAMP_TO_BORDER
              * for the 3rd coordinate if the texture isn't 3D. */
-            if (tex->b.b.b.target != PIPE_TEXTURE_3D) {
+            if (tex->b.b.target != PIPE_TEXTURE_3D) {
                 texstate->filter0 &= ~R300_TX_WRAP_R_MASK;
             }
 
index 75749e78b2de3cc35cd102ac0da1a3cc9e6d2954..8c5ee058b9e9229d0f230fb423a49e71fd12b0fa 100644 (file)
@@ -728,7 +728,7 @@ void r300_texture_setup_format_state(struct r300_screen *screen,
                                      unsigned height0_override,
                                      struct r300_texture_format_state *out)
 {
-    struct pipe_resource *pt = &tex->b.b.b;
+    struct pipe_resource *pt = &tex->b.b;
     struct r300_texture_desc *desc = &tex->tex;
     boolean is_r500 = screen->caps.is_r500;
     unsigned width, height, depth;
@@ -886,12 +886,12 @@ r300_texture_create_object(struct r300_screen *rscreen,
     if (base->nr_samples > 1)
         return NULL;
 
-    pipe_reference_init(&tex->b.b.b.reference, 1);
-    tex->b.b.b.screen = &rscreen->screen;
-    tex->b.b.b.usage = base->usage;
-    tex->b.b.b.bind = base->bind;
-    tex->b.b.b.flags = base->flags;
-    tex->b.b.vtbl = &r300_texture_vtbl;
+    pipe_reference_init(&tex->b.b.reference, 1);
+    tex->b.b.screen = &rscreen->screen;
+    tex->b.b.usage = base->usage;
+    tex->b.b.bind = base->bind;
+    tex->b.b.flags = base->flags;
+    tex->b.vtbl = &r300_texture_vtbl;
     tex->tex.microtile = microtile;
     tex->tex.macrotile[0] = macrotile;
     tex->tex.stride_in_bytes_override = stride_in_bytes_override;
@@ -1033,7 +1033,7 @@ struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx,
 
         /* Height must be aligned to the size of a tile. */
         tile_height = r300_get_pixel_alignment(surface->base.format,
-                                               tex->b.b.b.nr_samples,
+                                               tex->b.b.nr_samples,
                                                tex->tex.microtile,
                                                tex->tex.macrotile[level],
                                                DIM_HEIGHT, 0);
index c250bf15604df0c52d375099600ce4ed75e6dd22..04d439bcc1f854c820ed07917368879aa93f35bc 100644 (file)
@@ -95,7 +95,7 @@ static boolean r300_texture_macro_switch(struct r300_resource *tex,
 {
     unsigned tile, texdim;
 
-    tile = r300_get_pixel_alignment(tex->b.b.b.format, tex->b.b.b.nr_samples,
+    tile = r300_get_pixel_alignment(tex->b.b.format, tex->b.b.nr_samples,
                                     tex->tex.microtile, RADEON_LAYOUT_TILED, dim, 0);
     if (dim == DIM_WIDTH) {
         texdim = u_minify(tex->tex.width0, level);
@@ -128,27 +128,27 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen,
         return tex->tex.stride_in_bytes_override;
 
     /* Check the level. */
-    if (level > tex->b.b.b.last_level) {
+    if (level > tex->b.b.last_level) {
         SCREEN_DBG(screen, DBG_TEX, "%s: level (%u) > last_level (%u)\n",
-                   __FUNCTION__, level, tex->b.b.b.last_level);
+                   __FUNCTION__, level, tex->b.b.last_level);
         return 0;
     }
 
     width = u_minify(tex->tex.width0, level);
 
-    if (util_format_is_plain(tex->b.b.b.format)) {
-        tile_width = r300_get_pixel_alignment(tex->b.b.b.format,
-                                              tex->b.b.b.nr_samples,
+    if (util_format_is_plain(tex->b.b.format)) {
+        tile_width = r300_get_pixel_alignment(tex->b.b.format,
+                                              tex->b.b.nr_samples,
                                               tex->tex.microtile,
                                               tex->tex.macrotile[level],
                                               DIM_WIDTH, is_rs690);
         width = align(width, tile_width);
 
-        stride = util_format_get_stride(tex->b.b.b.format, width);
+        stride = util_format_get_stride(tex->b.b.format, width);
         /* The alignment to 32 bytes is sort of implied by the layout... */
         return stride;
     } else {
-        return align(util_format_get_stride(tex->b.b.b.format, width), is_rs690 ? 64 : 32);
+        return align(util_format_get_stride(tex->b.b.format, width), is_rs690 ? 64 : 32);
     }
 }
 
@@ -161,16 +161,16 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex,
     height = u_minify(tex->tex.height0, level);
 
     /* Mipmapped and 3D textures must have their height aligned to POT. */
-    if ((tex->b.b.b.target != PIPE_TEXTURE_1D &&
-         tex->b.b.b.target != PIPE_TEXTURE_2D &&
-         tex->b.b.b.target != PIPE_TEXTURE_RECT) ||
-        tex->b.b.b.last_level != 0) {
+    if ((tex->b.b.target != PIPE_TEXTURE_1D &&
+         tex->b.b.target != PIPE_TEXTURE_2D &&
+         tex->b.b.target != PIPE_TEXTURE_RECT) ||
+        tex->b.b.last_level != 0) {
         height = util_next_power_of_two(height);
     }
 
-    if (util_format_is_plain(tex->b.b.b.format)) {
-        tile_height = r300_get_pixel_alignment(tex->b.b.b.format,
-                                               tex->b.b.b.nr_samples,
+    if (util_format_is_plain(tex->b.b.format)) {
+        tile_height = r300_get_pixel_alignment(tex->b.b.format,
+                                               tex->b.b.nr_samples,
                                                tex->tex.microtile,
                                                tex->tex.macrotile[level],
                                                DIM_HEIGHT, 0);
@@ -187,10 +187,10 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex,
 
                 /* Align the height so that there is an even number of macrotiles.
                  * Do so for 3 or more macrotiles in the Y direction. */
-                if (level == 0 && tex->b.b.b.last_level == 0 &&
-                    (tex->b.b.b.target == PIPE_TEXTURE_1D ||
-                     tex->b.b.b.target == PIPE_TEXTURE_2D ||
-                     tex->b.b.b.target == PIPE_TEXTURE_RECT) &&
+                if (level == 0 && tex->b.b.last_level == 0 &&
+                    (tex->b.b.target == PIPE_TEXTURE_1D ||
+                     tex->b.b.target == PIPE_TEXTURE_2D ||
+                     tex->b.b.target == PIPE_TEXTURE_RECT) &&
                     height >= tile_height * 3) {
                     height = align(height, tile_height * 2);
                 }
@@ -202,7 +202,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex,
         }
     }
 
-    return util_format_get_nblocksy(tex->b.b.b.format, height);
+    return util_format_get_nblocksy(tex->b.b.format, height);
 }
 
 /* Get a width in pixels from a stride in bytes. */
@@ -217,7 +217,7 @@ static void r300_setup_miptree(struct r300_screen *screen,
                                struct r300_resource *tex,
                                boolean align_for_cbzb)
 {
-    struct pipe_resource *base = &tex->b.b.b;
+    struct pipe_resource *base = &tex->b.b;
     unsigned stride, size, layer_size, nblocksy, i;
     boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350;
     boolean aligned_for_cbzb;
@@ -274,15 +274,15 @@ static void r300_setup_miptree(struct r300_screen *screen,
 static void r300_setup_flags(struct r300_resource *tex)
 {
     tex->tex.uses_stride_addressing =
-        !util_is_power_of_two(tex->b.b.b.width0) ||
+        !util_is_power_of_two(tex->b.b.width0) ||
         (tex->tex.stride_in_bytes_override &&
-         r300_stride_to_width(tex->b.b.b.format,
-                         tex->tex.stride_in_bytes_override) != tex->b.b.b.width0);
+         r300_stride_to_width(tex->b.b.format,
+                         tex->tex.stride_in_bytes_override) != tex->b.b.width0);
 
     tex->tex.is_npot =
         tex->tex.uses_stride_addressing ||
-        !util_is_power_of_two(tex->b.b.b.height0) ||
-        !util_is_power_of_two(tex->b.b.b.depth0);
+        !util_is_power_of_two(tex->b.b.height0) ||
+        !util_is_power_of_two(tex->b.b.depth0);
 }
 
 static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
@@ -291,20 +291,20 @@ static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
     unsigned i, bpp;
     boolean first_level_valid;
 
-    bpp = util_format_get_blocksizebits(tex->b.b.b.format);
+    bpp = util_format_get_blocksizebits(tex->b.b.format);
 
     /* 1) The texture must be point-sampled,
      * 2) The depth must be 16 or 32 bits.
      * 3) If the midpoint ZB offset is not aligned to 2048, it returns garbage
      *    with certain texture sizes. Macrotiling ensures the alignment. */
-    first_level_valid = tex->b.b.b.nr_samples <= 1 &&
+    first_level_valid = tex->b.b.nr_samples <= 1 &&
                        (bpp == 16 || bpp == 32) &&
                        tex->tex.macrotile[0];
 
     if (SCREEN_DBG_ON(rscreen, DBG_NO_CBZB))
         first_level_valid = FALSE;
 
-    for (i = 0; i <= tex->b.b.b.last_level; i++)
+    for (i = 0; i <= tex->b.b.last_level; i++)
         tex->tex.cbzb_allowed[i] = first_level_valid && tex->tex.macrotile[i];
 }
 
@@ -353,8 +353,8 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen,
     static unsigned hiz_align_x[4] = {8, 32, 48, 32};
     static unsigned hiz_align_y[4] = {8, 8, 8, 32};
 
-    if (util_format_is_depth_or_stencil(tex->b.b.b.format) &&
-        util_format_get_blocksizebits(tex->b.b.b.format) == 32 &&
+    if (util_format_is_depth_or_stencil(tex->b.b.format) &&
+        util_format_get_blocksizebits(tex->b.b.format) == 32 &&
         tex->tex.microtile) {
         unsigned i, pipes;
 
@@ -364,18 +364,18 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen,
             pipes = screen->info.r300_num_gb_pipes;
         }
 
-        for (i = 0; i <= tex->b.b.b.last_level; i++) {
+        for (i = 0; i <= tex->b.b.last_level; i++) {
             unsigned zcomp_numdw, zcompsize, hiz_numdw, stride, height;
 
-            stride = r300_stride_to_width(tex->b.b.b.format,
+            stride = r300_stride_to_width(tex->b.b.format,
                                           tex->tex.stride_in_bytes[i]);
             stride = align(stride, 16);
-            height = u_minify(tex->b.b.b.height0, i);
+            height = u_minify(tex->b.b.height0, i);
 
             /* The 8x8 compression mode needs macrotiling. */
             zcompsize = screen->caps.z_compress == R300_ZCOMP_8X8 &&
                        tex->tex.macrotile[i] &&
-                       tex->b.b.b.nr_samples <= 1 ? 8 : 4;
+                       tex->b.b.nr_samples <= 1 ? 8 : 4;
 
             /* Get the ZMASK buffer size in dwords. */
             zcomp_numdw = r300_pixels_to_dwords(stride, height,
@@ -383,7 +383,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen,
                                 zmask_blocks_y_per_dw[pipes-1] * zcompsize);
 
             /* Check whether we have enough ZMASK memory. */
-            if (util_format_get_blocksizebits(tex->b.b.b.format) == 32 &&
+            if (util_format_get_blocksizebits(tex->b.b.format) == 32 &&
                 zcomp_numdw <= screen->caps.zmask_ram * pipes) {
                 tex->tex.zmask_dwords[i] = zcomp_numdw;
                 tex->tex.zcomp8x8[i] = zcompsize == 8;
@@ -418,7 +418,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen,
 static void r300_setup_tiling(struct r300_screen *screen,
                               struct r300_resource *tex)
 {
-    enum pipe_format format = tex->b.b.b.format;
+    enum pipe_format format = tex->b.b.format;
     boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350;
     boolean is_zb = util_format_is_depth_or_stencil(format);
     boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING);
@@ -431,7 +431,7 @@ static void r300_setup_tiling(struct r300_screen *screen,
     }
 
     /* If height == 1, disable microtiling except for zbuffer. */
-    if (!is_zb && (tex->b.b.b.height0 == 1 || dbg_no_tiling)) {
+    if (!is_zb && (tex->b.b.height0 == 1 || dbg_no_tiling)) {
         return;
     }
 
@@ -468,24 +468,24 @@ static void r300_tex_print_info(struct r300_resource *tex,
             func,
             tex->tex.macrotile[0] ? "YES" : " NO",
             tex->tex.microtile ? "YES" : " NO",
-            r300_stride_to_width(tex->b.b.b.format, tex->tex.stride_in_bytes[0]),
-            tex->b.b.b.width0, tex->b.b.b.height0, tex->b.b.b.depth0,
-            tex->b.b.b.last_level, tex->tex.size_in_bytes,
-            util_format_short_name(tex->b.b.b.format));
+            r300_stride_to_width(tex->b.b.format, tex->tex.stride_in_bytes[0]),
+            tex->b.b.width0, tex->b.b.height0, tex->b.b.depth0,
+            tex->b.b.last_level, tex->tex.size_in_bytes,
+            util_format_short_name(tex->b.b.format));
 }
 
 void r300_texture_desc_init(struct r300_screen *rscreen,
                             struct r300_resource *tex,
                             const struct pipe_resource *base)
 {
-    tex->b.b.b.target = base->target;
-    tex->b.b.b.format = base->format;
-    tex->b.b.b.width0 = base->width0;
-    tex->b.b.b.height0 = base->height0;
-    tex->b.b.b.depth0 = base->depth0;
-    tex->b.b.b.array_size = base->array_size;
-    tex->b.b.b.last_level = base->last_level;
-    tex->b.b.b.nr_samples = base->nr_samples;
+    tex->b.b.target = base->target;
+    tex->b.b.format = base->format;
+    tex->b.b.width0 = base->width0;
+    tex->b.b.height0 = base->height0;
+    tex->b.b.depth0 = base->depth0;
+    tex->b.b.array_size = base->array_size;
+    tex->b.b.last_level = base->last_level;
+    tex->b.b.nr_samples = base->nr_samples;
     tex->tex.width0 = base->width0;
     tex->tex.height0 = base->height0;
     tex->tex.depth0 = base->depth0;
@@ -538,7 +538,7 @@ unsigned r300_texture_get_offset(struct r300_resource *tex,
 {
     unsigned offset = tex->tex.offset_in_bytes[level];
 
-    switch (tex->b.b.b.target) {
+    switch (tex->b.b.target) {
         case PIPE_TEXTURE_3D:
         case PIPE_TEXTURE_CUBE:
             return offset + layer * tex->tex.layer_size_in_bytes[level];
index d440db8e305d3b955d3f6976b97ab69aa38430f9..44ff390ca0cfad56d06586f50dfd9180b32a2a97 100644 (file)
@@ -54,7 +54,7 @@ static void r300_copy_from_tiled_texture(struct pipe_context *ctx,
     struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
     struct pipe_resource *tex = transfer->resource;
 
-    ctx->resource_copy_region(ctx, &r300transfer->linear_texture->b.b.b, 0,
+    ctx->resource_copy_region(ctx, &r300transfer->linear_texture->b.b, 0,
                               0, 0, 0,
                               tex, transfer->level, &transfer->box);
 }
@@ -70,7 +70,7 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
 
     ctx->resource_copy_region(ctx, tex, transfer->level,
                               transfer->box.x, transfer->box.y, transfer->box.z,
-                              &r300transfer->linear_texture->b.b.b, 0, &src_box);
+                              &r300transfer->linear_texture->b.b, 0, &src_box);
 
     /* XXX remove this. */
     r300_flush(ctx, 0, NULL);
@@ -230,7 +230,7 @@ void* r300_texture_transfer_map(struct pipe_context *ctx,
     struct r300_transfer *r300transfer = r300_transfer(transfer);
     struct r300_resource *tex = r300_resource(transfer->resource);
     char *map;
-    enum pipe_format format = tex->b.b.b.format;
+    enum pipe_format format = tex->b.b.format;
 
     if (r300transfer->linear_texture) {
         /* The detiled texture is of the same size as the region being mapped
index 3b437bad3258517b106a2b2ce484e0a47c755990..97a27d242c037a5308edf709fe1bf26aa70d52f3 100644 (file)
@@ -1408,7 +1408,7 @@ static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rsta
 
        format = r600_translate_colorformat(surf->base.format);
        swap = r600_translate_colorswap(surf->base.format);
-       if (rtex->resource.b.b.b.usage == PIPE_USAGE_STAGING) {
+       if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
                endian = ENDIAN_NONE;
        } else {
                endian = r600_colorformat_endian_swap(format);
@@ -1725,7 +1725,7 @@ static void evergreen_emit_vertex_buffers(struct r600_context *rctx, struct r600
                        continue;
                }
 
-               va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b.b);
+               va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b);
                va += vb[i].buffer_offset;
 
                /* fetch resources start at index 992 */
@@ -1771,7 +1771,7 @@ static void evergreen_emit_constant_buffer(struct r600_context *rctx,
                rbuffer = (struct r600_resource*)cb->buffer;
                assert(rbuffer);
 
-               va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b.b);
+               va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b);
                va += cb->buffer_offset;
 
                r600_write_context_reg(cs, reg_alu_constbuf_size + buffer_index * 4,
index e705b89525520448138994a48ab1c36984f4e943..dd4fc009d3d68167816702ba53ba35bdd4d8259d 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "../../winsys/radeon/drm/radeon_winsys.h"
 #include "util/u_double_list.h"
+#include "util/u_transfer.h"
 #include "util/u_vbuf.h"
 
 #define R600_ERR(fmt, args...) \
@@ -79,7 +80,7 @@ struct r600_tiling_info {
 };
 
 struct r600_resource {
-       struct u_vbuf_resource          b;
+       struct u_resource               b;
 
        /* Winsys objects. */
        struct pb_buffer                *buf;
index 480bef1baab4d7ec55cb8e9b99afcabfc954c364..a7a0d9dfc1c6d9af6159d22d7e492e8633c4b5dd 100644 (file)
@@ -127,8 +127,8 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t
            rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
                depth = 0.0f;
 
-       for (level = 0; level <= texture->resource.b.b.b.last_level; level++) {
-               unsigned num_layers = u_num_layers(&texture->resource.b.b.b, level);
+       for (level = 0; level <= texture->resource.b.b.last_level; level++) {
+               unsigned num_layers = u_num_layers(&texture->resource.b.b, level);
 
                for (layer = 0; layer < num_layers; layer++) {
                        struct pipe_surface *zsurf, *cbsurf, surf_tmpl;
@@ -139,7 +139,7 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t
                        surf_tmpl.u.tex.last_layer = layer;
                        surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
 
-                       zsurf = ctx->create_surface(ctx, &texture->resource.b.b.b, &surf_tmpl);
+                       zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl);
 
                        surf_tmpl.format = texture->flushed_depth_texture->real_format;
                        surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
@@ -390,8 +390,8 @@ void r600_blit_push_depth(struct pipe_context *ctx, struct r600_resource_texture
        struct pipe_box sbox;
 
        sbox.x = sbox.y = sbox.z = 0;
-       sbox.width = texture->resource.b.b.b.width0;
-       sbox.height = texture->resource.b.b.b.height0;
+       sbox.width = texture->resource.b.b.width0;
+       sbox.height = texture->resource.b.b.height0;
        /* XXX that might be wrong */
        sbox.depth = 1;
 
index 440af5622faaeacc4fcfed55fb3b269e91fc7173..c22d36147dff577ce7a39f24fa5a56f1f18b3f52 100644 (file)
@@ -69,7 +69,7 @@ static void r600_set_constants_dirty_if_bound(struct r600_context *rctx,
 
        while (mask) {
                unsigned i = u_bit_scan(&mask);
-               if (state->cb[i].buffer == &rbuffer->b.b.b) {
+               if (state->cb[i].buffer == &rbuffer->b.b) {
                        found = true;
                        state->dirty_mask |= 1 << i;
                }
@@ -101,20 +101,20 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
 
                        /* Create a new one in the same pipe_resource. */
                        /* XXX We probably want a different alignment for buffers and textures. */
-                       r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.b.width0, 4096,
-                                          rbuffer->b.b.b.bind, rbuffer->b.b.b.usage);
+                       r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.width0, 4096,
+                                          rbuffer->b.b.bind, rbuffer->b.b.usage);
 
                        /* We changed the buffer, now we need to bind it where the old one was bound. */
                        /* Vertex buffers. */
                        for (i = 0; i < rctx->vbuf_mgr->nr_vertex_buffers; i++) {
-                               if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b.b) {
+                               if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b) {
                                        r600_inval_vertex_cache(rctx);
                                        r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
                                }
                        }
                        /* Streamout buffers. */
                        for (i = 0; i < rctx->num_so_targets; i++) {
-                               if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b.b) {
+                               if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b) {
                                        r600_context_streamout_end(rctx);
                                        rctx->streamout_start = TRUE;
                                        rctx->streamout_append_bitmask = ~0;
@@ -126,8 +126,8 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
                }
        }
 
-       if (rbuffer->b.user_ptr)
-               return (uint8_t*)rbuffer->b.user_ptr + transfer->box.x;
+       if (rbuffer->b.b.user_ptr)
+               return rbuffer->b.b.user_ptr + transfer->box.x;
 
        data = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, transfer->usage);
        if (!data)
@@ -142,7 +142,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe,
        struct r600_resource *rbuffer = r600_resource(transfer->resource);
        struct r600_context *rctx = (struct r600_context*)pipe;
 
-       if (rbuffer->b.user_ptr)
+       if (rbuffer->b.b.user_ptr)
                return;
 
        rctx->ws->buffer_unmap(rbuffer->buf);
@@ -219,18 +219,17 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
 
        rbuffer = util_slab_alloc(&rscreen->pool_buffers);
 
-       rbuffer->b.b.b = *templ;
-       pipe_reference_init(&rbuffer->b.b.b.reference, 1);
-       rbuffer->b.b.b.screen = screen;
-       rbuffer->b.b.b.user_ptr = NULL;
-       rbuffer->b.b.vtbl = &r600_buffer_vtbl;
-       rbuffer->b.user_ptr = NULL;
+       rbuffer->b.b = *templ;
+       pipe_reference_init(&rbuffer->b.b.reference, 1);
+       rbuffer->b.b.screen = screen;
+       rbuffer->b.b.user_ptr = NULL;
+       rbuffer->b.vtbl = &r600_buffer_vtbl;
 
        if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
                util_slab_free(&rscreen->pool_buffers, rbuffer);
                return NULL;
        }
-       return &rbuffer->b.b.b;
+       return &rbuffer->b.b;
 }
 
 struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
@@ -242,20 +241,19 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
 
        rbuffer = util_slab_alloc(&rscreen->pool_buffers);
 
-       pipe_reference_init(&rbuffer->b.b.b.reference, 1);
-       rbuffer->b.b.vtbl = &r600_buffer_vtbl;
-       rbuffer->b.b.b.screen = screen;
-       rbuffer->b.b.b.target = PIPE_BUFFER;
-       rbuffer->b.b.b.format = PIPE_FORMAT_R8_UNORM;
-       rbuffer->b.b.b.usage = PIPE_USAGE_IMMUTABLE;
-       rbuffer->b.b.b.bind = bind;
-       rbuffer->b.b.b.width0 = bytes;
-       rbuffer->b.b.b.height0 = 1;
-       rbuffer->b.b.b.depth0 = 1;
-       rbuffer->b.b.b.array_size = 1;
-       rbuffer->b.b.b.flags = 0;
-       rbuffer->b.b.b.user_ptr = ptr;
-       rbuffer->b.user_ptr = ptr;
+       pipe_reference_init(&rbuffer->b.b.reference, 1);
+       rbuffer->b.vtbl = &r600_buffer_vtbl;
+       rbuffer->b.b.screen = screen;
+       rbuffer->b.b.target = PIPE_BUFFER;
+       rbuffer->b.b.format = PIPE_FORMAT_R8_UNORM;
+       rbuffer->b.b.usage = PIPE_USAGE_IMMUTABLE;
+       rbuffer->b.b.bind = bind;
+       rbuffer->b.b.width0 = bytes;
+       rbuffer->b.b.height0 = 1;
+       rbuffer->b.b.depth0 = 1;
+       rbuffer->b.b.array_size = 1;
+       rbuffer->b.b.flags = 0;
+       rbuffer->b.b.user_ptr = ptr;
        rbuffer->buf = NULL;
-       return &rbuffer->b.b.b;
+       return &rbuffer->b.b;
 }
index e898a598e3e2e756edd22f4f850de1d243bfa053..febe9bd665e8cb46103a371b87fc76ec387dd9b8 100644 (file)
@@ -858,7 +858,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat
                if (block->pm4_bo_index[id]) {
                        /* find relocation */
                        reloc_id = block->pm4_bo_index[id];
-                       pipe_resource_reference((struct pipe_resource**)&block->reloc[reloc_id].bo, &reg->bo->b.b.b);
+                       pipe_resource_reference((struct pipe_resource**)&block->reloc[reloc_id].bo, &reg->bo->b.b);
                        block->reloc[reloc_id].bo_usage = reg->bo_usage;
                        /* always force dirty for relocs for now */
                        dirty |= R600_BLOCK_STATUS_DIRTY;
@@ -919,9 +919,9 @@ void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_
 
        if (dirty) {
                /* TEXTURE RESOURCE */
-               pipe_resource_reference((struct pipe_resource**)&block->reloc[1].bo, &state->bo[0]->b.b.b);
+               pipe_resource_reference((struct pipe_resource**)&block->reloc[1].bo, &state->bo[0]->b.b);
                block->reloc[1].bo_usage = state->bo_usage[0];
-               pipe_resource_reference((struct pipe_resource**)&block->reloc[2].bo, &state->bo[1]->b.b.b);
+               pipe_resource_reference((struct pipe_resource**)&block->reloc[2].bo, &state->bo[1]->b.b);
                block->reloc[2].bo_usage = state->bo_usage[1];
 
                r600_context_dirty_resource_block(ctx, block, dirty, num_regs - 1);
index 8cf78905e3d7c78cac4c4f398f8180e5f2c0b7b1..9632d18e391924a44a1a04bb009768ce51d6f602 100644 (file)
@@ -92,7 +92,7 @@ static void r600_emit_query_begin(struct r600_context *ctx, struct r600_query *q
        r600_need_cs_space(ctx, query->num_cs_dw * 2, TRUE);
 
        /* Get a new query buffer if needed. */
-       if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.b.width0) {
+       if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.width0) {
                struct r600_query_buffer *qbuf = MALLOC_STRUCT(r600_query_buffer);
                *qbuf = query->buffer;
                query->buffer.buf = r600_new_query_buffer(ctx, query->type);
@@ -228,7 +228,7 @@ static void r600_emit_query_predication(struct r600_context *ctx, struct r600_qu
                /* emit predicate packets for all data blocks */
                for (qbuf = &query->buffer; qbuf; qbuf = qbuf->previous) {
                        unsigned results_base = 0;
-                       uint64_t va = r600_resource_va(&ctx->screen->screen, &qbuf->buf->b.b.b);
+                       uint64_t va = r600_resource_va(&ctx->screen->screen, &qbuf->buf->b.b);
 
                        while (results_base < qbuf->results_end) {
                                cs->buf[cs->cdw++] = PKT3(PKT3_SET_PREDICATION, 1, 0);
index 2498196fd5ea5444aff1227cc361f7a04494a700..116ec5fca0e5fa1f77e027e3652dc3845d7327d9 100644 (file)
@@ -1451,7 +1451,7 @@ static void r600_cb(struct r600_context *rctx, struct r600_pipe_state *rstate,
 
        format = r600_translate_colorformat(surf->base.format);
        swap = r600_translate_colorswap(surf->base.format);
-       if(rtex->resource.b.b.b.usage == PIPE_USAGE_STAGING) {
+       if(rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
                endian = ENDIAN_NONE;
        } else {
                endian = r600_colorformat_endian_swap(format);
index 6c02ed544c48b80323d9bb07817343098722ce3d..a5b4c911ca112593aab31d00b0b7881e779dd0c2 100644 (file)
@@ -557,7 +557,7 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
        cb = &state->cb[index];
        cb->buffer_size = buffer->width0;
 
-       ptr = u_vbuf_resource(buffer)->user_ptr;
+       ptr = buffer->user_ptr;
 
        if (ptr) {
                /* Upload the user buffer. */
@@ -778,7 +778,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo)
                /* Translate or upload, if needed. */
                r600_translate_index_buffer(rctx, &ib, info.count);
 
-               ptr = u_vbuf_resource(ib.buffer)->user_ptr;
+               ptr = ib.buffer->user_ptr;
                if (ptr) {
                        u_upload_data(rctx->vbuf_mgr->uploader, 0, info.count * ib.index_size,
                                      ptr, &ib.offset, &ib.buffer);
index ce66117ed47eaf5bf4ce5acaac8769ae4bbccdb7..99cba964a32ddb2d43f754f3a0b3c9ae10eb7f26 100644 (file)
@@ -37,7 +37,7 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t
        struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
        struct pipe_resource *texture = transfer->resource;
 
-       ctx->resource_copy_region(ctx, &rtransfer->staging->b.b.b,
+       ctx->resource_copy_region(ctx, &rtransfer->staging->b.b,
                                0, 0, 0, 0, texture, transfer->level,
                                &transfer->box);
 }
@@ -57,7 +57,7 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600
        sbox.depth = 1;
        ctx->resource_copy_region(ctx, texture, transfer->level,
                                  transfer->box.x, transfer->box.y, transfer->box.z,
-                                 &rtransfer->staging->b.b.b,
+                                 &rtransfer->staging->b.b,
                                  0, &sbox);
 }
 
@@ -66,7 +66,7 @@ unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
 {
        unsigned offset = rtex->offset[level];
 
-       switch (rtex->resource.b.b.b.target) {
+       switch (rtex->resource.b.b.target) {
        case PIPE_TEXTURE_3D:
        case PIPE_TEXTURE_CUBE:
        default:
@@ -163,7 +163,7 @@ static unsigned r600_texture_get_nblocksx(struct pipe_screen *screen,
                                          struct r600_resource_texture *rtex,
                                          unsigned level)
 {
-       struct pipe_resource *ptex = &rtex->resource.b.b.b;
+       struct pipe_resource *ptex = &rtex->resource.b.b;
        unsigned nblocksx, block_align, width;
        unsigned blocksize = util_format_get_blocksize(rtex->real_format);
 
@@ -183,7 +183,7 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen,
                                          struct r600_resource_texture *rtex,
                                          unsigned level)
 {
-       struct pipe_resource *ptex = &rtex->resource.b.b.b;
+       struct pipe_resource *ptex = &rtex->resource.b.b;
        unsigned height, tile_height;
 
        height = mip_minify(ptex->height0, level);
@@ -208,7 +208,7 @@ static void r600_texture_set_array_mode(struct pipe_screen *screen,
                                        struct r600_resource_texture *rtex,
                                        unsigned level, unsigned array_mode)
 {
-       struct pipe_resource *ptex = &rtex->resource.b.b.b;
+       struct pipe_resource *ptex = &rtex->resource.b.b;
 
        switch (array_mode) {
        case V_0280A0_ARRAY_LINEAR_GENERAL:
@@ -311,7 +311,7 @@ static int r600_setup_surface(struct pipe_screen *screen,
                              unsigned array_mode,
                              unsigned pitch_in_bytes_override)
 {
-       struct pipe_resource *ptex = &rtex->resource.b.b.b;
+       struct pipe_resource *ptex = &rtex->resource.b.b;
        struct r600_screen *rscreen = (struct r600_screen*)screen;
        unsigned i;
        int r;
@@ -364,7 +364,7 @@ static void r600_setup_miptree(struct pipe_screen *screen,
                               struct r600_resource_texture *rtex,
                               unsigned array_mode)
 {
-       struct pipe_resource *ptex = &rtex->resource.b.b.b;
+       struct pipe_resource *ptex = &rtex->resource.b.b;
        enum chip_class chipc = ((struct r600_screen*)screen)->chip_class;
        unsigned size, layer_size, i, offset;
        unsigned nblocksx, nblocksy;
@@ -501,10 +501,10 @@ r600_texture_create_object(struct pipe_screen *screen,
                return NULL;
 
        resource = &rtex->resource;
-       resource->b.b.b = *base;
-       resource->b.b.vtbl = &r600_texture_vtbl;
-       pipe_reference_init(&resource->b.b.b.reference, 1);
-       resource->b.b.b.screen = screen;
+       resource->b.b = *base;
+       resource->b.vtbl = &r600_texture_vtbl;
+       pipe_reference_init(&resource->b.b.reference, 1);
+       resource->b.b.screen = screen;
        rtex->pitch_override = pitch_in_bytes_override;
        rtex->real_format = base->format;
 
@@ -573,7 +573,7 @@ r600_texture_create_object(struct pipe_screen *screen,
                stencil_align = r600_get_base_alignment(screen, rtex->stencil->real_format, array_mode);
                stencil_offset = align(rtex->size, stencil_align);
 
-               for (unsigned i = 0; i <= rtex->stencil->resource.b.b.b.last_level; i++)
+               for (unsigned i = 0; i <= rtex->stencil->resource.b.b.last_level; i++)
                        rtex->stencil->offset[i] += stencil_offset;
 
                rtex->size = stencil_offset + rtex->stencil->size;
@@ -581,7 +581,7 @@ r600_texture_create_object(struct pipe_screen *screen,
 
        /* Now create the backing buffer. */
        if (!buf && alloc_bo) {
-               struct pipe_resource *ptex = &rtex->resource.b.b.b;
+               struct pipe_resource *ptex = &rtex->resource.b.b;
                unsigned base_align = r600_get_base_alignment(screen, ptex->format, array_mode);
 
                if (rscreen->use_surface_alloc) {