X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FOpenGl%2FOpenGl_ShaderObject.hxx;h=85709787a26ad5500e063d157eb79733f84d935c;hb=3b4c69452bc6cf55a39bb98281b919a4b0fc6587;hpb=87a64d53ab4714dcaa89370d3c1b47f7d378d4ad diff --git a/src/OpenGl/OpenGl_ShaderObject.hxx b/src/OpenGl/OpenGl_ShaderObject.hxx index 41120d3d9a..85709787a2 100755 --- a/src/OpenGl/OpenGl_ShaderObject.hxx +++ b/src/OpenGl/OpenGl_ShaderObject.hxx @@ -30,6 +30,46 @@ public: //! Non-valid shader name. static const GLuint NO_SHADER = 0; +public: + + //! Structure defining shader uniform or in/out variable. + struct ShaderVariable + { + TCollection_AsciiString Name; //!< variable name + Standard_Integer Stages; //!< active stages as Graphic3d_TypeOfShaderObject bits; + //! for in/out variables, intermediate stages will be automatically filled + + //! Create new shader variable. + ShaderVariable (const TCollection_AsciiString& theVarName, Standard_Integer theShaderStageBits) : Name (theVarName), Stages (theShaderStageBits) {} + + //! Empty constructor. + ShaderVariable() : Stages (0) {} + }; + + //! List of variable of shader program. + typedef NCollection_Sequence ShaderVariableList; + + //! This is a preprocessor for Graphic3d_ShaderObject::CreateFromSource() function. + //! Creates a new shader object from specified source according to list of uniforms and in/out variables. + //! @param theSource shader object source code to modify + //! @param theType shader object type to create + //! @param theUniforms list of uniform variables + //! @param theStageInOuts list of stage in/out variables + //! @param theInName name of input variables block; + //! can be empty for accessing each variable without block prefix + //! (mandatory for stages accessing both inputs and outputs) + //! @param theOutName name of output variables block; + //! can be empty for accessing each variable without block prefix + //! (mandatory for stages accessing both inputs and outputs) + //! @param theNbGeomInputVerts number of geometry shader input vertexes + Standard_EXPORT static Handle(Graphic3d_ShaderObject) CreateFromSource (TCollection_AsciiString& theSource, + Graphic3d_TypeOfShaderObject theType, + const ShaderVariableList& theUniforms, + const ShaderVariableList& theStageInOuts, + const TCollection_AsciiString& theInName = TCollection_AsciiString(), + const TCollection_AsciiString& theOutName = TCollection_AsciiString(), + Standard_Integer theNbGeomInputVerts = 0); + public: //! Creates uninitialized shader object.