X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Ffinalize.h;h=4f6ee4193bd869ba61ace5191cc1cd9382b14b4e;hb=d03f6d46d0646c53ec3dcd00ddfd6c718ad18720;hp=3db581be732cd3c5ea7e0b40fce67498db9e1e45;hpb=8f2713a3f1501e90016bb8069ecd08dde2f90e56;p=libs%2Fgl.git diff --git a/source/glsl/finalize.h b/source/glsl/finalize.h index 3db581be..4f6ee419 100644 --- a/source/glsl/finalize.h +++ b/source/glsl/finalize.h @@ -1,5 +1,5 @@ -#ifndef MSP_GL_SL_COMPATIBILITY_H_ -#define MSP_GL_SL_COMPATIBILITY_H_ +#ifndef MSP_GL_SL_FINALIZE_H_ +#define MSP_GL_SL_FINALIZE_H_ #include #include "visitor.h" @@ -8,6 +8,22 @@ namespace Msp { namespace GL { namespace SL { +/** Assigns offset layout qualifiers to struct members. */ +class StructOrganizer: private TraversingVisitor +{ +private: + int offset = -1; + +public: + void apply(Stage &s) { s.content.visit(*this); } + +private: + virtual void visit(StructDeclaration &); + virtual void visit(VariableDeclaration &); +}; + +/** Assigns location and binding layout qualifiers to interface variables and +blocks. */ class LocationAllocator: private TraversingVisitor { private: @@ -46,14 +62,12 @@ according to the requirements of the target API. */ class PrecisionConverter: private TraversingVisitor { private: - Stage *stage; + Stage *stage = 0; std::set have_default; NodeList::iterator insert_point; std::set nodes_to_remove; public: - PrecisionConverter(); - void apply(Stage &); private: @@ -67,26 +81,29 @@ features. */ class LegacyConverter: private TraversingVisitor { private: - Stage *stage; + Stage *stage = 0; Features features; - VariableDeclaration *frag_out; + VariableDeclaration *frag_out = 0; NodeList::iterator uniform_insert_point; std::set nodes_to_remove; + RefPtr r_replaced_reference; + bool r_flattened_interface = false; public: - LegacyConverter(); - virtual void apply(Stage &, const Features &); private: void unsupported(const std::string &); virtual void visit(Block &); + virtual void visit(RefPtr &); bool check_version(const Version &) const; bool check_extension(bool Features::*) const; bool supports_stage(Stage::Type) const; bool supports_unified_interface_syntax() const; virtual void visit(VariableReference &); + virtual void visit(InterfaceBlockReference &); + virtual void visit(MemberAccess &); virtual void visit(Assignment &); bool supports_unified_sampling_functions() const; virtual void visit(FunctionCall &);