freedreno: remove unnecessary null checks
authorRob Clark <robclark@freedesktop.org>
Fri, 23 Oct 2015 17:37:26 +0000 (13:37 -0400)
committerRob Clark <robclark@freedesktop.org>
Sat, 24 Oct 2015 16:38:33 +0000 (12:38 -0400)
According to piglit/xonotic/neverball/stc, blend/rasterize/zsa state
will always be bound (never null).  And the null checks were in-
consistent anyways, so remove them.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_draw.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a4xx/fd4_draw.c
src/gallium/drivers/freedreno/a4xx/fd4_emit.c

index a9498835011d65d4fbfeed2d609adbf64deaab07..3906c9b996ecca9053076d3eaf32b564b7b5d04a 100644 (file)
@@ -81,7 +81,7 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring,
        OUT_RING(ring, info->primitive_restart ? /* PC_RESTART_INDEX */
                        info->restart_index : 0xffffffff);
 
-       if (ctx->rasterizer && ctx->rasterizer->point_size_per_vertex &&
+       if (ctx->rasterizer->point_size_per_vertex &&
                        (info->mode == PIPE_PRIM_POINTS))
                primtype = DI_PT_POINTLIST_PSIZE;
 
@@ -137,7 +137,7 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
                .key = {
                        /* do binning pass first: */
                        .binning_pass = true,
-                       .color_two_side = ctx->rasterizer ? ctx->rasterizer->light_twoside : false,
+                       .color_two_side = ctx->rasterizer->light_twoside,
                        // TODO set .half_precision based on render target format,
                        // ie. float16 and smaller use half, float32 use full..
                        .half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF),
@@ -149,9 +149,9 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
                        .fsaturate_t = fd3_ctx->fsaturate_t,
                        .fsaturate_r = fd3_ctx->fsaturate_r,
                },
-               .rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade,
-               .sprite_coord_enable = ctx->rasterizer ? ctx->rasterizer->sprite_coord_enable : 0,
-               .sprite_coord_mode = ctx->rasterizer ? ctx->rasterizer->sprite_coord_mode : false,
+               .rasterflat = ctx->rasterizer->flatshade,
+               .sprite_coord_enable = ctx->rasterizer->sprite_coord_enable,
+               .sprite_coord_mode = ctx->rasterizer->sprite_coord_mode,
        };
        unsigned dirty;
 
index 411f5b76329fa4fbba1c768f5334d4a073082fab..8f9c8b0623cb798c02d747f581cb5341e2df915a 100644 (file)
@@ -627,7 +627,7 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
                ctx->prog.dirty = 0;
        }
 
-       if ((dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) && ctx->blend) {
+       if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) {
                struct fd3_blend_stateobj *blend = fd3_blend_stateobj(ctx->blend);
                uint32_t i;
 
index 025753c037e062de8076d3ddf01fef7aa43c0d42..7bd5163529a2173a99c3dd6aba35e2aa528294e5 100644 (file)
@@ -118,12 +118,12 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
                .key = {
                        /* do binning pass first: */
                        .binning_pass = true,
-                       .color_two_side = ctx->rasterizer ? ctx->rasterizer->light_twoside : false,
-                       .rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade,
+                       .color_two_side = ctx->rasterizer->light_twoside,
+                       .rasterflat = ctx->rasterizer->flatshade,
                        // TODO set .half_precision based on render target format,
                        // ie. float16 and smaller use half, float32 use full..
                        .half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF),
-                       .ucp_enables = ctx->rasterizer ? ctx->rasterizer->clip_plane_enable : 0,
+                       .ucp_enables = ctx->rasterizer->clip_plane_enable,
                        .has_per_samp = (fd4_ctx->fsaturate || fd4_ctx->vsaturate),
                        .vsaturate_s = fd4_ctx->vsaturate_s,
                        .vsaturate_t = fd4_ctx->vsaturate_t,
@@ -132,9 +132,9 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
                        .fsaturate_t = fd4_ctx->fsaturate_t,
                        .fsaturate_r = fd4_ctx->fsaturate_r,
                },
-               .rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade,
-               .sprite_coord_enable = ctx->rasterizer ? ctx->rasterizer->sprite_coord_enable : false,
-               .sprite_coord_mode = ctx->rasterizer ? ctx->rasterizer->sprite_coord_mode : false,
+               .rasterflat = ctx->rasterizer->flatshade,
+               .sprite_coord_enable = ctx->rasterizer->sprite_coord_enable,
+               .sprite_coord_mode = ctx->rasterizer->sprite_coord_mode,
        };
        unsigned dirty;
 
index c7ed1d2e379faeeeffc73b9851216e54137d77a9..cf5dd7b0f17ed8b3d4e3305c3e8ac8cae27f5abb 100644 (file)
@@ -594,7 +594,7 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
                ctx->prog.dirty = 0;
        }
 
-       if ((dirty & FD_DIRTY_BLEND) && ctx->blend) {
+       if ((dirty & FD_DIRTY_BLEND)) {
                struct fd4_blend_stateobj *blend = fd4_blend_stateobj(ctx->blend);
                uint32_t i;