On 09/08/2013 08:48 AM, Paul Berry wrote:
On 4 September 2013 15:22, Kenneth Graunke <kenn...@whitecape.org
<mailto:kenn...@whitecape.org>> wrote:

    During compilation, we'll use this to determine built-in availability.
    All the prototypes will be available, but we can filter out the ones
    that aren't actually available.


I'm having trouble understanding this sentence because it sounds like
you're using the word "available" to mean two different things.  Do you
perhaps mean something like "when looking up the name of a built-in
function, we'll iterate through a list of all the prototypes that exist
in all GLSL versions and extensions, but we'll filter out the ones that
aren't actually available in the current GLSL version with the currently
enabled extensions"?

Poor wording on my part; your understanding is basically correct.

I've replaced it with this text:
"The plan is to have a single shader containing every built-in in every
version of the language, but filter out the ones that aren't actually
available to the shader being compiled."

    At link time, we don't actually need this filtering capability, since
    we've already imported the prototypes and flagged them as "is_builtin."


This sentence tripped me up a bit since the last patch removed the
"is_builtin" flag in favor of a function.  Do you mean to say that we've
already imported the prototypes and given them a non-null builtin_info
(so is_builtin() will return true)?

By "is_builtin flag" I meant "the value of the is_builtin() method."


    The linker won't import additional prototypes, so it won't pull in any
    unavailable built-ins.  Conversely, the is_builtin flag will prevent a
    shader from defining its own prototype and fooling the linker to import
    a built-in's body.


Similarly, in this case do you mean "conversely, prototypes defined by
the shader will have builtin_info = null, so they will return false for
is_builtin() and that will prevent the linker from trying to import a
built-in's body for those functions"?

      All that to say: we can just pass in NULL.  It'll be
    fine.

Yes.  I've replaced this text with:

"At link time, we don't actually need this filtering capability: we've
already imported prototypes for every built-in that the shader actually
calls, and they're flagged as is_builtin().  The linker doesn't import
any additional prototypes, so it won't pull in any unavailable
built-ins.  When resolving prototypes to function definitions, the
linker ensures the values of is_builtin() match, which means that a
shader can't trick the linker into importing the body of an unavailable
built-in by defining a suspiciously similar prototype.

In other words, during linking, we can just pass in NULL.  It will work
out fine."
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to