zink: set ExecutionModeDepthReplacing when depth is written
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 15 Jul 2019 12:06:22 +0000 (14:06 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:46 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index 9683fb1416ff1221af684d88fd6e47484852fbde..26bcd90a0559cdbf83e52448fd44a4294b5db7f4 100644 (file)
@@ -1523,9 +1523,13 @@ nir_to_spirv(struct nir_shader *s)
    spirv_builder_emit_entry_point(&ctx.builder, exec_model, entry_point,
                                   "main", ctx.entry_ifaces,
                                   ctx.num_entry_ifaces);
-   if (s->info.stage == MESA_SHADER_FRAGMENT)
+   if (s->info.stage == MESA_SHADER_FRAGMENT) {
       spirv_builder_emit_exec_mode(&ctx.builder, entry_point,
                                    SpvExecutionModeOriginUpperLeft);
+      if (s->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
+         spirv_builder_emit_exec_mode(&ctx.builder, entry_point,
+                                      SpvExecutionModeDepthReplacing);
+   }
 
 
    spirv_builder_function(&ctx.builder, entry_point, type_void,