uniform testing

This commit is contained in:
2024-12-24 16:41:36 -06:00
parent f5958f2879
commit fe69d85fab

View File

@ -46,6 +46,35 @@ void ShaderProgram::init(
assertNoGLError();
assertUnreachable("Failed to link shader program:\n%s", log);
}
// So the uniforms that are in slang are kinda odd when compiled.
//DEBUGGING
GLint numUniforms = 0;
glGetProgramiv(this->id, GL_ACTIVE_UNIFORMS, &numUniforms);
assertNoGLError();
for(GLint i = 0; i < numUniforms; ++i) {
char name[1024];
GLsizei length;
GLint size;
GLenum type;
glGetActiveUniform(this->id, i, sizeof(name), &length, &size, &type, name);
assertNoGLError();
std::cout << "Uniform: " << i << ": " << name << " has size " << size << " and length " << length << std::endl;
}
GLint numUniformBlocks = 0;
glGetProgramiv(this->id, GL_ACTIVE_UNIFORM_BLOCKS, &numUniformBlocks);
for(GLint i = 0; i < numUniformBlocks; ++i) {
GLint size;
glGetActiveUniformBlockiv(this->id, i, GL_UNIFORM_BLOCK_DATA_SIZE, &size);
assertNoGLError();
std::cout << "Uniform Block: " << i << " has size " << size << std::endl;
}
}
ShaderProgram::~ShaderProgram() {