Hi all!

Attached is a patch that changes StatElemInt(Once) to use 64-bit integers
instead of 32-bits to accumulate the value.

Since we are now successfully rendering more than 2.1 GB of geometry (!),
the number of geometry bytes processed previously wrapped around to
negative in the statistics foreground.

We're pushing between 1-2 billion triangles per second on a single Nvidia
1080 GTX card.
(I think we may be getting double the amount due to how statistics work in
2.0 w.r.t the rendering setup they have here.  Still, it's quite a lot.)

These kind of problems are the fun kind of problems. :)

Cheers
/Marcus
-- 
Med vänliga hälsningar,
Marcus Lindblom Sonestedt
*Systemarkitekt*
*BIT ADDICT *- Passion för utveckling
+46 (0)706 43 63 28
marcus.lindblom.sonest...@bitaddict.se
www.bitaddict.se
Index: Source/Base/Statistics/OSGStatIntElem.cpp
===================================================================
diff --git 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.cpp
 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.cpp
--- 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.cpp
 (revision 6573)
+++ 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.cpp
 (working copy)
@@ -91,13 +91,13 @@
 {
     if(format.empty())
     {
-        FieldTraits<Int32>::putToString(_value, str);
+        FieldTraits<Int64>::putToString(_value, str);
     }
     else
     {
         std::string            formatCopy = format;
         std::string::size_type pos        = formatCopy.find("%");
-        Real32                 val        = _value;
+        Real64                 val        = _value;
         
         if(pos != std::string::npos)
         {
@@ -128,7 +128,7 @@
 
 bool StatIntElem::getFromCString(const Char8 *&inVal)
 {
-    return FieldTraits<Int32>::getFromCString(_value, inVal);
+    return FieldTraits<Int64>::getFromCString(_value, inVal);
 }
 
 Real64 StatIntElem::getValue(void) const
Index: Source/Base/Statistics/OSGStatIntElem.h
===================================================================
diff --git 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.h
 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.h
--- 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.h
   (revision 6573)
+++ 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.h
   (working copy)
@@ -71,11 +71,11 @@
     /*! \name                    instance                                  */
     /*! \{                                                                 */
    
-            void  set  (Int32 value);
-            Int32 get  (void       ) const;
+            void  set  (Int64 value);
+            Int64 get  (void       ) const;
     
-            void  add  (Int32 v    );
-            void  sub  (Int32 v    );
+            void  add  (Int64 v    );
+            void  sub  (Int64 v    );
     virtual void  reset(void       );
     
             void  inc  (void       );
@@ -134,7 +134,7 @@
 
     typedef StatElem Inherited;
    
-    Int32 _value;
+    Int64 _value;
 
     // prohibit default functions (move to 'public' if you need one)
     StatIntElem(const StatIntElem &source);
Index: Source/Base/Statistics/OSGStatIntElem.inl
===================================================================
diff --git 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.inl
 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.inl
--- 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.inl
 (revision 6573)
+++ 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntElem.inl
 (working copy)
@@ -39,25 +39,25 @@
 OSG_BEGIN_NAMESPACE
 
 inline 
-void StatIntElem::set(Int32 value) 
+void StatIntElem::set(Int64 value) 
 { 
     _value = value; 
 }
 
 inline 
-Int32 StatIntElem::get(void) const
+Int64 StatIntElem::get(void) const
 { 
     return _value; 
 }
 
 inline 
-void StatIntElem::add(Int32 v) 
+void StatIntElem::add(Int64 v) 
 { 
     _value += v; 
 }
     
 inline 
-void StatIntElem::sub(Int32 v) 
+void StatIntElem::sub(Int64 v) 
 { 
     _value -= v; 
 }
Index: Source/Base/Statistics/OSGStatIntOnceElem.cpp
===================================================================
diff --git 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.cpp
 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.cpp
--- 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.cpp
     (revision 6573)
+++ 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.cpp
     (working copy)
@@ -94,13 +94,13 @@
 {
     if(format.empty())
     {
-        FieldTraits<Int32>::putToString(_value, str);
+        FieldTraits<Int64>::putToString(_value, str);
     }
     else
     {
         std::string            formatCopy = format;
         std::string::size_type pos        = formatCopy.find("%");
-        Real32                 val        = _value;
+        Real64                 val        = _value;
         
         if(pos != std::string::npos)
         {
@@ -131,7 +131,7 @@
 
 bool StatIntOnceElem::getFromCString(const Char8 *&inVal)
 {
-    return FieldTraits<Int32>::getFromCString(_value, inVal);
+    return FieldTraits<Int64>::getFromCString(_value, inVal);
 }
 
 Real64 StatIntOnceElem::getValue(void) const
Index: Source/Base/Statistics/OSGStatIntOnceElem.h
===================================================================
diff --git 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.h
 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.h
--- 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.h
       (revision 6573)
+++ 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.h
       (working copy)
@@ -81,14 +81,14 @@
     virtual void  reset(void                );
 
             void  add  (UInt32 contributorId, 
-                         Int32 v            );
+                         Int64 v            );
             void  sub  (UInt32 contributorId, 
-                         Int32 v            );
+                         Int64 v            );
 
             void  inc  (UInt32 contributorId);
             void  dec  (UInt32 contributorId);
 
-            Int32 get  (void                ) const;
+            Int64 get  (void                ) const;
 
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
@@ -142,7 +142,7 @@
 
     typedef StatElem Inherited;
 
-    Int32   _value;
+    Int64   _value;
     
     IdHash  _ids;
 
Index: Source/Base/Statistics/OSGStatIntOnceElem.inl
===================================================================
diff --git 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.inl
 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.inl
--- 
a/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.inl
     (revision 6573)
+++ 
b/extlibs/branches/64bit/dist_src/opensg2/Source/Base/Statistics/OSGStatIntOnceElem.inl
     (working copy)
@@ -40,7 +40,7 @@
 
 
 inline 
-void StatIntOnceElem::add(UInt32 contributorId, Int32 v)
+void StatIntOnceElem::add(UInt32 contributorId, Int64 v)
 {
     if(_ids.find(contributorId) == _ids.end())
     {
@@ -50,7 +50,7 @@
 }
 
 inline 
-void StatIntOnceElem::sub(UInt32 contributorId, Int32 v)
+void StatIntOnceElem::sub(UInt32 contributorId, Int64 v)
 {
     if(_ids.find(contributorId) == _ids.end())
     {
@@ -80,7 +80,7 @@
 }
 
 inline 
-Int32 StatIntOnceElem::get() const
+Int64 StatIntOnceElem::get() const
 {
     return _value;
 }
------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to