mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Prevent redundant glBindBuffer calls.
--HG-- branch : minor
This commit is contained in:
@@ -69,6 +69,13 @@ enum VertexAttribFlags
|
||||
ATTRIBFLAG_CONSTANTCOLOR = 1 << ATTRIB_CONSTANTCOLOR
|
||||
};
|
||||
|
||||
enum BufferType
|
||||
{
|
||||
BUFFER_VERTEX = 0,
|
||||
BUFFER_INDEX,
|
||||
BUFFER_MAX_ENUM
|
||||
};
|
||||
|
||||
/**
|
||||
* Thin layer between OpenGL and the rest of the program.
|
||||
* Internally shadows some OpenGL context state for improved efficiency and
|
||||
@@ -243,6 +250,18 @@ public:
|
||||
**/
|
||||
void prepareDraw();
|
||||
|
||||
/**
|
||||
* State-tracked glBindBuffer.
|
||||
* NOTE: This does not account for multiple VAOs being used! Index buffer
|
||||
* bindings are per-VAO in OpenGL, but this doesn't know about that.
|
||||
**/
|
||||
void bindBuffer(BufferType type, GLuint buffer);
|
||||
|
||||
/**
|
||||
* glDeleteBuffers which updates our shadowed state.
|
||||
**/
|
||||
void deleteBuffer(GLuint buffer);
|
||||
|
||||
/**
|
||||
* glDrawArrays and glDrawElements which increment the draw-call counter by
|
||||
* themselves.
|
||||
@@ -396,6 +415,9 @@ public:
|
||||
**/
|
||||
Vendor getVendor() const;
|
||||
|
||||
static GLenum getGLBufferType(BufferType type);
|
||||
static GLint getGLWrapMode(Texture::WrapMode wmode);
|
||||
|
||||
static const char *errorString(GLenum errorcode);
|
||||
|
||||
// Get human-readable strings for debug info.
|
||||
@@ -411,8 +433,6 @@ private:
|
||||
void initMatrices();
|
||||
void createDefaultTexture();
|
||||
|
||||
GLint getGLWrapMode(Texture::WrapMode wmode);
|
||||
|
||||
bool contextInitialized;
|
||||
|
||||
float maxAnisotropy;
|
||||
@@ -427,6 +447,8 @@ private:
|
||||
// Tracked OpenGL state.
|
||||
struct
|
||||
{
|
||||
GLuint boundBuffers[BUFFER_MAX_ENUM];
|
||||
|
||||
// Texture unit state (currently bound texture for each texture unit.)
|
||||
std::vector<GLuint> boundTextures;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user