radv: Only save the descriptor set if we have one.
[mesa.git] / src / mesa / drivers / dri / nouveau / nv10_state_raster.c
index da414a0b06b84ac133035b0c8b92d4bc6a90d2a7..3f4ff73cef547879189616c4a301c292f6c8e672 100644 (file)
@@ -87,21 +87,22 @@ nv10_emit_color_mask(struct gl_context *ctx, int emit)
        struct nouveau_pushbuf *push = context_push(ctx);
 
        BEGIN_NV04(push, NV10_3D(COLOR_MASK), 1);
-       PUSH_DATA (push, ((ctx->Color.ColorMask[0][3] ? 1 << 24 : 0) |
-                       (ctx->Color.ColorMask[0][0] ? 1 << 16 : 0) |
-                       (ctx->Color.ColorMask[0][1] ? 1 << 8 : 0) |
-                       (ctx->Color.ColorMask[0][2] ? 1 << 0 : 0)));
+       PUSH_DATA (push, ((GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 3) ? 1 << 24 : 0) |
+                       (GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 0) ? 1 << 16 : 0) |
+                       (GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 1) ? 1 << 8 : 0) |
+                       (GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 2) ? 1 << 0 : 0)));
 }
 
 void
 nv10_emit_depth(struct gl_context *ctx, int emit)
 {
        struct nouveau_pushbuf *push = context_push(ctx);
+       struct gl_framebuffer *fb = ctx->DrawBuffer;
 
        BEGIN_NV04(push, NV10_3D(DEPTH_TEST_ENABLE), 1);
-       PUSH_DATAb(push, ctx->Depth.Test);
+       PUSH_DATAb(push, ctx->Depth.Test && fb->Visual.depthBits > 0);
        BEGIN_NV04(push, NV10_3D(DEPTH_WRITE_ENABLE), 1);
-       PUSH_DATAb(push, ctx->Depth.Mask);
+       PUSH_DATAb(push, ctx->Depth.Mask && fb->Visual.depthBits > 0);
        BEGIN_NV04(push, NV10_3D(DEPTH_FUNC), 1);
        PUSH_DATA (push, nvgl_comparison_op(ctx->Depth.Func));
 }
@@ -125,7 +126,7 @@ nv10_emit_logic_opcode(struct gl_context *ctx, int emit)
 
        BEGIN_NV04(push, NV11_3D(COLOR_LOGIC_OP_ENABLE), 2);
        PUSH_DATAb(push, ctx->Color.ColorLogicOpEnabled);
-       PUSH_DATA (push, nvgl_logicop_func(ctx->Color.LogicOp));
+       PUSH_DATA (push, ctx->Color.LogicOp);
 }
 
 void
@@ -144,7 +145,7 @@ nv10_emit_stencil_func(struct gl_context *ctx, int emit)
        struct nouveau_pushbuf *push = context_push(ctx);
 
        BEGIN_NV04(push, NV10_3D(STENCIL_ENABLE), 1);
-       PUSH_DATAb(push, ctx->Stencil.Enabled);
+       PUSH_DATAb(push, _mesa_stencil_is_enabled(ctx));
 
        BEGIN_NV04(push, NV10_3D(STENCIL_FUNC_FUNC), 3);
        PUSH_DATA (push, nvgl_comparison_op(ctx->Stencil.Function[0]));