MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / ReflectSubroutines

Method ReflectSubroutines

GTE/Graphics/GL46/GLSLReflection.cpp:770–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

768}
769
770void GLSLReflection::ReflectSubroutines(GLenum programInterface,
771 std::vector<std::string>& subroutines)
772{
773 GLint numResources = 0;
774 glGetProgramInterfaceiv(mHandle, programInterface, GL_ACTIVE_RESOURCES, &numResources);
775
776 if (numResources > 0)
777 {
778 subroutines.resize(numResources);
779
780 GLenum nameLengthProperty = GL_NAME_LENGTH;
781 for (int32_t i = 0; i < numResources; ++i)
782 {
783 GLint result = 0;
784 glGetProgramResourceiv(mHandle, programInterface, i, 1,
785 &nameLengthProperty, 1, nullptr, &result);
786
787 GLsizei const numBytes = static_cast<GLsizei>(result + 1);
788 std::vector<GLchar> name(numBytes);
789 glGetProgramResourceName(mHandle, programInterface, i, numBytes,
790 nullptr, name.data());
791 subroutines[i] = std::string(name.data());
792 }
793 }
794}
795
796void GLSLReflection::ReflectSubroutineUniforms(GLenum programInterface,
797 std::vector<SubroutineUniform>& subUniforms)

Callers

nothing calls this directly

Calls 3

glGetProgramInterfaceivFunction · 0.85
glGetProgramResourceivFunction · 0.85
glGetProgramResourceNameFunction · 0.85

Tested by

no test coverage detected