From b1e709384bf43f48a704841ce3f7f783c6f9339e Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 7 May 2026 15:45:38 -0400 Subject: [PATCH] i915: emit passthrough for empty TGSI fragment shaders The TGSI compiler rejected empty fragment shaders (num_instructions == 1, just TGSI_END) as errors. Instead, emit a passthrough program. Assisted-by: Claude --- src/gallium/drivers/i915/i915_fpc_translate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index f07095ee110..ba6f6172e85 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -1006,12 +1006,11 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) p->nr_decl_insn, I915_MAX_DECL_INSN); } - /* 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 (ifs->info.num_instructions == 1) { + i915_use_passthrough_shader(ifs); + ifs->nr_alu_insn = 1; + goto done; + } if (strlen(p->error) != 0) { i915_use_passthrough_shader(ifs); @@ -1042,6 +1041,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) } } +done: if (strlen(p->error) != 0) ifs->error = p->error; else