r600: add SET_NULL_SHADER macro.
authorDave Airlie <airlied@redhat.com>
Mon, 30 Nov 2015 01:20:05 +0000 (11:20 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 6 Dec 2015 23:58:59 +0000 (09:58 +1000)
This is used to set a hw shader to NULL.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_state_common.c

index 86579aa507b06abadfe31c03a97279c6d9b6a4e0..5d7c21022848f73e7075db8ccf68e06f8e9bf4a2 100644 (file)
@@ -1294,6 +1294,11 @@ static void r600_update_clip_state(struct r600_context *rctx,
                        return false;                                   \
        } while(0)
 
+#define SET_NULL_SHADER(hw) do {                                               \
+               if (rctx->hw_shader_stages[(hw)].shader)        \
+                       update_shader_atom(ctx, &rctx->hw_shader_stages[(hw)], NULL); \
+       } while (0)
+
 static bool r600_update_derived_state(struct r600_context *rctx)
 {
        struct pipe_context * ctx = (struct pipe_context*)rctx;
@@ -1346,8 +1351,8 @@ static bool r600_update_derived_state(struct r600_context *rctx)
                }
        } else {
                if (unlikely(rctx->hw_shader_stages[R600_HW_STAGE_GS].shader)) {
-                       update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_GS], NULL);
-                       update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_ES], NULL);
+                       SET_NULL_SHADER(R600_HW_STAGE_GS);
+                       SET_NULL_SHADER(R600_HW_STAGE_ES);
                        rctx->shader_stages.geom_enable = false;
                        r600_mark_atom_dirty(rctx, &rctx->shader_stages.atom);
                }