i915g: Use the normal compile error path for empty FSes.
authorEmma Anholt <emma@anholt.net>
Sun, 27 Jun 2021 21:10:47 +0000 (14:10 -0700)
committerEmma Anholt <emma@anholt.net>
Mon, 28 Jun 2021 22:01:37 +0000 (15:01 -0700)
This means they'll get dumped and you'll see the passthrough FS.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11617>

src/gallium/drivers/i915/i915_fpc_translate.c

index 5bfbbc8..9f385b7 100644 (file)
@@ -985,6 +985,13 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
    if (p->nr_decl_insn > I915_MAX_DECL_INSN)
       i915_program_error(p, "Exceeded max DECL instructions");
 
+   /* hw doesn't seem to like empty frag programs (num_instructions == 1 is just
+    * TGSI_END), even when the depth write fixup gets emitted below - maybe that
+    * one is fishy, too?
+    */
+   if (ifs->info.num_instructions == 1)
+      i915_program_error(p, "Empty fragment shader");
+
    if (p->error) {
       p->NumNativeInstructions = 0;
       p->NumNativeAluInstructions = 0;
@@ -1053,14 +1060,6 @@ i915_translate_fragment_program(struct i915_context *i915,
       tgsi_dump(tokens, 0);
    }
 
-   /* hw doesn't seem to like empty frag programs, even when the depth write
-    * fixup gets emitted below - may that one is fishy, too? */
-   if (fs->info.num_instructions == 1) {
-      i915_use_passthrough_shader(fs);
-
-      return;
-   }
-
    p = i915_init_compile(i915, fs);
 
    i_tokens = i915_optimize(tokens);