Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 272 vs 273 for /trunk/Source Code/Hardware/Video/OpenGL/Shaders/glShaderProgram.cpp

Diff revisions: vs.
  @@ -71,7 +71,7 @@
71 71
72 72 glGetProgramiv(_shaderProgramId, GL_PROGRAM_BINARY_LENGTH, &binaryLength);
73 73 void* binary = (void*)malloc(binaryLength);
74 - assert(binary != NULL);
74 + DIVIDE_ASSERT(binary != NULL, "glShaderProgram error: could not allocate memory for the program binary!");
75 75 glGetProgramBinary(_shaderProgramId, binaryLength, nullptr, &_binaryFormat, binary);
76 76
77 77 std::string outFileName("shaderCache/Binary/"+getName()+".bin");
  @@ -107,7 +107,7 @@
107 107 }
108 108
109 109 void glShaderProgram::detachShader(Shader* const shader){
110 - assert(_threadedLoadComplete);
110 + DIVIDE_ASSERT(_threadedLoadComplete, "glShaderProgram error: tried to detach a shader from a program that didn't finish loading!");
111 111 glDetachShader(_shaderProgramId ,shader->getShaderId());
112 112 }
113 113
  @@ -155,7 +155,7 @@
155 155
156 156 validate();
157 157 _shaderProgramId = _shaderProgramIDTemp;
158 -
158 + _textureSlots.clear();
159 159 ShaderProgram::generateHWResource(name);
160 160 }
161 161
  @@ -329,8 +329,7 @@
329 329 //Not loaded or NULL_SHADER
330 330 if (!isHWInitComplete() || _shaderProgramId == 0 || _shaderProgramId == Divide::GLUtil::_invalidObjectID) return -1;
331 331
332 - assert(_linked && _threadedLoadComplete);
333 -
332 + DIVIDE_ASSERT(_linked && _threadedLoadComplete, "glShaderProgram error: tried to query a shader program before linking!");
334 333 const ShaderVarMap::const_iterator& it = _shaderVars.find(name);
335 334
336 335 if(it != _shaderVars.end()) return it->second;
  @@ -348,11 +347,11 @@
348 347 return false;
349 348 }
350 349
351 - assert(_shaderProgramId != Divide::GLUtil::_invalidObjectID);
350 + DIVIDE_ASSERT(_shaderProgramId != Divide::GLUtil::_invalidObjectID, "glShaderProgram error: tried to bind a shader program with an invalid handle!");
352 351
353 352 GL_API::setActiveProgram(this);
354 353 //send default uniforms to GPU for every shader
355 - return ShaderProgram::bind();
354 + return ShaderProgram::bind();
356 355 }
357 356
358 357 void glShaderProgram::unbind(bool resetActiveProgram) {
  @@ -394,7 +393,7 @@
394 393 }
395 394
396 395 void glShaderProgram::SetSubroutines(ShaderType type, const vectorImpl<U32>& indices) const {
397 - assert(_bound);
396 + DIVIDE_ASSERT(_bound && _linked, "glShaderProgram error: tried to set subroutines on an unbound or unlinked program!");
398 397 if (indices[0] != GL_INVALID_INDEX)
399 398 glUniformSubroutinesuiv(_shaderStageTable[type], (GLsizei)indices.size(), &indices.front());
400 399
  @@ -402,7 +401,7 @@
402 401
403 402 void glShaderProgram::SetSubroutine(ShaderType type, U32 index) const {
404 403 static U32 value[1];
405 - assert(_bound && _linked);
404 + DIVIDE_ASSERT(_bound && _linked, "glShaderProgram error: tried to set subroutines on an unbound or unlinked program!");
406 405 if (index != GL_INVALID_INDEX){
407 406 value[0] = index;
408 407 glUniformSubroutinesuiv(_shaderStageTable[type], 1, value);
  @@ -410,7 +409,7 @@
410 409 }
411 410
412 411 U32 glShaderProgram::GetSubroutineIndex(ShaderType type, const std::string& name) const {
413 - assert(_linked);
412 + DIVIDE_ASSERT(_linked, "glShaderProgram error: tried to query subroutines on an unlinked program!");
414 413
415 414 return glGetSubroutineIndex(_shaderProgramId, _shaderStageTable[type], name.c_str());
416 415 }
  @@ -424,7 +423,7 @@
424 423
425 424 void glShaderProgram::Uniform(GLint location, GLint value) const {
426 425 if (location == -1) return;
427 -
426 +
428 427 if (!_bound) glProgramUniform1i(_shaderProgramId, location, value);
429 428 else glUniform1i(location, value);
430 429 }