[Mesa-dev] [PATCH] glsl: fix lowering conditional returns in subroutines
Fabian Bieler
der.fabe at gmx.net
Wed Dec 1 05:52:22 PST 2010
Hello!
My last mail was misleading. The described behaviour (continue out of loop
etc.) occurs with mesa's current glsl compiler. The attached patch tries to
fix that.
I appologize for the faulty description and hope it was the cause for the lack
of feedback to my last mail.
I also attached two piglit tests to demonstrate the bug.
Fabian
On Friday 26 November 2010 02:09:31 Fabian Bieler wrote:
> Hello!
>
> This patch fixes a bug in the lower_jumps pass if lower_sub_return is set
> to true.
>
> Subroutines such as
>
> void sub() {
> for (int i = 0; i < 2; ++i) {
> if (i)
> return;
> }
> }
>
> a continue instruction is inserted outside of the loop.
>
> Subroutines such as
>
> void sub() {
> for (int j = 0; j < 2; ++j) {
> for (int i = 0; i < 2; ++i) {
> if (i)
> return;
> }
> }
> alter_some_global_variable();
> return;
> }
>
> get transformed to
>
> void sub() {
> bool return_flag = false;
> for (int j = 0; j < 2; ++j) {
> for (int i = 0; i < 2; ++i) {
> if (i) {
> return_flag = true;
> break;
> }
> }
> if (return_flag)
> break;
> }
> alter_some_global_variable();
> return;
> }
>
> Please review
>
> Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-glsl-fix-lowering-conditional-returns-in-subroutines.patch
Type: text/x-diff
Size: 1252 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20101201/8735db1a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glsl-fs-functions-5.shader_test
Type: text/x-objcsrc
Size: 337 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20101201/8735db1a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glsl-fs-functions-6.shader_test
Type: text/x-objcsrc
Size: 386 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20101201/8735db1a/attachment-0001.bin>
More information about the mesa-dev
mailing list