svga: Only emit Z depth work if it is actually read
[mesa.git] / src / gallium / drivers / svga / svga_tgsi_insn.c
index ec1906eb6190905f5ca019adf03b0649acea9e84..e6ec5966eaa255197fc411b31cce3b224fdd0e26 100644 (file)
@@ -2550,7 +2550,7 @@ static boolean emit_ps_preamble( struct svga_shader_emitter *emit )
                return FALSE;
          }
       }
-   } else if (emit->ps_reads_pos) {
+   } else if (emit->ps_reads_pos && emit->info.reads_z) {
       /*
        * Assemble the position from various bits of inputs. Depth and W are
        * passed in a texcoord this is due to D3D's vPos not hold Z or W.
@@ -2579,7 +2579,7 @@ static boolean emit_ps_preamble( struct svga_shader_emitter *emit )
                        scalar( src(emit->ps_temp_pos), TGSI_SWIZZLE_W ) ))
          return FALSE;
    }
-   
+
    return TRUE;
 }