r300g: remove useless variables in some structures
authorMarek Olšák <maraeo@gmail.com>
Tue, 27 Sep 2011 00:04:02 +0000 (02:04 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 28 Sep 2011 23:09:58 +0000 (01:09 +0200)
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture_desc.c

index 60cbe1a40f51d22acde997a4105d2983f4c83208..8c8c7ce129f774883c44d9b236ad9cc92d701f5f 100644 (file)
@@ -357,10 +357,6 @@ struct r300_texture_desc {
      * derived from the texture properties. */
     unsigned size_in_bytes;
 
-    /* Total size of the buffer backing this texture, in bytes.
-     * It must be >= size. */
-    unsigned buffer_size_in_bytes;
-
     /**
      * If non-zero, override the natural texture layout with
      * a custom stride (in bytes).
@@ -400,7 +396,6 @@ struct r300_resource
     struct pb_buffer *buf;
     struct radeon_winsys_cs_handle *cs_buf;
     enum radeon_bo_domain domain;
-    unsigned buf_size;
 
     /* Constant buffers are in user memory. */
     uint8_t *constant_buffer;
index c751a943b9607aeb27569dbd5706a62d685b7d67..a8392d2dc52d9d76d8b6b6f82cb81eb5d0c6169e 100644 (file)
@@ -189,7 +189,6 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     rbuf->b.user_ptr = NULL;
     rbuf->domain = RADEON_DOMAIN_GTT;
     rbuf->buf = NULL;
-    rbuf->buf_size = templ->width0;
     rbuf->constant_buffer = NULL;
 
     /* Alloc constant buffers in RAM. */
@@ -237,7 +236,6 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
     rbuf->b.user_ptr = ptr;
     rbuf->domain = RADEON_DOMAIN_GTT;
     rbuf->buf = NULL;
-    rbuf->buf_size = size;
     rbuf->constant_buffer = NULL;
     return &rbuf->b.b.b;
 }
index fc84004fb9735c87503ebd4e756e40a78d998a2b..d2b3f3c2e6b111fdc8db8fc2dd82083c7411add2 100644 (file)
@@ -878,7 +878,6 @@ r300_texture_create_object(struct r300_screen *rscreen,
                            enum radeon_bo_layout microtile,
                            enum radeon_bo_layout macrotile,
                            unsigned stride_in_bytes_override,
-                           unsigned max_buffer_size,
                            struct pb_buffer *buffer)
 {
     struct radeon_winsys *rws = rscreen->rws;
@@ -901,7 +900,7 @@ r300_texture_create_object(struct r300_screen *rscreen,
     tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ?
                   RADEON_DOMAIN_GTT :
                   RADEON_DOMAIN_VRAM | RADEON_DOMAIN_GTT;
-    tex->buf_size = max_buffer_size;
+    tex->buf = buffer;
 
     if (!r300_resource_set_properties(&rscreen->screen, &tex->b.b.b, 0, base)) {
         if (buffer)
@@ -911,8 +910,7 @@ r300_texture_create_object(struct r300_screen *rscreen,
     }
 
     /* Create the backing buffer if needed. */
-    if (!buffer) {
-        tex->buf_size = tex->tex.size_in_bytes;
+    if (!tex->buf) {
         tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048,
                                       base->bind, tex->domain);
 
@@ -920,8 +918,6 @@ r300_texture_create_object(struct r300_screen *rscreen,
             FREE(tex);
             return NULL;
         }
-    } else {
-        tex->buf = buffer;
     }
 
     tex->cs_buf = rws->buffer_get_cs_handle(tex->buf);
@@ -952,7 +948,7 @@ struct pipe_resource *r300_texture_create(struct pipe_screen *screen,
 
     return (struct pipe_resource*)
            r300_texture_create_object(rscreen, base, microtile, macrotile,
-                                      0, 0, NULL);
+                                      0, NULL);
 }
 
 struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
@@ -963,7 +959,7 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
     struct r300_screen *rscreen = r300_screen(screen);
     struct pb_buffer *buffer;
     enum radeon_bo_layout microtile, macrotile;
-    unsigned stride, size;
+    unsigned stride;
 
     /* Support only 2D textures without mipmaps */
     if ((base->target != PIPE_TEXTURE_2D &&
@@ -973,7 +969,7 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
         return NULL;
     }
 
-    buffer = rws->buffer_from_handle(rws, whandle, &stride, &size);
+    buffer = rws->buffer_from_handle(rws, whandle, &stride, NULL);
     if (!buffer)
         return NULL;
 
@@ -995,7 +991,7 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
 
     return (struct pipe_resource*)
            r300_texture_create_object(rscreen, base, microtile, macrotile,
-                                      stride, size, buffer);
+                                      stride, buffer);
 }
 
 /* Not required to implement u_resource_vtbl, consider moving to another file:
index fe4f8dd5679708ad313b89615bda01c3e78c9f2d..55e363b892c849027c5105271a4d8d79e8a4bbc7 100644 (file)
@@ -507,29 +507,23 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen,
 
     /* Setup the miptree description. */
     r300_setup_miptree(rscreen, tex, TRUE);
-    /* If the required buffer size is larger the given max size,
+    /* If the required buffer size is larger than the given max size,
      * try again without the alignment for the CBZB clear. */
-    if (tex->buf_size && tex->tex.size_in_bytes > tex->buf_size) {
+    if (tex->buf && tex->tex.size_in_bytes > tex->buf->size) {
         r300_setup_miptree(rscreen, tex, FALSE);
-    }
-
-    r300_setup_hyperz_properties(rscreen, tex);
 
-    if (tex->buf_size) {
         /* Make sure the buffer we got is large enough. */
-        if (tex->tex.size_in_bytes > tex->buf_size) {
+        if (tex->tex.size_in_bytes > tex->buf->size) {
             fprintf(stderr, "r300: texture_desc_init: The buffer is not "
                             "large enough. Got: %i, Need: %i, Info:\n",
-                            tex->buf_size, tex->tex.size_in_bytes);
+                            tex->buf->size, tex->tex.size_in_bytes);
             r300_tex_print_info(tex, "texture_desc_init");
             return FALSE;
         }
-
-        tex->tex.buffer_size_in_bytes = tex->buf_size;
-    } else {
-        tex->tex.buffer_size_in_bytes = tex->tex.size_in_bytes;
     }
 
+    r300_setup_hyperz_properties(rscreen, tex);
+
     if (SCREEN_DBG_ON(rscreen, DBG_TEX))
         r300_tex_print_info(tex, "texture_desc_init");