gobj: devirtualize calls to GeomPatches::get_num_vertices_per_primitive()

This commit is contained in:
rdb 2024-10-17 16:18:12 +02:00
parent 61f8df2d7d
commit 7c9c4cd435
3 changed files with 4 additions and 17 deletions

View File

@ -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) {

View File

@ -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.
*/

View File

@ -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,