mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 21:30:19 -06:00
OGL: Track state of last bound vertex array object
This reduces the overhead of calling glBindVertexArray() every time RestoreAPIState() is called, even when it is redundant.
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
|
||||
#include "VideoBackends/OGL/ProgramShaderCache.h"
|
||||
#include "VideoBackends/OGL/RasterFont.h"
|
||||
#include "VideoBackends/OGL/VertexManager.h"
|
||||
|
||||
// globals
|
||||
|
||||
@ -181,6 +182,9 @@ RasterFont::RasterFont()
|
||||
glEnableVertexAttribArray(SHADER_TEXTURE0_ATTRIB);
|
||||
glVertexAttribPointer(SHADER_TEXTURE0_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat) * 4,
|
||||
(GLfloat*)nullptr + 2);
|
||||
glBindBuffer(GL_ARRAY_BUFFER,
|
||||
static_cast<VertexManager*>(g_vertex_manager.get())->GetVertexBufferHandle());
|
||||
ProgramShaderCache::InvalidateVertexFormat();
|
||||
}
|
||||
|
||||
RasterFont::~RasterFont()
|
||||
@ -278,5 +282,9 @@ void RasterFont::printMultilineText(const std::string& text, double start_x, dou
|
||||
GLfloat((color >> 8) & 0xff) / 255.f, GLfloat((color >> 0) & 0xff) / 255.f,
|
||||
GLfloat((color >> 24) & 0xff) / 255.f);
|
||||
glDrawArrays(GL_TRIANGLES, 0, usage / 4);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER,
|
||||
static_cast<VertexManager*>(g_vertex_manager.get())->GetVertexBufferHandle());
|
||||
ProgramShaderCache::InvalidateVertexFormat();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user