From 32c294ed766bc26498d37450d1a9ba8a7c83e125 Mon Sep 17 00:00:00 2001 From: BearishSun Date: Tue, 22 Nov 2016 09:53:04 +0100 Subject: [PATCH] Adding a way to retrieve vertex attribute TType using TProgram reflection API (required in order to query location attributes). --- glslang/MachineIndependent/ShaderLang.cpp | 1 + glslang/Public/ShaderLang.h | 1 + 2 files changed, 2 insertions(+) diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 5b44af52..8df493bc 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1708,6 +1708,7 @@ int TProgram::getUniformArraySize(int index) const { return reflection int TProgram::getNumLiveAttributes() const { return reflection->getNumAttributes(); } const char* TProgram::getAttributeName(int index) const { return reflection->getAttribute(index).name.c_str(); } int TProgram::getAttributeType(int index) const { return reflection->getAttribute(index).glDefineType; } +const TType* TProgram::getAttributeTType(int index) const { return reflection->getAttribute(index).getType(); } const TType* TProgram::getUniformTType(int index) const { return reflection->getUniform(index).getType(); } const TType* TProgram::getUniformBlockTType(int index) const { return reflection->getUniformBlock(index).getType(); } diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 9a76b40a..6793cdd3 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -511,6 +511,7 @@ public: int getAttributeType(int index) const; // can be used for glGetActiveAttrib() const TType* getUniformTType(int index) const; // returns a TType* const TType* getUniformBlockTType(int index) const; // returns a TType* + const TType* getAttributeTType(int index) const; // returns a TType* void dumpReflection();