lima/ppir: validate shader outputs
authorVasily Khoruzhick <anarsoul@gmail.com>
Fri, 23 Aug 2019 04:17:23 +0000 (21:17 -0700)
committerVasily Khoruzhick <anarsoul@gmail.com>
Sat, 24 Aug 2019 15:17:25 +0000 (08:17 -0700)
Mali4x0 supports only gl_FragColor. gl_FragDepth is not supported.
Check that we don't get anything but gl_FragColor in shader outputs.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
src/gallium/drivers/lima/ir/pp/nir.c

index 75a09f0d441549bd79b8c92d3eaf9fb4cb79e734..831c50b3cd039e4a7d872735daff70272e09edd1 100644 (file)
@@ -699,6 +699,19 @@ bool ppir_compile_nir(struct lima_fs_shader_state *prog, struct nir_shader *nir,
       }
    }
 
+   /* Validate outputs, we support only gl_FragColor */
+   nir_foreach_variable(var, &nir->outputs) {
+      switch (var->data.location) {
+      case FRAG_RESULT_COLOR:
+      case FRAG_RESULT_DATA0:
+         break;
+      default:
+         ppir_error("unsupported output type\n");
+         goto err_out0;
+         break;
+      }
+   }
+
    foreach_list_typed(nir_register, reg, node, &func->registers) {
       ppir_reg *r = rzalloc(comp, ppir_reg);
       if (!r)