mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
LibGL: Optimize appends in gl_vertex
Optimize a very hot function by always performing unchecked appends. When benchmarking 3DFileViewer on my machine, this takes the time spent in `gl_vertex` down from ~8% to ~2%.
This commit is contained in:
parent
edcb6176ce
commit
c978891dda
1 changed files with 4 additions and 1 deletions
|
@ -295,7 +295,10 @@ void GLContext::gl_vertex(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||||
vertex.tex_coords[i] = m_current_vertex_tex_coord[i];
|
vertex.tex_coords[i] = m_current_vertex_tex_coord[i];
|
||||||
vertex.normal = m_current_vertex_normal;
|
vertex.normal = m_current_vertex_normal;
|
||||||
|
|
||||||
m_vertex_list.append(vertex);
|
// Optimization: by pulling in the Vector size vs. capacity check, we can always perform an unchecked append
|
||||||
|
if (m_vertex_list.size() == m_vertex_list.capacity())
|
||||||
|
m_vertex_list.grow_capacity(m_vertex_list.size() + 1);
|
||||||
|
m_vertex_list.unchecked_append(vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLContext::gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
|
void GLContext::gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue