|
@@ -80,28 +80,16 @@ namespace Ogre {
|
|
|
protected:
|
|
protected:
|
|
|
/// The type of the program
|
|
/// The type of the program
|
|
|
GpuProgramType mType;
|
|
GpuProgramType mType;
|
|
|
|
|
+ /// Does this (geometry) program require adjacency information?
|
|
|
|
|
+ bool mNeedsAdjacencyInfo;
|
|
|
/// Name of the shader entry method
|
|
/// Name of the shader entry method
|
|
|
String mEntryPoint;
|
|
String mEntryPoint;
|
|
|
/// Shader profiler that we are targeting (e.g. vs_1_1, etc.). Make sure profile matches the type.
|
|
/// Shader profiler that we are targeting (e.g. vs_1_1, etc.). Make sure profile matches the type.
|
|
|
GpuProgramProfile mProfile;
|
|
GpuProgramProfile mProfile;
|
|
|
- /// The name of the file to load source from (may be blank)
|
|
|
|
|
- String mFilename;
|
|
|
|
|
/// The assembler source of the program (may be blank until file loaded)
|
|
/// The assembler source of the program (may be blank until file loaded)
|
|
|
String mSource;
|
|
String mSource;
|
|
|
- /// Whether we need to load source from file or not
|
|
|
|
|
- bool mLoadFromFile;
|
|
|
|
|
/// Syntax code e.g. arbvp1, vs_2_0 etc
|
|
/// Syntax code e.g. arbvp1, vs_2_0 etc
|
|
|
String mSyntaxCode;
|
|
String mSyntaxCode;
|
|
|
- /// Does this (vertex) program include skeletal animation?
|
|
|
|
|
- bool mSkeletalAnimation;
|
|
|
|
|
- /// Does this (vertex) program include morph animation?
|
|
|
|
|
- bool mMorphAnimation;
|
|
|
|
|
- /// Does this (vertex) program include pose animation (count of number of poses supported)
|
|
|
|
|
- ushort mPoseAnimation;
|
|
|
|
|
- /// Does this (vertex) program require support for vertex texture fetch?
|
|
|
|
|
- bool mVertexTextureFetch;
|
|
|
|
|
- /// Does this (geometry) program require adjacency information?
|
|
|
|
|
- bool mNeedsAdjacencyInfo;
|
|
|
|
|
/// The default parameters for use with this object
|
|
/// The default parameters for use with this object
|
|
|
GpuProgramParametersSharedPtr mDefaultParams;
|
|
GpuProgramParametersSharedPtr mDefaultParams;
|
|
|
/// Did we encounter a compilation error?
|
|
/// Did we encounter a compilation error?
|
|
@@ -121,20 +109,6 @@ namespace Ogre {
|
|
|
change, this definition will alter, but previous params may reference the old def.
|
|
change, this definition will alter, but previous params may reference the old def.
|
|
|
*/
|
|
*/
|
|
|
mutable GpuNamedConstantsPtr mConstantDefs;
|
|
mutable GpuNamedConstantsPtr mConstantDefs;
|
|
|
- /// File from which to load named constants manually
|
|
|
|
|
- String mManualNamedConstantsFile;
|
|
|
|
|
- bool mLoadedManualNamedConstants;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /** Internal method for setting up the basic parameter definitions for a subclass.
|
|
|
|
|
- @remarks
|
|
|
|
|
- Because StringInterface holds a dictionary of parameters per class, subclasses need to
|
|
|
|
|
- call this to ask the base class to add it's parameters to their dictionary as well.
|
|
|
|
|
- Can't do this in the constructor because that runs in a non-virtual context.
|
|
|
|
|
- @par
|
|
|
|
|
- The subclass must have called it's own createParamDictionary before calling this method.
|
|
|
|
|
- */
|
|
|
|
|
- void setupBaseParamDictionary(void);
|
|
|
|
|
|
|
|
|
|
/** Internal method returns whether required capabilities for this program is supported.
|
|
/** Internal method returns whether required capabilities for this program is supported.
|
|
|
*/
|
|
*/
|
|
@@ -159,12 +133,6 @@ namespace Ogre {
|
|
|
virtual void load(void);
|
|
virtual void load(void);
|
|
|
virtual void unload() {}
|
|
virtual void unload() {}
|
|
|
|
|
|
|
|
- /** Sets the filename of the source assembly for this program.
|
|
|
|
|
- @remarks
|
|
|
|
|
- Setting this will have no effect until you (re)load the program.
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setSourceFile(const String& filename);
|
|
|
|
|
-
|
|
|
|
|
/** Sets the source assembly for this program from an in-memory string.
|
|
/** Sets the source assembly for this program from an in-memory string.
|
|
|
@remarks
|
|
@remarks
|
|
|
Setting this will have no effect until you (re)load the program.
|
|
Setting this will have no effect until you (re)load the program.
|
|
@@ -177,8 +145,6 @@ namespace Ogre {
|
|
|
/** Sets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
|
|
/** Sets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
|
|
|
virtual void setSyntaxCode(const String& syntax);
|
|
virtual void setSyntaxCode(const String& syntax);
|
|
|
|
|
|
|
|
- /** Gets the name of the file used as source for this program. */
|
|
|
|
|
- virtual const String& getSourceFile(void) const { return mFilename; }
|
|
|
|
|
/** Gets the assembler source for this program. */
|
|
/** Gets the assembler source for this program. */
|
|
|
virtual const String& getSource(void) const { return mSource; }
|
|
virtual const String& getSource(void) const { return mSource; }
|
|
|
/// Set the program type (only valid before load)
|
|
/// Set the program type (only valid before load)
|
|
@@ -201,79 +167,6 @@ namespace Ogre {
|
|
|
/** Returns whether this program can be supported on the current renderer and hardware. */
|
|
/** Returns whether this program can be supported on the current renderer and hardware. */
|
|
|
virtual bool isSupported(void) const;
|
|
virtual bool isSupported(void) const;
|
|
|
|
|
|
|
|
- /** Creates a new parameters object compatible with this program definition.
|
|
|
|
|
- @remarks
|
|
|
|
|
- It is recommended that you use this method of creating parameters objects
|
|
|
|
|
- rather than going direct to GpuProgramManager, because this method will
|
|
|
|
|
- populate any implementation-specific extras (like named parameters) where
|
|
|
|
|
- they are appropriate.
|
|
|
|
|
- */
|
|
|
|
|
- virtual GpuProgramParametersSharedPtr createParameters(void);
|
|
|
|
|
-
|
|
|
|
|
- /** Sets whether a vertex program includes the required instructions
|
|
|
|
|
- to perform skeletal animation.
|
|
|
|
|
- @remarks
|
|
|
|
|
- If this is set to true, OGRE will not blend the geometry according to
|
|
|
|
|
- skeletal animation, it will expect the vertex program to do it.
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setSkeletalAnimationIncluded(bool included)
|
|
|
|
|
- { mSkeletalAnimation = included; }
|
|
|
|
|
-
|
|
|
|
|
- /** Returns whether a vertex program includes the required instructions
|
|
|
|
|
- to perform skeletal animation.
|
|
|
|
|
- @remarks
|
|
|
|
|
- If this returns true, OGRE will not blend the geometry according to
|
|
|
|
|
- skeletal animation, it will expect the vertex program to do it.
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool isSkeletalAnimationIncluded(void) const { return mSkeletalAnimation; }
|
|
|
|
|
-
|
|
|
|
|
- /** Sets whether a vertex program includes the required instructions
|
|
|
|
|
- to perform morph animation.
|
|
|
|
|
- @remarks
|
|
|
|
|
- If this is set to true, OGRE will not blend the geometry according to
|
|
|
|
|
- morph animation, it will expect the vertex program to do it.
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setMorphAnimationIncluded(bool included)
|
|
|
|
|
- { mMorphAnimation = included; }
|
|
|
|
|
-
|
|
|
|
|
- /** Sets whether a vertex program includes the required instructions
|
|
|
|
|
- to perform pose animation.
|
|
|
|
|
- @remarks
|
|
|
|
|
- If this is set to true, OGRE will not blend the geometry according to
|
|
|
|
|
- pose animation, it will expect the vertex program to do it.
|
|
|
|
|
- @param poseCount The number of simultaneous poses the program can blend
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setPoseAnimationIncluded(ushort poseCount)
|
|
|
|
|
- { mPoseAnimation = poseCount; }
|
|
|
|
|
-
|
|
|
|
|
- /** Returns whether a vertex program includes the required instructions
|
|
|
|
|
- to perform morph animation.
|
|
|
|
|
- @remarks
|
|
|
|
|
- If this returns true, OGRE will not blend the geometry according to
|
|
|
|
|
- morph animation, it will expect the vertex program to do it.
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool isMorphAnimationIncluded(void) const { return mMorphAnimation; }
|
|
|
|
|
-
|
|
|
|
|
- /** Returns whether a vertex program includes the required instructions
|
|
|
|
|
- to perform pose animation.
|
|
|
|
|
- @remarks
|
|
|
|
|
- If this returns true, OGRE will not blend the geometry according to
|
|
|
|
|
- pose animation, it will expect the vertex program to do it.
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool isPoseAnimationIncluded(void) const { return mPoseAnimation > 0; }
|
|
|
|
|
- /** Returns the number of simultaneous poses the vertex program can
|
|
|
|
|
- blend, for use in pose animation.
|
|
|
|
|
- */
|
|
|
|
|
- virtual ushort getNumberOfPosesIncluded(void) const { return mPoseAnimation; }
|
|
|
|
|
- /** Sets whether this vertex program requires support for vertex
|
|
|
|
|
- texture fetch from the hardware.
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setVertexTextureFetchRequired(bool r) { mVertexTextureFetch = r; }
|
|
|
|
|
- /** Returns whether this vertex program requires support for vertex
|
|
|
|
|
- texture fetch from the hardware.
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool isVertexTextureFetchRequired(void) const { return mVertexTextureFetch; }
|
|
|
|
|
-
|
|
|
|
|
/** Sets whether this geometry program requires adjacency information
|
|
/** Sets whether this geometry program requires adjacency information
|
|
|
from the input primitives.
|
|
from the input primitives.
|
|
|
*/
|
|
*/
|
|
@@ -282,6 +175,15 @@ namespace Ogre {
|
|
|
from the input primitives.
|
|
from the input primitives.
|
|
|
*/
|
|
*/
|
|
|
virtual bool isAdjacencyInfoRequired(void) const { return mNeedsAdjacencyInfo; }
|
|
virtual bool isAdjacencyInfoRequired(void) const { return mNeedsAdjacencyInfo; }
|
|
|
|
|
+
|
|
|
|
|
+ /** Creates a new parameters object compatible with this program definition.
|
|
|
|
|
+ @remarks
|
|
|
|
|
+ It is recommended that you use this method of creating parameters objects
|
|
|
|
|
+ rather than going direct to GpuProgramManager, because this method will
|
|
|
|
|
+ populate any implementation-specific extras (like named parameters) where
|
|
|
|
|
+ they are appropriate.
|
|
|
|
|
+ */
|
|
|
|
|
+ virtual GpuProgramParametersSharedPtr createParameters(void);
|
|
|
|
|
|
|
|
/** Get a reference to the default parameters which are to be used for all
|
|
/** Get a reference to the default parameters which are to be used for all
|
|
|
uses of this program.
|
|
uses of this program.
|
|
@@ -299,32 +201,6 @@ namespace Ogre {
|
|
|
*/
|
|
*/
|
|
|
virtual bool hasDefaultParameters(void) const { return mDefaultParams != nullptr; }
|
|
virtual bool hasDefaultParameters(void) const { return mDefaultParams != nullptr; }
|
|
|
|
|
|
|
|
- /** Returns whether a vertex program wants light and material states to be passed
|
|
|
|
|
- through fixed pipeline low level API rendering calls (default false, subclasses can override)
|
|
|
|
|
- @remarks
|
|
|
|
|
- Most vertex programs do not need this material information, however GLSL
|
|
|
|
|
- shaders can refer to this material and lighting state so enable this option
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool getPassSurfaceAndLightStates(void) const { return false; }
|
|
|
|
|
-
|
|
|
|
|
- /** Returns whether a fragment program wants fog state to be passed
|
|
|
|
|
- through fixed pipeline low level API rendering calls (default true, subclasses can override)
|
|
|
|
|
- @remarks
|
|
|
|
|
- On DirectX, shader model 2 and earlier continues to have fixed-function fog
|
|
|
|
|
- applied to it, so fog state is still passed (you should disable fog on the
|
|
|
|
|
- pass if you want to perform fog in the shader). In OpenGL it is also
|
|
|
|
|
- common to be able to access the fixed-function fog state inside the shader.
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool getPassFogStates(void) const { return true; }
|
|
|
|
|
-
|
|
|
|
|
- /** Returns whether a vertex program wants transform state to be passed
|
|
|
|
|
- through fixed pipeline low level API rendering calls
|
|
|
|
|
- @remarks
|
|
|
|
|
- Most vertex programs do not need fixed-function transform information, however GLSL
|
|
|
|
|
- shaders can refer to this state so enable this option
|
|
|
|
|
- */
|
|
|
|
|
- virtual bool getPassTransformStates(void) const { return false; }
|
|
|
|
|
-
|
|
|
|
|
/** Returns a string that specifies the language of the gpu programs as specified
|
|
/** Returns a string that specifies the language of the gpu programs as specified
|
|
|
in a material script. ie: asm, cg, hlsl, glsl
|
|
in a material script. ie: asm, cg, hlsl, glsl
|
|
|
*/
|
|
*/
|
|
@@ -338,35 +214,9 @@ namespace Ogre {
|
|
|
*/
|
|
*/
|
|
|
virtual void resetCompileError(void) { mCompileError = false; }
|
|
virtual void resetCompileError(void) { mCompileError = false; }
|
|
|
|
|
|
|
|
- /** Allows you to manually provide a set of named parameter mappings
|
|
|
|
|
- to a program which would not be able to derive named parameters itself.
|
|
|
|
|
- @remarks
|
|
|
|
|
- You may wish to use this if you have assembler programs that were compiled
|
|
|
|
|
- from a high-level source, and want the convenience of still being able
|
|
|
|
|
- to use the named parameters from the original high-level source.
|
|
|
|
|
- @see setManualNamedConstantsFile
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setManualNamedConstants(const GpuNamedConstants& namedConstants);
|
|
|
|
|
-
|
|
|
|
|
/// Get a read-only reference to the named constants registered for this program (manually or automatically)
|
|
/// Get a read-only reference to the named constants registered for this program (manually or automatically)
|
|
|
virtual const GpuNamedConstants& getNamedConstants() const { return *mConstantDefs.get(); }
|
|
virtual const GpuNamedConstants& getNamedConstants() const { return *mConstantDefs.get(); }
|
|
|
|
|
|
|
|
- /** Specifies the name of a file from which to load named parameters mapping
|
|
|
|
|
- for a program which would not be able to derive named parameters itself.
|
|
|
|
|
- @remarks
|
|
|
|
|
- You may wish to use this if you have assembler programs that were compiled
|
|
|
|
|
- from a high-level source, and want the convenience of still being able
|
|
|
|
|
- to use the named parameters from the original high-level source. This
|
|
|
|
|
- method will make a low-level program search in the resource group of the
|
|
|
|
|
- program for the named file from which to load parameter names from.
|
|
|
|
|
- The file must be in the format produced by GpuNamedConstants::save.
|
|
|
|
|
- */
|
|
|
|
|
- virtual void setManualNamedConstantsFile(const String& paramDefFile);
|
|
|
|
|
-
|
|
|
|
|
- /** Gets the name of a file from which to load named parameters mapping
|
|
|
|
|
- for a program which would not be able to derive named parameters itself.
|
|
|
|
|
- */
|
|
|
|
|
- virtual const String& getManualNamedConstantsFile() const { return mManualNamedConstantsFile; }
|
|
|
|
|
/** Get the full list of named constants.
|
|
/** Get the full list of named constants.
|
|
|
@note
|
|
@note
|
|
|
Only available if this parameters object has named parameters, which means either
|
|
Only available if this parameters object has named parameters, which means either
|