mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
minor cleanup and fixes
This commit is contained in:
@@ -122,7 +122,7 @@ GLuint ShaderEffect::createShader(const ShaderSource &source)
|
||||
|
||||
if (err == GL_INVALID_OPERATION) // should only happen between glBegin() and glEnd()
|
||||
throw love::Exception("Cannot create %s shader object.", shadertypename);
|
||||
else if (err == GL_INVALID_ENUM)
|
||||
else if (err == GL_INVALID_ENUM) // invalid or unsupported shader type
|
||||
throw love::Exception("Cannot create %s shader object: %s shaders not supported.", shadertypename, shadertypename);
|
||||
}
|
||||
|
||||
@@ -189,9 +189,9 @@ bool ShaderEffect::loadVolatile()
|
||||
|
||||
std::vector<GLuint> shaderids;
|
||||
|
||||
std::vector<ShaderSource>::const_iterator cursource;
|
||||
for (cursource = _shadersources.begin(); cursource != _shadersources.end(); ++cursource)
|
||||
shaderids.push_back(createShader(*cursource));
|
||||
std::vector<ShaderSource>::const_iterator source;
|
||||
for (source = _shadersources.begin(); source != _shadersources.end(); ++source)
|
||||
shaderids.push_back(createShader(*source));
|
||||
|
||||
if (shaderids.size() == 0)
|
||||
throw love::Exception("Cannot create shader effect: no valid source code!");
|
||||
@@ -323,9 +323,7 @@ void ShaderEffect::sendFloat(const std::string &name, int size, const GLfloat *v
|
||||
GLint location = getUniformLocation(name);
|
||||
|
||||
if (size < 1 || size > 4)
|
||||
{
|
||||
throw love::Exception("Invalid variable size: %d (expected 1-4).", size);
|
||||
}
|
||||
|
||||
switch (size)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
|
||||
ShaderEffect(const std::vector<ShaderSource> &shadersources);
|
||||
virtual ~ShaderEffect();
|
||||
|
||||
std::string getWarnings() const;
|
||||
|
||||
virtual bool loadVolatile();
|
||||
@@ -69,7 +70,7 @@ public:
|
||||
static std::string getGLSLVersion();
|
||||
static bool isSupported();
|
||||
|
||||
static ShaderEffect *current;
|
||||
static ShaderEffect *current; // pointer to currently active ShaderEffect
|
||||
|
||||
void sendFloat(const std::string &name, int size, const GLfloat *vec, int count);
|
||||
void sendMatrix(const std::string &name, int size, const GLfloat *m, int count);
|
||||
@@ -82,7 +83,7 @@ private:
|
||||
GLuint createShader(const ShaderSource &source);
|
||||
void createProgram(const std::vector<GLuint> &shaders);
|
||||
|
||||
std::vector<ShaderSource> _shadersources; // list of all shader code attached to this ShaderEffect
|
||||
std::vector<ShaderSource> _shadersources; // all shader code attached to this ShaderEffect
|
||||
|
||||
GLuint _program; // volatile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user