Go to bottom

ATI, glCompileShader and raymarching uber-shader

category: code [glöplog]
Maybe check your file encoding too, ANSI vs. UTF-8 (BOM, no-BOM @ start) etc. I've had some problems with that...
added on the 2012-08-03 17:26:39 by raer raer
Suddenly I got this. And this sucks.

> ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4() Unknown
ntdll.dll!_RtlpLogHeapFailure@24() Unknown
ntdll.dll!_RtlpCoalesceFreeBlocks@16() Unknown
ntdll.dll!@RtlpFreeHeap@16() Unknown
ntdll.dll!_RtlFreeHeap@12() Unknown
ntdll.dll!_RtlDebugFreeHeap@12() Unknown
ntdll.dll!@RtlpFreeHeap@16() Unknown
ntdll.dll!_RtlFreeHeap@12() Unknown
atioglxx.dll!69f5f2a9() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for atioglxx.dll]
atioglxx.dll!69b3a31c() Unknown
atioglxx.dll!69b3a31c() Unknown
atioglxx.dll!69b3a31c() Unknown
atioglxx.dll!69b35c29() Unknown
atioglxx.dll!69b2e351() Unknown
atioglxx.dll!69b2f44b() Unknown
atioglxx.dll!69a9dccc() Unknown
atioglxx.dll!69a9d98c() Unknown
atioglxx.dll!69b31e5b() Unknown
atioglxx.dll!69b315dd() Unknown
kernel32.dll!@BaseThreadInitThunk@12() Unknown
ntdll.dll!___RtlUserThreadStart@8() Unknown
ntdll.dll!__RtlUserThreadStart@8() Unknown
added on the 2012-08-06 14:41:33 by xTr1m xTr1m
After some time of debugging together with las (thanks a lot!) he found out the problem... ATI's compiler dislikes the comma operator.

Consider this:
Code:return n.xy+=p,max(0,foo);
You'd expect that it first executes
and then
Code:return max(0,foo);
But no! It just fucks the entire heap up and takes some years off your life.

And Ctrl+Alt+Test's Shader Minifier does exactly that kind of optimization. Some statements are rewriten so that it becomes a single
Code:return a,b,c,d,e;
line. Can someone please contact LLB and tell him to offer a switch to toggle this return-statement-rewriting optimization off? That'd be most kind!
added on the 2012-08-06 15:56:33 by xTr1m xTr1m
wasn't the order of operations separated by the comma op not specified anyhow?
(compiler can shuffle these around at will)
added on the 2012-08-06 18:10:00 by toxie toxie
Nope - it's specified ("sequence (,) operator") - from left to right, returning the value of the right-most expression. (See GLSL 4.2 Spec, pdf page 87, 5.9).

Actually I failed creating a "minimal reproducer" - shader up to now. The thing happens under certain circumstances - not 100% sure what exactly causes it - but without the sequence operator the problem is gone.
added on the 2012-08-06 18:23:46 by las las
Even if the order was not specified, a compiler should not simply crash. We had the same problem on last years Evoke. The intro on ATI sometimes crashed, sometimes showed garbled graphics and sometimes worked correctly.
added on the 2012-08-06 18:33:07 by TGGC TGGC
from reading the topic i could have sworn its about the "optimizing" of the shaderCompiler itself
1.) used too many registers, maybe due to 2.)
2.) unrolling loops, not being able to exactly set any amounts.

good you got it sorted! always like to have good entries at evoke! mine is a fastshot, so your chances to win are pretty good right now! :)
Thanks for sharing the outcome of the debugging session.
added on the 2012-08-07 07:40:42 by p01 p01
Sharing is caring :) Thanks :)
added on the 2012-08-07 08:36:13 by kbi kbi
I never compile a shader with opengl. I can't help. I've made my own shader compiler.
added on the 2012-08-07 10:15:28 by Bartoshe Bartoshe


Go to top