[Mesa-dev] [PATCH 2/3] glsl/builtins: Support stage-agnostic built-in profiles.
eric at anholt.net
Tue Apr 17 12:46:54 PDT 2012
On Tue, 17 Apr 2012 11:45:20 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
> The built-in subsystem uses "profiles," or GLSL shaders containing
> prototypes for all built-ins supported within a particular language
> version (or extension) and shader stage.
> Since profiles were stage-specific, we had to cut and paste almost all
> the prototypes between (e.g.) 110.vert and 110.frag. Naturally, this
> led to sundry cut and paste bugs, where someone fixed an issue in .frag
> but neglected to update .vert, or vice-versa. Geometry shaders would
> have only made this worse.
> This patch introduces support for a new '.glsl' profile suffix which
> contains prototypes common to all shader stages. The existing '.frag'
> and '.vert' profiles need only contain the few stage-specific built-ins.
> Not only does this remove duplication, it makes built-in setup slightly
> faster: we don't need to re-read the common prototypes and function
> bodies for both the vertex and fragment shader stage.
> Internally, this was trivial. We already create a list of gl_shader
> objects to search through for built-ins: one for the core language
> version/stage, and additional shaders for any extensions in use. This
> patch simply adds another shader to the list: core/common, core/stage,
> and extensions.
> The next patch will update the profiles to remove the duplication.
> It's separated out purely to make review easier.
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
I like this a lot. It seems like a small change with a big win.
I haven't done a line-by-line review of the profiles changes, but I
looked for some likely copy-and-paste bugs and didn't find them. So,
the series is:
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the mesa-dev