mirror of
https://github.com/love2d/love.git
synced 2026-08-17 02:58:31 +02:00
Improved Shader:send performance by removing some temporary memory allocations.
This commit is contained in:
@@ -199,6 +199,17 @@ public:
|
||||
return program;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T *getScratchBuffer(size_t count)
|
||||
{
|
||||
size_t bytes = sizeof(T) * count;
|
||||
|
||||
if (scratchBuffer.size() < bytes)
|
||||
scratchBuffer.resize(bytes);
|
||||
|
||||
return (T *) scratchBuffer.data();
|
||||
}
|
||||
|
||||
static std::string getGLSLVersion();
|
||||
static bool isSupported();
|
||||
|
||||
@@ -276,6 +287,8 @@ private:
|
||||
|
||||
GLuint videoTextureUnits[3];
|
||||
|
||||
std::vector<char> scratchBuffer;
|
||||
|
||||
// Counts total number of textures bound to each texture unit in all shaders
|
||||
static std::vector<int> textureCounters;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user