[Mesa-dev] [PATCH 7/7] i965: Remove redundant test for NULL intel_texture_object
Ian Romanick
idr at freedesktop.org
Wed Sep 9 10:56:53 PDT 2015
On 09/09/2015 06:39 AM, Chris Wilson wrote:
> Having checked whether the base class (gl_texture_object) is NULL, we
> know that intel_texture_object itself cannot be NULL.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: Francisco Jerez <currojerez at riseup.net>
> ---
> src/mesa/drivers/dri/i965/brw_draw.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> index 0ffcc24..3cea331 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -346,7 +346,6 @@ static void
> brw_draw_resolve(struct gl_context *ctx)
> {
> struct brw_context *brw = brw_context(ctx);
> - struct intel_texture_object *tex_obj;
> struct intel_renderbuffer *depth_irb;
>
> /* Resolve the depth buffer's HiZ buffer. */
> @@ -358,11 +357,15 @@ brw_draw_resolve(struct gl_context *ctx)
> if (brw->NewGLState & _NEW_TEXTURE) {
> int maxEnabledUnit = brw->ctx.Texture._MaxEnabledTexImageUnit;
> for (int i = 0; i <= maxEnabledUnit; i++) {
> + struct intel_texture_object *tex_obj;
> +
> if (!brw->ctx.Texture.Unit[i]._Current)
> continue;
> +
> tex_obj = intel_texture_object(brw->ctx.Texture.Unit[i]._Current);
I'd be in favor of some form of combining the assignment and the
declaration. Either move the declaration down here, or move the
assignment above. If you choose the latter, the if-statement below
could remain unchanged while the if-statement above is just removed...
since intel_texture_object is just a cast.
> - if (!tex_obj || !tex_obj->mt)
> + if (!tex_obj->mt)
> continue;
> +
> intel_miptree_all_slices_resolve_depth(brw, tex_obj->mt);
> intel_miptree_resolve_color(brw, tex_obj->mt);
> brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
>
More information about the mesa-dev
mailing list