r600/sfn: Add a forced output swizzle for depth write
authorGert Wollny <gert.wollny@collabora.com>
Sat, 18 Jul 2020 19:33:54 +0000 (21:33 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 20 Jul 2020 09:32:51 +0000 (09:32 +0000)
This makes sure no components are written that shouldn't be written.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5963>

src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp

index 850092ef8431d66bd496bec1157a18ad35ca884d..978d96277d13bc20cb120bb91ddd2f75151000b8 100644 (file)
@@ -701,6 +701,10 @@ bool FragmentShaderFromNir::emit_export_pixel(const nir_variable *out_var, nir_i
    std::array<uint32_t,4> swizzle;
    unsigned writemask = nir_intrinsic_write_mask(instr);
    switch (out_var->data.location) {
+   case FRAG_RESULT_DEPTH:
+      writemask = 1;
+      swizzle = {0,7,7,7};
+      break;
    case FRAG_RESULT_STENCIL:
       writemask = 2;
       swizzle = {7,0,7,7};