[osg-users] [Compute Program executed on useprogram :/?!]

Robert Osfield robert.osfield at gmail.com
Sat Nov 18 03:34:51 PST 2017


Hi Julien,

The Compute shader work is a submission I merged from the community, I
clearly didn't think deeply enough about the submission when I merged
it though, as in hindisight having the glDispatchCompute directly
coupled with the useProgram is wrong - on several different counts.

The correct way to do it would be to have some explictly mechanism for
calling the dispatch compute, either as a draw callback as you later
suggest, or as a osg::Drawable or osg::StateAttribute it it's own
right.  I will need to reflect more on the issue but my first thought
is that glDispatchCompute is a bit similar to glDrawArrays/Elements in
that it's the point when you have stopped configure state (input data)
and now want to GPU to do some direct work.   Given this similarity a
drawable association or some kind seems most appropriate.  It might be
the the numGroupsX,Y and Z should be moved out of osg::Program as well
- which pushes us towards having a dedicated osg::DispatchCompute
class.

Robert.

On 18 November 2017 at 01:31, Julien Valentin
<julienvalentin51 at gmail.com> wrote:
> Hi all
> I ran into some strange behavior debuging an app: It appears that compute shader are executed at each pcp.useprogram() call...
> I don't think it's a correct behavior since uniforms requires the po to be bound before to be set...
> It yield an undefined behavior in GLObjectVisitor when compute prog are executed whithout their uniforms setted  (and the same problem should also appears in State::apply)
>
> I'm gonna pr a patch in order remove dispatchprogram from useprogram and add a if(computeshader)dispatch at the end of state::apply but would like Robert insight about it
>
> Thank you!
>
> Cheers,
> Julien
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72404#72404
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list