uniform testing
This commit is contained in:
@ -46,6 +46,35 @@ void ShaderProgram::init(
|
|||||||
assertNoGLError();
|
assertNoGLError();
|
||||||
assertUnreachable("Failed to link shader program:\n%s", log);
|
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() {
|
ShaderProgram::~ShaderProgram() {
|
||||||
|
Reference in New Issue
Block a user