Improved Shader:send performance by removing some temporary memory allocations.

This commit is contained in:
Alex Szpakowski
2016-02-20 19:24:33 -04:00
parent cf4b409302
commit ff91fa1327
2 changed files with 27 additions and 53 deletions
+13
View File
@@ -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;