Skip to content

Commit

Permalink
fixed a bug in the shader edit code that made array uniform lookup in…
Browse files Browse the repository at this point in the history
…correct
  • Loading branch information
jmacey committed May 22, 2023
1 parent 46fa3ca commit 2aafcc8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/ShaderLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ bool ShaderLib::loadShader(std::string_view _shaderName, std::string_view _vert,
if((loaded = linkProgramObject(_shaderName)))
return loaded;
autoRegisterUniforms(_shaderName);
printRegisteredUniforms(_shaderName);
return loaded;
}
//----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -229,7 +228,6 @@ bool ShaderLib::editShader(std::string_view _shader, std::string_view _toFind, s
if(shader != m_shaders.end())
{
success = shader->second->editShader(_toFind, _edit);

}
return success;
}
Expand Down
5 changes: 0 additions & 5 deletions src/ShaderProgram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,12 @@ void ShaderProgram::autoRegisterUniforms() noexcept
// glGetProgramInterfaceiv(i, GL_UNIFORM, GL_ACTIVE_RESOURCES, &numUniforms);
char name[256];
uniformData data;
std::cout<<m_programName<<" ";
std::cout<<"Number of uniforms "<<nUniforms<<"\n";
for(GLint i = 0; i < nUniforms; ++i)
{
GLenum type = GL_ZERO;
GLsizei nameLen = 0;
GLint num = 0;
glGetActiveUniform(m_programID, i, sizeof(name) - 1, &nameLen, &num, &type, name);
std::cout<<"Uniform "<<name<<" type "<<type<<" num "<<num<<"\n";
// two options we either have an array or single value
// if not array
if(num == 1)
Expand All @@ -607,7 +604,6 @@ void ShaderProgram::autoRegisterUniforms() noexcept
}
else
{
std::cout<<"have array "<<name<<"\n";
std::string uniform(name);
std::string baseName = uniform.substr(0, uniform.find("["));
// nvidia returns uniform[0], ATI uniform, best way is to split on [
Expand All @@ -621,7 +617,6 @@ void ShaderProgram::autoRegisterUniforms() noexcept
}
}
}
std::cout<<"Debug "<<m_registeredUniforms.size()<<"\n";
}

std::string ShaderProgram::getValueFromShader(const uniformData &_d) const noexcept
Expand Down

0 comments on commit 2aafcc8

Please sign in to comment.