Browse Source

gobj: devirtualize calls to GeomPatches::get_num_vertices_per_primitive()

rdb 1 year ago
parent
commit
7c9c4cd435

+ 1 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -5707,7 +5707,7 @@ draw_patches(const GeomPrimitivePipelineReader *reader, bool force) {
   }
 
 #ifndef OPENGLES
-  _glPatchParameteri(GL_PATCH_VERTICES, reader->get_object()->get_num_vertices_per_primitive());
+  _glPatchParameteri(GL_PATCH_VERTICES, ((const GeomPatches *)reader->get_object())->get_num_vertices_per_primitive());
 
 #ifdef SUPPORT_IMMEDIATE_MODE
   if (_use_sender) {

+ 0 - 15
panda/src/gobj/geomPatches.cxx

@@ -71,21 +71,6 @@ get_primitive_type() const {
   return PT_patches;
 }
 
-/**
- * If the primitive type is a simple type in which all primitives have the
- * same number of vertices, like patches, returns the number of vertices per
- * primitive.  If the primitive type is a more complex type in which different
- * primitives might have different numbers of vertices, for instance a
- * triangle strip, returns 0.
- *
- * In the case of GeomPatches, this returns the fixed number that was
- * specified to the constructor.
- */
-int GeomPatches::
-get_num_vertices_per_primitive() const {
-  return _num_vertices_per_patch;
-}
-
 /**
  * Calls the appropriate method on the GSG to draw the primitive.
  */

+ 3 - 1
panda/src/gobj/geomPatches.h

@@ -32,7 +32,9 @@ public:
   virtual PT(GeomPrimitive) make_copy() const;
   virtual PrimitiveType get_primitive_type() const;
 
-  virtual int get_num_vertices_per_primitive() const;
+  virtual int get_num_vertices_per_primitive() const final {
+    return _num_vertices_per_patch;
+  }
 
 public:
   virtual bool draw(GraphicsStateGuardianBase *gsg,