summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-03-04 23:44:39 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2011-03-04 23:46:20 +0100
commit98b418e56e9592cb796f2f814b3c8b46238d05af (patch)
tree5d329022582e58988ef3229ee3967fc02e761047 /src/gallium
parent22d9ae11bc436375a67752b90d8a5a273754d907 (diff)
i915g: use passthough shader for empty fragment programs
The hw doesn't like it - demos/shadowtex is broken. The emitted shader isn't totally empty though, the depth write fixup gets emitted instead. Maybe that one is somewhat fishy, too? Idea for this patch from Jakob Bornecrantz. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/i915/i915_fpc_translate.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index 9e20010c4a1..cd8219e1121 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -1174,15 +1174,27 @@ void
i915_translate_fragment_program( struct i915_context *i915,
struct i915_fragment_shader *fs)
{
- struct i915_fp_compile *p = i915_init_compile(i915, fs);
+ struct i915_fp_compile *p;
const struct tgsi_token *tokens = fs->state.tokens;
-
- i915_find_wpos_space(p);
+ struct tgsi_shader_info info;
#if 0
tgsi_dump(tokens, 0);
#endif
+ tgsi_scan_shader(tokens, &info);
+
+ /* 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 (info.num_instructions == 1) {
+ i915_use_passthrough_shader(fs);
+
+ return;
+ }
+
+ p = i915_init_compile(i915, fs);
+ i915_find_wpos_space(p);
+
i915_translate_instructions(p, tokens);
i915_fixup_depth_write(p);