|
@@ -5,7 +5,6 @@
|
|
|
#include "anki/util/Assert.h"
|
|
#include "anki/util/Assert.h"
|
|
|
#include "anki/util/Flags.h"
|
|
#include "anki/util/Flags.h"
|
|
|
#include "anki/math/Forward.h"
|
|
#include "anki/math/Forward.h"
|
|
|
-#include "anki/util/NonCopyable.h"
|
|
|
|
|
#include "anki/gl/Ogl.h"
|
|
#include "anki/gl/Ogl.h"
|
|
|
#include "anki/util/Vector.h"
|
|
#include "anki/util/Vector.h"
|
|
|
#include "anki/util/StdTypes.h"
|
|
#include "anki/util/StdTypes.h"
|
|
@@ -34,7 +33,8 @@ public:
|
|
|
SPVT_UNIFORM
|
|
SPVT_UNIFORM
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- ShaderProgramVariable()
|
|
|
|
|
|
|
+ ShaderProgramVariable(ShaderProgramVariableType type_)
|
|
|
|
|
+ : type(type_)
|
|
|
{}
|
|
{}
|
|
|
virtual ~ShaderProgramVariable()
|
|
virtual ~ShaderProgramVariable()
|
|
|
{}
|
|
{}
|
|
@@ -66,7 +66,7 @@ public:
|
|
|
return type;
|
|
return type;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- size_t getSize() const
|
|
|
|
|
|
|
+ PtrSize getSize() const
|
|
|
{
|
|
{
|
|
|
return size;
|
|
return size;
|
|
|
}
|
|
}
|
|
@@ -74,11 +74,11 @@ public:
|
|
|
|
|
|
|
|
ShaderProgramVariable& operator=(const ShaderProgramVariable& b)
|
|
ShaderProgramVariable& operator=(const ShaderProgramVariable& b)
|
|
|
{
|
|
{
|
|
|
|
|
+ ANKI_ASSERT(type == b.type)
|
|
|
loc = b.loc;
|
|
loc = b.loc;
|
|
|
name = b.name;
|
|
name = b.name;
|
|
|
glDataType = b.glDataType;
|
|
glDataType = b.glDataType;
|
|
|
size = b.size;
|
|
size = b.size;
|
|
|
- type = b.type;
|
|
|
|
|
fatherSProg = b.fatherSProg;
|
|
fatherSProg = b.fatherSProg;
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
@@ -89,7 +89,7 @@ private:
|
|
|
/// GL_FLOAT, GL_FLOAT_VEC2 etc. See
|
|
/// GL_FLOAT, GL_FLOAT_VEC2 etc. See
|
|
|
/// http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml
|
|
/// http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml
|
|
|
GLenum glDataType;
|
|
GLenum glDataType;
|
|
|
- size_t size; ///< Its 1 if it is a single or >1 if it is an array
|
|
|
|
|
|
|
+ PtrSize size; ///< Its 1 if it is a single or >1 if it is an array
|
|
|
ShaderProgramVariableType type;
|
|
ShaderProgramVariableType type;
|
|
|
/// We need the ShaderProg of this variable mainly for sanity checks
|
|
/// We need the ShaderProg of this variable mainly for sanity checks
|
|
|
const ShaderProgram* fatherSProg;
|
|
const ShaderProgram* fatherSProg;
|
|
@@ -103,6 +103,7 @@ class ShaderProgramUniformVariable: public ShaderProgramVariable
|
|
|
|
|
|
|
|
public:
|
|
public:
|
|
|
ShaderProgramUniformVariable()
|
|
ShaderProgramUniformVariable()
|
|
|
|
|
+ : ShaderProgramVariable(SPVT_UNIFORM)
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
/// @name Set the var
|
|
/// @name Set the var
|
|
@@ -160,7 +161,7 @@ private:
|
|
|
|
|
|
|
|
/// Offset inside the uniform block. -1 if it's inside the default uniform
|
|
/// Offset inside the uniform block. -1 if it's inside the default uniform
|
|
|
/// block
|
|
/// block
|
|
|
- GLint offset;
|
|
|
|
|
|
|
+ GLint offset = -1;
|
|
|
|
|
|
|
|
/// "An array identifying the stride between elements, in basic machine
|
|
/// "An array identifying the stride between elements, in basic machine
|
|
|
/// units, of each of the uniforms specified by the corresponding array of
|
|
/// units, of each of the uniforms specified by the corresponding array of
|
|
@@ -182,6 +183,10 @@ private:
|
|
|
class ShaderProgramAttributeVariable: public ShaderProgramVariable
|
|
class ShaderProgramAttributeVariable: public ShaderProgramVariable
|
|
|
{
|
|
{
|
|
|
friend class ShaderProgram;
|
|
friend class ShaderProgram;
|
|
|
|
|
+
|
|
|
|
|
+ ShaderProgramAttributeVariable()
|
|
|
|
|
+ : ShaderProgramVariable(SPVT_ATTRIBUTE)
|
|
|
|
|
+ {}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/// Uniform shader block
|
|
/// Uniform shader block
|