Commit d256bd81 authored by Robert Menzel's avatar Robert Menzel
Browse files

reduced warnings, added GL 4.3 define, added compute shaders to shader filetype detection

parent 4229a2e0
...@@ -82,7 +82,7 @@ public: ...@@ -82,7 +82,7 @@ public:
inline ShaderProgramControlFiles& andFile (const std::string &_fileName) { addFile( _fileName ); mShaderType.push_back( GL_INVALID_VALUE ); return *this; } inline ShaderProgramControlFiles& andFile (const std::string &_fileName) { addFile( _fileName ); mShaderType.push_back( GL_INVALID_VALUE ); return *this; }
//! adds a single file, the shader type is explicitly given and must be one of: //! adds a single file, the shader type is explicitly given and must be one of:
//! GL_VERTEX_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER //! GL_VERTEX_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER
inline ShaderProgramControlFiles& andFile (const std::string &_fileName, GLenum _type) { addFile( _fileName ); mShaderType.push_back( _type ); return *this; } inline ShaderProgramControlFiles& andFile (const std::string &_fileName, GLenum _type) { addFile( _fileName ); mShaderType.push_back( _type ); return *this; }
//! adds all files begining with the given name, the shader type will be guessed by the ending: //! adds all files begining with the given name, the shader type will be guessed by the ending:
......
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
# define ACGL_OPENGL_VERSION 41 # define ACGL_OPENGL_VERSION 41
#elif defined (ACGL_OPENGL_VERSION_42) #elif defined (ACGL_OPENGL_VERSION_42)
# define ACGL_OPENGL_VERSION 42 # define ACGL_OPENGL_VERSION 42
#elif defined (ACGL_OPENGL_VERSION_43)
# define ACGL_OPENGL_VERSION 43
#else #else
// failback: // failback:
#warning "NO ACGL_OPENGL_VERSION_XY SET! Default to 3.2" #warning "NO ACGL_OPENGL_VERSION_XY SET! Default to 3.2"
......
...@@ -157,7 +157,7 @@ bool GeometryDataControlFileATB::load(SharedGeometryData& _geometry) const ...@@ -157,7 +157,7 @@ bool GeometryDataControlFileATB::load(SharedGeometryData& _geometry) const
std::memcpy(data, &dataVector[0], dataVector.size() * sizeof(GLfloat)); std::memcpy(data, &dataVector[0], dataVector.size() * sizeof(GLfloat));
// Name the attribute according to the filename // Name the attribute according to the filename
ArrayBuffer::Attribute attr = { mAttributeName, GL_FLOAT, attributeDimension, 0, GL_FALSE, 0 }; ArrayBuffer::Attribute attr = { mAttributeName, GL_FLOAT, attributeDimension, 0, GL_FALSE, 0, GL_FALSE };
_geometry->mAttributes.push_back(attr); _geometry->mAttributes.push_back(attr);
// Tell the _geometry object where it finds the data // Tell the _geometry object where it finds the data
......
...@@ -280,18 +280,18 @@ bool GeometryDataControlFileOBJ::load(SharedGeometryData& geometry) const ...@@ -280,18 +280,18 @@ bool GeometryDataControlFileOBJ::load(SharedGeometryData& geometry) const
geometry->setData( (GLubyte*)data ); geometry->setData( (GLubyte*)data );
geometry->setStrideSize( components * sizeof(float) ); geometry->setStrideSize( components * sizeof(float) );
ArrayBuffer::Attribute apos = { "aPosition", GL_FLOAT, 4, 0, GL_FALSE, 0 }; ArrayBuffer::Attribute apos = { "aPosition", GL_FLOAT, 4, 0, GL_FALSE, 0, GL_FALSE };
geometry->mAttributes.push_back( apos ); geometry->mAttributes.push_back( apos );
if (hasNormals) { if (hasNormals) {
ArrayBuffer::Attribute anorm = { "aNormal", GL_FLOAT, 3, 4*sizeof(float), GL_FALSE, 0 }; ArrayBuffer::Attribute anorm = { "aNormal", GL_FLOAT, 3, 4*sizeof(float), GL_FALSE, 0, GL_FALSE };
geometry->mAttributes.push_back( anorm ); geometry->mAttributes.push_back( anorm );
} }
if (texCoordDimension > 0) { if (texCoordDimension > 0) {
int offset = (hasNormals?7:4); int offset = (hasNormals?7:4);
offset *= sizeof(float); offset *= sizeof(float);
ArrayBuffer::Attribute atex = { "aTexCoord", GL_FLOAT, texCoordDimension, offset, GL_FALSE, 0 }; ArrayBuffer::Attribute atex = { "aTexCoord", GL_FLOAT, texCoordDimension, offset, GL_FALSE, 0, GL_FALSE };
geometry->mAttributes.push_back( atex ); geometry->mAttributes.push_back( atex );
} }
......
...@@ -23,14 +23,22 @@ SharedShader ShaderControlFile::create(void) ...@@ -23,14 +23,22 @@ SharedShader ShaderControlFile::create(void)
if(extension == "vsh") if(extension == "vsh")
mType = GL_VERTEX_SHADER; mType = GL_VERTEX_SHADER;
else if(extension == "fsh")
mType = GL_FRAGMENT_SHADER;
#if (ACGL_OPENGL_VERSION >= 43)
else if(extension == "csh")
mType = GL_COMPUTE_SHADER;
#endif
#if (ACGL_OPENGL_VERSION >= 40)
else if(extension == "tcsh") else if(extension == "tcsh")
mType = GL_TESS_CONTROL_SHADER; mType = GL_TESS_CONTROL_SHADER;
else if(extension == "tesh") else if(extension == "tesh")
mType = GL_TESS_EVALUATION_SHADER; mType = GL_TESS_EVALUATION_SHADER;
#endif
#if (ACGL_OPENGL_VERSION >= 32)
else if(extension == "gsh") else if(extension == "gsh")
mType = GL_GEOMETRY_SHADER; mType = GL_GEOMETRY_SHADER;
else if(extension == "fsh") #endif
mType = GL_FRAGMENT_SHADER;
else else
return SharedShader(); return SharedShader();
} }
......
...@@ -29,6 +29,9 @@ const ShaderProgramControlFiles::ShaderEndings ShaderProgramControlFiles::sShade ...@@ -29,6 +29,9 @@ const ShaderProgramControlFiles::ShaderEndings ShaderProgramControlFiles::sShade
{"tesh", GL_TESS_EVALUATION_SHADER}, {"tesh", GL_TESS_EVALUATION_SHADER},
{"gsh", GL_GEOMETRY_SHADER}, {"gsh", GL_GEOMETRY_SHADER},
{"geo", GL_GEOMETRY_SHADER}, {"geo", GL_GEOMETRY_SHADER},
#if (ACGL_OPENGL_VERSION >= 43)
{"csh", GL_COMPUTE_SHADER},
#endif
#endif #endif
{"vsh", GL_VERTEX_SHADER}, {"vsh", GL_VERTEX_SHADER},
{"vert", GL_VERTEX_SHADER}, {"vert", GL_VERTEX_SHADER},
......
...@@ -93,7 +93,7 @@ bool FrameBufferObject::attachColorAttachment( const Attachment &_attachment ) ...@@ -93,7 +93,7 @@ bool FrameBufferObject::attachColorAttachment( const Attachment &_attachment )
if (mColorAttachments[i].name == _attachment.name) { if (mColorAttachments[i].name == _attachment.name) {
// replace this attachment // replace this attachment
GLuint newLocation = _attachment.location; GLuint newLocation = _attachment.location;
if (newLocation > maxColorBuffers) { if (newLocation > (GLuint) maxColorBuffers) {
// we have to find a place, but luckily we can use the old location of the same-named attachment: // we have to find a place, but luckily we can use the old location of the same-named attachment:
newLocation = mColorAttachments[i].location; newLocation = mColorAttachments[i].location;
} }
...@@ -105,7 +105,7 @@ bool FrameBufferObject::attachColorAttachment( const Attachment &_attachment ) ...@@ -105,7 +105,7 @@ bool FrameBufferObject::attachColorAttachment( const Attachment &_attachment )
if (realLocation == -1) { if (realLocation == -1) {
// it's a new attachment // it's a new attachment
GLuint newLocation = _attachment.location; GLuint newLocation = _attachment.location;
if (newLocation > maxColorBuffers) { if (newLocation > (GLuint) maxColorBuffers) {
// we have to find a place: // we have to find a place:
newLocation = mColorAttachments.size(); newLocation = mColorAttachments.size();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment