Re: Code doesn't run on amd/ati hardware

Tomasz WesoĊ‚owski <[email protected]> Tue, 15 Jan 2013 19:43:45 +0100
Newsgroups gmane.comp.python.opengl.user
Message-ID <CAHZNQesxdfsdDBn4RZF4vTaYRZcJbjOPf+a8HwxZRA75YZCyNg@mail.gmail.com>
On 15 January 2013 18:21, Mike C. Fletcher <[email protected]> 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

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net