X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.h;h=48c18d0f56333371130710942a4dbdc9076e9f45;hb=58e4e69e640838076c506a94cd5f8f905d55420a;hp=7038468b52ce048e27042a86e100807c4fe93ed2;hpb=4c705a6fba590514bc3fab2a324c24fddc30cac6;p=libs%2Fgl.git diff --git a/source/core/program.h b/source/core/program.h index 7038468b..48c18d0f 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -5,13 +5,14 @@ #include #include #include "bindable.h" +#include "datatype.h" #include "gl.h" +#include "module.h" #include "vertexformat.h" namespace Msp { namespace GL { -class Module; class Shader; /** @@ -62,11 +63,17 @@ public: { std::string name; const UniformBlockInfo *block; - unsigned location; - unsigned size; + union + { + int location; + unsigned offset; + }; + unsigned array_size; unsigned array_stride; unsigned matrix_stride; - GLenum type; + DataType type; + + UniformInfo(); }; struct UniformBlockInfo @@ -76,14 +83,18 @@ public: int bind_point; std::vector uniforms; LayoutHash layout_hash; + + UniformBlockInfo(); }; struct AttributeInfo { std::string name; unsigned location; - unsigned size; - GLenum type; + unsigned array_size; + DataType type; + + AttributeInfo(); }; typedef std::map UniformMap; @@ -118,12 +129,12 @@ private: public: virtual ~Program(); -private: - unsigned add_stage(GLenum); -public: void add_stages(const Module &, const std::map & = std::map()); private: - void compile_stage(unsigned); + unsigned add_stage(GLenum); + void add_glsl_stages(const GlslModule &, const std::map &); + void compile_glsl_stage(unsigned); + void add_spirv_stages(const SpirVModule &, const std::map &); public: DEPRECATED void attach_shader(Shader &shader); @@ -137,10 +148,13 @@ public: void link(); private: - static void require_type(GLenum); void query_uniforms(); void query_uniform_blocks(const std::vector &); void query_attributes(); + void collect_uniforms(); + void collect_block_uniforms(UniformBlockInfo &, const SpirVModule::Structure &, const std::string &, unsigned); + void collect_attributes(); + void update_layout_hash(); static LayoutHash compute_layout_hash(const std::vector &); static bool uniform_location_compare(const UniformInfo *, const UniformInfo *); public: