X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Freflectdata.h;fp=source%2Fcore%2Freflectdata.h;h=90b7ce0d4a41582a8f7e89809e4375c7ca4f7b24;hb=1b23728908f5ec9beb08b2b70737c3903745fddc;hp=0000000000000000000000000000000000000000;hpb=b877c737bc5f759e6da25f886ad965e4a274cf2a;p=libs%2Fgl.git diff --git a/source/core/reflectdata.h b/source/core/reflectdata.h new file mode 100644 index 00000000..90b7ce0d --- /dev/null +++ b/source/core/reflectdata.h @@ -0,0 +1,74 @@ +#ifndef MSP_GL_REFLECTDATA_H_ +#define MSP_GL_REFLECTDATA_H_ + +#include +#include +#include "datatype.h" +#include "tag.h" + +namespace Msp { +namespace GL { + +/** +Reflection data for shader programs. +*/ +struct ReflectData +{ + typedef unsigned LayoutHash; + struct UniformBlockInfo; + + struct UniformInfo + { + std::string name; + const UniformBlockInfo *block; + union + { + int location; + unsigned offset; + }; + unsigned array_size; + unsigned array_stride; + unsigned matrix_stride; + DataType type; + Tag tag; + int binding; + + UniformInfo(); + }; + + struct UniformBlockInfo + { + std::string name; + unsigned data_size; + int bind_point; + std::vector uniforms; + LayoutHash layout_hash; + + UniformBlockInfo(); + + void sort_uniforms(); + void update_layout_hash(); + }; + + struct AttributeInfo + { + std::string name; + unsigned location; + unsigned array_size; + DataType type; + + AttributeInfo(); + }; + + std::vector uniform_blocks; + std::vector uniforms; + LayoutHash layout_hash; + std::vector attributes; + + void update_layout_hash(); +}; + +} // namespace GL +} // namespace Msp + +#endif