Re: [PyOpenGL-Users] Code doesn't run on amd/ati hardware
Brought to you by:
mcfletch
|
From: Tomasz W. <ko...@gm...> - 2013-01-15 18:44:24
|
On 15 January 2013 18:21, Mike C. Fletcher <mcf...@vr...> wrote:
> My understanding is that implementations are free to parse each element
> within the set as a separate set of statements, while some
> implementations decide to concat the whole and then parse it. Thus some
> implementations (Intel) will accept a shader which is passed as a string
> (which gets turned into N single-character strings), while others (ATI)
> demand that each fragment be a valid set of statements in GLSL.
Hmm. I have written a script to check that and I confirm that AMD is
also okay with keeping statements (or even tokens) span through
several shader strings.
I remembered that supplying source lines as separate shader strings is
useful because the lines end up being displayed in compilation error
messages - an important trait if you want good diagnostics.
Interestingly, that's not exactly the case now. On AMD the syntax looks like...
Separate strings:
ERROR: 4:1: error(#143) Undeclared identifier: three
One string:
ERROR: 0:5: error(#143) Undeclared identifier: three
So the error location appears to be in format "A:B", where A is
zero-based string index and B is one-based line number in a given
string (w/r/t newline characters in it).
If this kind of behaviour is consistent across drivers, then indeed
there's no benefit at all to splitting source into lines.
Additionally, I also haven't found any reference at all to semantic
meaning of "shader strings" as accepted by glShaderSource, or
specifically to their relation to lines of code.
Please go ahead and tinker with my code here:
https://gist.github.com/4540890 . I'm very interested how Nvidia and
Intel format the error locations.
Regards,
-- Kos
|