]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix logic with appending Batches
authorMikko Rasa <tdb@tdb.fi>
Thu, 30 Aug 2012 19:48:48 +0000 (22:48 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 30 Aug 2012 19:48:48 +0000 (22:48 +0300)
Allow combining Batches of any primitive type with NV_primitive_restart,
and don't use it if not necessary.

source/batch.cpp

index 785fca826ae30e5c9c524b0a2f08a242a2aad15f..d4b6497fc980bbab71bf9caf794302c26ec04014 100644 (file)
@@ -167,17 +167,15 @@ void Batch::append(const Batch &other)
 {
        if(other.prim_type!=prim_type)
                throw invalid_argument("Batch::append");
-       if(prim_type==LINE_STRIP || prim_type==LINE_LOOP)
-               throw incompatible_data("Batch::append");
-       else if(prim_type==POLYGON)
-               throw incompatible_data("Batch::append");
-       else if(prim_type==TRIANGLE_FAN)
+       if(prim_type==LINE_STRIP || prim_type==LINE_LOOP || prim_type==TRIANGLE_FAN || prim_type==POLYGON)
                static Require _req(NV_primitive_restart);
 
        if(other.data.empty())
                return;
 
-       if(NV_primitive_restart)
+       if(prim_type==POINTS || prim_type==LINES || prim_type==TRIANGLES || prim_type==QUADS)
+               ;
+       else if(NV_primitive_restart)
        {
                restart = true;
                if(data_type==UNSIGNED_SHORT)