intel: Drop some extra equality checks on reference/release functions.
authorEric Anholt <eric@anholt.net>
Wed, 21 Sep 2011 21:47:39 +0000 (14:47 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 26 Sep 2011 22:33:42 +0000 (15:33 -0700)
_mesa_reference_renderbuffer already short-circuits equality, and
intel_miptree_release does nothing on NULL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_tex.c

index 418e426e42b6b002daad1386c1ad864b98591518..315108e4732e203b79b0bf959a186ce50e10c9bc 100644 (file)
@@ -518,17 +518,12 @@ intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb,
 
       /* The tex image shares its embedded depth and stencil renderbuffers with
        * the renderbuffer wrapper. */
-      if (irb->wrapped_depth != intel_image->depth_rb) {
-        _mesa_reference_renderbuffer(&irb->wrapped_depth,
-                                     intel_image->depth_rb);
-      }
-      if (irb->wrapped_stencil != intel_image->stencil_rb) {
-        _mesa_reference_renderbuffer(&irb->wrapped_stencil,
-                                     intel_image->stencil_rb);
-      }
+      _mesa_reference_renderbuffer(&irb->wrapped_depth,
+                                  intel_image->depth_rb);
+      _mesa_reference_renderbuffer(&irb->wrapped_stencil,
+                                  intel_image->stencil_rb);
 
       return true;
-
    } else {
       return intel_update_tex_wrapper_regions(intel, irb, intel_image);
    }
index f8c3f7741dd5879f1621f4355f9824d4900b4e3a..3ce5b906b737ee440ac3a964fca862eb70087203 100644 (file)
@@ -46,9 +46,7 @@ intelDeleteTextureObject(struct gl_context *ctx,
    struct intel_context *intel = intel_context(ctx);
    struct intel_texture_object *intelObj = intel_texture_object(texObj);
 
-   if (intelObj->mt)
-      intel_miptree_release(intel, &intelObj->mt);
-
+   intel_miptree_release(intel, &intelObj->mt);
    _mesa_delete_texture_object(ctx, texObj);
 }
 
@@ -62,22 +60,15 @@ intel_free_texture_image_buffer(struct gl_context * ctx,
 
    DBG("%s\n", __FUNCTION__);
 
-   if (intelImage->mt) {
-      intel_miptree_release(intel, &intelImage->mt);
-   }
+   intel_miptree_release(intel, &intelImage->mt);
 
    if (texImage->Data) {
       _mesa_free_texmemory(texImage->Data);
       texImage->Data = NULL;
    }
 
-   if (intelImage->depth_rb) {
-      _mesa_reference_renderbuffer(&intelImage->depth_rb, NULL);
-   }
-
-   if (intelImage->stencil_rb) {
-      _mesa_reference_renderbuffer(&intelImage->stencil_rb, NULL);
-   }
+   _mesa_reference_renderbuffer(&intelImage->depth_rb, NULL);
+   _mesa_reference_renderbuffer(&intelImage->stencil_rb, NULL);
 }
 
 /**