radeonsi/nir: add depth layout to scan pass
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 9 Feb 2018 10:09:35 +0000 (21:09 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 9 Feb 2018 23:46:28 +0000 (10:46 +1100)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeonsi/si_shader_nir.c

index 04d07381f5dd9434a11028e55eab28f4283882b8..f467ce282af8a4aa5cecf973d73f1487273f234e 100644 (file)
@@ -279,6 +279,25 @@ void si_nir_scan_shader(const struct nir_shader *nir,
        if (nir->info.stage == MESA_SHADER_FRAGMENT) {
                info->properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL] = nir->info.fs.early_fragment_tests;
                info->properties[TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE] = nir->info.fs.post_depth_coverage;
+
+               if (nir->info.fs.depth_layout != FRAG_DEPTH_LAYOUT_NONE) {
+                       switch (nir->info.fs.depth_layout) {
+                       case FRAG_DEPTH_LAYOUT_ANY:
+                               info->properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT] = TGSI_FS_DEPTH_LAYOUT_ANY;
+                               break;
+                       case FRAG_DEPTH_LAYOUT_GREATER:
+                               info->properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT] = TGSI_FS_DEPTH_LAYOUT_GREATER;
+                               break;
+                       case FRAG_DEPTH_LAYOUT_LESS:
+                               info->properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT] = TGSI_FS_DEPTH_LAYOUT_LESS;
+                               break;
+                       case FRAG_DEPTH_LAYOUT_UNCHANGED:
+                               info->properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT] = TGSI_FS_DEPTH_LAYOUT_UNCHANGED;
+                               break;
+                       default:
+                               unreachable("Unknow depth layout");
+                       }
+               }
        }
 
        if (nir->info.stage == MESA_SHADER_COMPUTE) {