[Mesa-dev] [PATCH] glsl: fix lowering conditional returns in subroutines
Fabian Bieler
der.fabe at gmx.net
Thu Nov 25 17:09:31 PST 2010
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: 1260 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20101126/ca1fcb83/attachment.patch>
More information about the mesa-dev
mailing list