ShaderManager.cpp   ShaderManager.cpp 
skipping to change at line 105 skipping to change at line 105
featureFlagsStrings["MAT_DIFFUSETEX"] = MAT_DIFFUSETEX; featureFlagsStrings["MAT_DIFFUSETEX"] = MAT_DIFFUSETEX;
featureFlagsStrings["MAT_EMISSIVETEX"] = MAT_EMISSIVETEX; featureFlagsStrings["MAT_EMISSIVETEX"] = MAT_EMISSIVETEX;
featureFlagsStrings["GEOMETRY_SHADER"] = GEOMETRY_SHADER; featureFlagsStrings["GEOMETRY_SHADER"] = GEOMETRY_SHADER;
featureFlagsStrings["CUBEMAP"] = CUBEMAP; featureFlagsStrings["CUBEMAP"] = CUBEMAP;
featureFlagsStrings["BLENDING"] = BLENDING; featureFlagsStrings["BLENDING"] = BLENDING;
featureFlagsStrings["TORCH"] = TORCH; featureFlagsStrings["TORCH"] = TORCH;
featureFlagsStrings["DEBUG"] = DEBUG; featureFlagsStrings["DEBUG"] = DEBUG;
featureFlagsStrings["PCSS"] = PCSS; featureFlagsStrings["PCSS"] = PCSS;
featureFlagsStrings["SINGLE_SHADOW_FRUSTUM"] = SINGLE_SHADOW _FRUSTUM; featureFlagsStrings["SINGLE_SHADOW_FRUSTUM"] = SINGLE_SHADOW _FRUSTUM;
featureFlagsStrings["OGL_ES2"] = OGL_ES2; featureFlagsStrings["OGL_ES2"] = OGL_ES2;
featureFlagsStrings["HW_SHADOW_SAMPLERS"] = HW_SHADOW_SAMPLE RS;
} }
} }
ShaderMgr::~ShaderMgr() ShaderMgr::~ShaderMgr()
{ {
clearCache(); clearCache();
} }
void ShaderMgr::clearCache() void ShaderMgr::clearCache()
{ {
skipping to change at line 438 skipping to change at line 439
buildUniformCache(program); buildUniformCache(program);
return true; return true;
} }
void ShaderMgr::buildUniformCache(QOpenGLShaderProgram &program) void ShaderMgr::buildUniformCache(QOpenGLShaderProgram &program)
{ {
//this enumerates all available uniforms of this shader, and stores their locations in a map //this enumerates all available uniforms of this shader, and stores their locations in a map
GLuint prog = program.programId(); GLuint prog = program.programId();
GLint numUniforms=0,bufSize; GLint numUniforms=0,bufSize;
glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms);
glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufSize); QOpenGLFunctions* gl = QOpenGLContext::currentContext()->functions()
;
GL(gl->glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms));
GL(gl->glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufSize))
;
QByteArray buf(bufSize,'\0'); QByteArray buf(bufSize,'\0');
GLsizei length; GLsizei length;
GLint size; GLint size;
GLenum type; GLenum type;
#ifndef NDEBUG #ifndef NDEBUG
qDebug()<<"[ShaderMgr] Shader has"<<numUniforms<<"uniforms"; qDebug()<<"[ShaderMgr] Shader has"<<numUniforms<<"uniforms";
#endif #endif
for(int i =0;i<numUniforms;++i) for(int i =0;i<numUniforms;++i)
{ {
glGetActiveUniform(prog,i,bufSize,&length,&size,&type,buf.da ta()); GL(gl->glGetActiveUniform(prog,i,bufSize,&length,&size,&type ,buf.data()));
QString str(buf); QString str(buf);
str = str.trimmed(); // no idea if this is required str = str.trimmed(); // no idea if this is required
GLint loc = program.uniformLocation(str); GLint loc = program.uniformLocation(str);
t_UniformStrings::iterator it = uniformStrings.find(str); t_UniformStrings::iterator it = uniformStrings.find(str);
// This may also return NULL if the load failed. // This may also return NULL if the load failed.
//We wait until user explictly forces shader reload until we try again to avoid spamming errors. //We wait until user explictly forces shader reload until we try again to avoid spamming errors.
if(it!=uniformStrings.end()) if(it!=uniformStrings.end())
 End of changes. 3 change blocks. 
3 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/