X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fprogram.h;h=ca5437f3a6970e6d626bf36520ebc828d0697ab1;hp=7f6ad54e3a6c9a14c3cfb4224d1d0d83ce07c69a;hb=HEAD;hpb=fbfd4b52102e06398ff162be07d6799f005a04a8 diff --git a/source/core/program.h b/source/core/program.h index 7f6ad54e..3e206a70 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -51,6 +51,7 @@ private: }; ReflectData reflect_data; + SpirVModule *specialized_spirv = 0; public: /// Constructs an empty Program with no shader stages attached. @@ -59,19 +60,24 @@ public: /// Constructs a Program from a Module, with specialization constants. Program(const Module &, const std::map & = std::map()); + Program(Program &&); + ~Program(); + void add_stages(const Module &, const std::map & = std::map()); private: - static std::vector collect_used_variables(const SpirVModule &, const std::map &); - static void collect_visited_blocks(const std::vector &, unsigned, std::vector &); - void collect_uniforms(const SpirVModule &, const std::vector &); + void collect_uniforms(const SpirVModule &); void collect_block_uniforms(const SpirVModule::Structure &, const std::string &, unsigned, std::vector &); - void collect_attributes(const SpirVModule &, const std::vector &); + void collect_attributes(const SpirVModule &); void collect_builtins(const SpirVModule &); void collect_builtins(const SpirVModule::Structure &); public: + using ProgramBackend::is_compute; + using ProgramBackend::has_tessellation; + ReflectData::LayoutHash get_uniform_layout_hash() const { return reflect_data.layout_hash; } unsigned get_n_descriptor_sets() const { return reflect_data.n_descriptor_sets; } + unsigned get_push_constants_size() const { return reflect_data.push_constants_size; } const std::vector &get_uniform_blocks() const { return reflect_data.uniform_blocks; } const ReflectData::UniformBlockInfo &get_uniform_block_info(const std::string &) const; const std::vector &get_uniforms() const { return reflect_data.uniforms; } @@ -80,10 +86,16 @@ public: int get_uniform_location(const std::string &) const; int get_uniform_location(Tag) const; int get_uniform_binding(Tag) const; + bool uses_uniform_block_binding(int b) const { return uses_binding(b|ReflectData::UNIFORM_BLOCK_BINDING); } + bool uses_texture_binding(unsigned b) const { return uses_binding(b|ReflectData::TEXTURE_BINDING); } +private: + bool uses_binding(int) const; +public: const std::vector &get_attributes() const { return reflect_data.attributes; } const ReflectData::AttributeInfo &get_attribute_info(const std::string &) const; int get_attribute_location(const std::string &) const; unsigned get_n_clip_distances() const { return reflect_data.n_clip_distances; } + const LinAl::Vector &get_compute_workgroup_size() const { return reflect_data.compute_wg_size; } using ProgramBackend::set_debug_name; };