diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-02-23 16:17:17 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-02-23 16:17:17 -0700 |
commit | 012391357fcbefd2b34e999eed91a129d5efd77c (patch) | |
tree | 2d2e639aeb24923af9108bb56daaf8356155d378 /src/gallium/drivers/softpipe/sp_state_fs.c | |
parent | 35ca45daba3906ac94fb879d2374d476ba2dac47 (diff) |
gallium: disable early Z test if fragment shader contains KIL instruction.
Use tgsi_scan_shader() to determine if the fragment shader uses KIL or
writes fragment.z
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_fs.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_fs.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index b0238f8173..b184ac61bb 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -36,6 +36,7 @@ #include "pipe/p_shader_tokens.h" #include "draw/draw_context.h" #include "tgsi/util/tgsi_dump.h" +#include "tgsi/util/tgsi_scan.h" void * @@ -44,21 +45,24 @@ softpipe_create_fs_state(struct pipe_context *pipe, { struct softpipe_context *softpipe = softpipe_context(pipe); struct sp_fragment_shader *state; + struct tgsi_shader_info info; + + tgsi_scan_shader(templ->tokens, &info); if (softpipe->dump_fs) tgsi_dump(templ->tokens, 0); state = softpipe_create_fs_llvm( softpipe, templ ); - if (state) - return state; - - state = softpipe_create_fs_sse( softpipe, templ ); - if (state) - return state; - - state = softpipe_create_fs_exec( softpipe, templ ); - + if (!state) { + state = softpipe_create_fs_sse( softpipe, templ ); + if (!state) { + state = softpipe_create_fs_exec( softpipe, templ ); + } + } assert(state); + state->uses_kill = (info.opcode_count[TGSI_OPCODE_KIL] || + info.opcode_count[TGSI_OPCODE_KILP]); + state->writes_z = info.writes_z; return state; } |