[Mesa-dev] [Bug 62357] llvmpipe: Fragment Shader with "return" in main causes back output

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Mar 15 11:17:35 PDT 2013


--- Comment #8 from Roland Scheidegger <sroland at vmware.com> ---
Looks like we unconditionally return when we see a return not in a function.
Some trivial attempt at fixing that seems to work but I'm not quite sure if
it's right or if we need to do more.

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 0dc26b5..e56bb62 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -348,7 +348,8 @@ static void lp_exec_mask_ret(struct lp_exec_mask *mask, int
    LLVMBuilderRef builder = mask->bld->gallivm->builder;
    LLVMValueRef exec_mask;

-   if (mask->call_stack_size == 0) {
+   if (mask->call_stack_size == 0 &&
+       mask->cond_stack_size == 0) {
       /* returning from main() */
       *pc = -1;

I guess might also need to check loop_stack_size too (could have a loop which
never executes).

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130315/b2ce020f/attachment.html>

More information about the mesa-dev mailing list