Hi Laurens,

You missed adding your file, but I can guess given the description.  I'm
not clear on the portability of LL as well.  How about the following -
using a GLuint64 one variable?

diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp
index 53c9abf..dc8069c 100644
--- a/src/osgViewer/Renderer.cpp
+++ b/src/osgViewer/Renderer.cpp
@@ -228,11 +228,12 @@ void ARBQuerySupport::checkQuery(osg::Stats* stats,
osg::State* state,
                 // If the high bits on any of the timestamp bits are
                 // different then the counters may have wrapped.
                 const int hiShift = (tbits - 1);
-                const GLuint64 hiMask = 1 << hiShift;
+                const GLuint64 one = 1;
+                const GLuint64 hiMask = one << hiShift;
                 const GLuint64 sum = (beginTimestamp >> hiShift)
                     + (endTimestamp >> hiShift) + (gpuTimestamp >>
hiShift);
                 if (sum == 1 || sum == 2) {
-                    const GLuint64 wrapAdd = 1 << tbits;
+                    const GLuint64 wrapAdd = one << tbits;
                     // Counter wrapped between begin and end?
                     if (beginTimestamp > endTimestamp)
                     {

It's a bit hacky and may even generate a warning.  Thoughts?

Robert.



On 16 February 2016 at 13:38, Voerman, L. <[email protected]> wrote:

> Hi Robert,
> A warning from visual studio 2015 points at an actual (minor) bug:
> Renderer.cpp(231):const GLuint64 hiMask = 1 << hiShift;
> Renderer.cpp(235):const GLuint64 wrapAdd = 1 << tbits; // <- this will
> fail if tbits is 32, because "1" is an __int32
>
> every ~4.3 seconds a 32 bit gpu timestamp will procuce invalid statistics.
> Aparently you had a driver/hardware combo in 2010 with a 32 bit timer
> query, not sure if that still exists.
> Bug and bugfix tested with both VS2013 and gcc , but I am not sure about
> the portability of the LL suffix. a cast to GLuint64 would work too.
>
> attached Renderer.zip contains a bugfix ( 1LL instead of 1 )
> modified file: OpenSceneGraph\src\osgViewer\Renderer.cpp
> this file is only for the current git head. (file has other changes after
> 3.4 branch).
>
> OpenSceneGraph\src\osgViewer\Renderer.cpp(231): warning C4334: '<<':
> result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift
> intended?)
> OpenSceneGraph\src\osgViewer\Renderer.cpp(235): warning C4334: '<<':
> result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift
> intended?)
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to