[osg-users] RayTracedTechnique hangs with Intel HD Graphics - Update

Robert Osfield robert.osfield at gmail.com
Fri Sep 1 06:41:14 PDT 2017


HI Clement,

On 1 September 2017 at 10:26, <Clement.Chu at csiro.au> wrote:

>   Since I don't know how to debug or print message in shader code, I am
> not sure what exact value of vertex.  I guess the value of vertex is not in
> the range (0.0 to 1.0), so texture3D method cannot get correct color value
> by coordinate.  In file volume_frag.cpp,  variable texcoord is assigned
> from vertex data. If vertex data is not the 0.0f to 1.0f range, variable
> color (type vec4) will become strange value.  Even I added some codes
> to make sure values of color.x, color.y, color.z and color.w  in the range
> (0.0 to 1.0), it still cause the crash. Unless vertex is in the range (0.0
> to 1.0). So far, this problem occurs in Intel HD Graphics 520 or above.  My
> old laptop is Intel HD Graphics 3000, but it works fine and Nvidia cards
> work fine too.
>

Debugging shaders is *really* hard because you just can't put in break
points, print out values, do any of the normal debugging approaches we take
for granted on the desktop.  So it's a case of think of idea what might be
wrong, adapt the shaders to test that, run them app and just and make sense
of the results.

The fact that shaders can be loaded and compiled at runtime helps reduce
the time takes to see changes so this can help a bit, for yourself I would
certainly recommend copying the volume.vert and volume.frag shaders from
OpenSceneGraph-Data, put  them on your path as use in testing.

Another thing that might help if you are having to put "workaround" code in
just for a certain hardware vendor then the vendor string and #pragma(tic)
shader composition might be of help.  I use this facility to detect and
provide a workaround for an NVidia issue - look at how NVIDIA_Corporation
is used in the shaders.  The osg::State object checks the GL_VENDOR string
at runtime and sets a #define with this value that you can then reference
using #pragma import_defines(..).

I don't know what the string will be for Intel.  Run an OSG application
with the OSG_NOTIFY_LEVEL set to INFO and search the console output for a
"GL_VENDOR = " entry.  You can they use this in the shader mods.

--

On the specific issue of the vertex value clamping, RayTracedTechnique
creates a box with dimensons of 0,0,0 to 1,1,1 so there shouldn't be any
values outside this being passed to the vertex shader. However, the
CPU->driver->GPU might be changing the precision enough that you are
getting values outside this range.  I find it odd that the shaders would be
sensitive to such small precision issues though.

Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170901/b1d3df21/attachment.htm>


More information about the osg-users mailing list