HI Michael,

The glDispatchCompute is called from with osg::Program, which is subclassed
from osg::StateAttribute and largely treated as a standard StateAttribute
by osg::State the tracks and applies OpenGL state.

I haven't tried compute shaders as my GL drivers don't yet support them,
but looking at the code in State::apply() that applies StateAttributes, it
looks like non texture StateAttrbitutes are applied first and then texture
attributes.  You could experiment with moving the code blocks for applying
the texture unit assocaites state attributes to before the non texture
state attributes to see if that address the issue.   The code is in
OpenSceneGraph/src/osg/State.cpp's State::apply() and
State::apply(StateAttribute*) methods.

Robert.


On 10 April 2013 14:14, Michael Bach Jensen <[email protected]> wrote:

> I have digged into this a little further and using glIntercept I learned
> that glDispatchCompute ends up being executed before the flowers texture
> has been bound.
>
> Adding a second quad to the scene with the flowers texture on texture unit
> 1 before the compute node fixes the problem, but is hardly ideal.
>
> Is OSG delaying texture switches until it sees actual geometry somehow? If
> that is the case, then some sort of check for compute shaders might need to
> be added so that texture attributes on the path to a compute program are
> executed before glDispatchCompute.
>
> Can someone perhaps point me in the right direction on how to fix this or
> maybe suggest a better solution?
>
> I am on 3.1.4, btw and it doesn't look like there have been any changes to
> compute shaders since its release.
>
> Cheers,
> Michael
>
> P.S.: I would like to use this for a histogram compute pass using Wang
> Rui's excellent EffectCompositor, which I have altered a bit to get compute
> shader support.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=53512#53512
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to