Re: [AD] shader addon

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2011-02-12, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> On 2011-02-11, at 9:43 PM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> > - GL allows multiple shader objects of the same type to be attached to
> >  the one program.  I think we should allow the same.
> >  But the other backends may be a consideration(?)
> 
> Not sure whether that's equivalent to multiple techniques or multiple passes in HLSL.

Neither, I think.  A shader object is a compilation unit, like a single
object file.  One or more are linked to be a complete program.

You can share a single shader object among multiple programs, and I
guess that's where the benefit lies.  It's comparatively pointless to
just allow al_attach_shader_source to attach multiple snippets of code
to a program.

We actually could automatically share shader objects between programs,
without making the interface more complicated.  Internally, we'd
remember the source code passed previously to al_attach_shader_source.
If the current call matches a previous call, we can reuse an existing
shader object instead of creating a new one and recompiling the code.

For the other backends we could just not support attaching multiple
snippets (the shader languages are different anyway).  Or we could
concatenate all the source and defer compiling until al_link_shader.

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/