#include <OpenGl_Vec.hxx>
#include <OpenGl_Matrix.hxx>
+#include <OpenGl_NamedResource.hxx>
#include <OpenGl_ShaderObject.hxx>
class OpenGl_ShaderProgram;
-DEFINE_STANDARD_HANDLE(OpenGl_ShaderProgram, OpenGl_Resource)
+DEFINE_STANDARD_HANDLE(OpenGl_ShaderProgram, OpenGl_NamedResource)
//! The enumeration of OCCT-specific OpenGL/GLSL variables.
enum OpenGl_StateVariable
OpenGl_OCC_LIGHT_AMBIENT,
// Material state
- OpenGl_OCCT_ACTIVE_SAMPLER,
OpenGl_OCCT_TEXTURE_ENABLE,
OpenGl_OCCT_DISTINGUISH_MODE,
OpenGl_OCCT_FRONT_MATERIAL,
OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES
};
-class OpenGl_ShaderProgram;
-
//! Interface for generic setter of user-defined uniform variables.
struct OpenGl_SetterInterface
{
};
//! Wrapper for OpenGL program object.
-class OpenGl_ShaderProgram : public OpenGl_Resource
+class OpenGl_ShaderProgram : public OpenGl_NamedResource
{
friend class OpenGl_View;
-
+ friend class OpenGl_ShaderManager;
+ DEFINE_STANDARD_RTTIEXT(OpenGl_ShaderProgram, OpenGl_NamedResource)
public:
//! Non-valid shader name.
//! Destroys shader program.
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
+ //! Returns estimated GPU memory usage - cannot be easily estimated.
+ virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
+
//! Attaches shader object to the program object.
Standard_EXPORT Standard_Boolean AttachShader (const Handle(OpenGl_Context)& theCtx,
const Handle(OpenGl_ShaderObject)& theShader);
return myProgramID;
}
+public:
+
+ //! Return TRUE if program defines tessellation stage.
+ Standard_Boolean HasTessellationStage() const { return myHasTessShader; }
+
+ //! Return the length of array of light sources (THE_MAX_LIGHTS),
+ //! to be used for initialization occLightSources (OpenGl_OCC_LIGHT_SOURCE_PARAMS).
+ Standard_Integer NbLightsMax() const { return myNbLightsMax; }
+
+ //! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES),
+ //! to be used for initialization occClipPlaneEquations (OpenGl_OCC_CLIP_PLANE_EQUATIONS).
+ Standard_Integer NbClipPlanesMax() const { return myNbClipPlanesMax; }
+
+ //! Return the length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS),
+ //! to be used for initialization occFragColorArray/occFragColorN.
+ Standard_Integer NbFragmentOutputs() const { return myNbFragOutputs; }
+
+ //! Return true if Fragment Shader color should output the weighted OIT coverage; FALSE by default.
+ Standard_Boolean HasWeightOitOutput() const { return myHasWeightOitOutput; }
+
private:
//! Returns index of last modification of variables of specified state type.
//! Specifies the value of the sampler uniform variable.
Standard_EXPORT Standard_Boolean SetSampler (const Handle(OpenGl_Context)& theCtx,
const GLchar* theName,
- const GLenum theTextureUnit);
+ const Graphic3d_TextureUnit theTextureUnit);
//! Specifies the value of the sampler uniform variable.
Standard_EXPORT Standard_Boolean SetSampler (const Handle(OpenGl_Context)& theCtx,
GLint theLocation,
- const GLenum theTextureUnit);
+ const Graphic3d_TextureUnit theTextureUnit);
protected:
OpenGl_ShaderList myShaderObjects; //!< List of attached shader objects
Handle(Graphic3d_ShaderProgram) myProxy; //!< Proxy shader program (from application layer)
Standard_Integer myShareCount; //!< program users count, initialized with 1 (already shared by one user)
+ Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS)
+ Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES)
+ Standard_Integer myNbFragOutputs; //!< length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS)
+ Standard_Boolean myHasWeightOitOutput; //!< flag indicating that Fragment Shader includes weighted OIT coverage
+ Standard_Boolean myHasTessShader; //!< flag indicating that program defines tessellation stage
protected:
//! Stores locations of OCCT state uniform variables.
GLint myStateLocations[OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES];
-public:
-
- DEFINE_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource)
- friend class OpenGl_ShaderManager;
-
};
template<class T>