From fe69d85fab23714d32dc559da97c32e6e595367e Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 24 Dec 2024 16:41:36 -0600 Subject: [PATCH] uniform testing --- .../display/shader/ShaderProgram.cpp | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/dawnopengl/display/shader/ShaderProgram.cpp b/src/dawnopengl/display/shader/ShaderProgram.cpp index a9f1cb81..9620fec8 100644 --- a/src/dawnopengl/display/shader/ShaderProgram.cpp +++ b/src/dawnopengl/display/shader/ShaderProgram.cpp @@ -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() {