nir: allow nir_lower_clip_halfz to run in geometry shaders
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 8 Jul 2020 16:43:23 +0000 (12:43 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sat, 11 Jul 2020 07:32:25 +0000 (07:32 +0000)
the final output of gl_Position needs this transform, and geometry shaders
must write this value for stream 0 if rasterization is enabled

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5851>

src/compiler/nir/nir_lower_clip_halfz.c

index 13b7a5b8f1e85a790c3487e71e9ed1690ac296f9..6db1910362f6616fa1fdff7252cc8d0ac1a689f3 100644 (file)
@@ -56,7 +56,8 @@ lower_pos_write(nir_builder *b, struct nir_instr *instr)
 void
 nir_lower_clip_halfz(nir_shader *shader)
 {
-   if (shader->info.stage != MESA_SHADER_VERTEX)
+   if (shader->info.stage != MESA_SHADER_VERTEX &&
+       shader->info.stage != MESA_SHADER_GEOMETRY)
       return;
 
    nir_foreach_function(function, shader) {