Skip to content

Commit

Permalink
Add override and finality to GL3+ classes (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Dec 27, 2021
1 parent c6fa55f commit a088029
Show file tree
Hide file tree
Showing 33 changed files with 562 additions and 561 deletions.
12 changes: 6 additions & 6 deletions RenderSystems/GL3Plus/include/GLSL/OgreGLSLMonolithicProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ namespace Ogre {
the program object like GLSLSeparableProgram can. Hence the name
'monolithic'.
*/
class _OgreGL3PlusExport GLSLMonolithicProgram : public GLSLProgram
class _OgreGL3PlusExport GLSLMonolithicProgram final : public GLSLProgram
{
protected:
/// Compiles and links the vertex and fragment programs
void compileAndLink();
void compileAndLink() override;
/// Put a program in use
void _useProgram();

Expand All @@ -69,27 +69,27 @@ namespace Ogre {
/** Makes a program object active by making sure it is linked
and then putting it in use.
*/
void activate();
void activate() override;

/** Updates program object uniforms using data from
GpuProgramParameters. normally called by
GLSLShader::bindParameters() just before rendering
occurs.
*/
void updateUniforms(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType);
void updateUniforms(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType) override;

/** Updates program object uniform blocks using data from
GpuProgramParameters. normally called by
GLSLShader::bindParameters() just before rendering
occurs.
*/
void updateUniformBlocks(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType);
void updateUniformBlocks(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType) override;
/** Updates program object uniforms using data from pass
iteration GpuProgramParameters. normally called by
GLSLShader::bindMultiPassParameters() just before multi
pass rendering occurs.
*/
void updatePassIterationUniforms(GpuProgramParametersSharedPtr params);
void updatePassIterationUniforms(GpuProgramParametersSharedPtr params) override;
};

}
Expand Down
68 changes: 34 additions & 34 deletions RenderSystems/GL3Plus/include/GLSL/OgreGLSLShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,51 +58,51 @@ namespace Ogre {
command. All the modules to be attached are listed on the
same line as the attach command separated by white space.
*/
class _OgreGL3PlusExport GLSLShader : public HighLevelGpuProgram
class _OgreGL3PlusExport GLSLShader final : public HighLevelGpuProgram
{
public:
/// Command object for attaching another GLSL Program
class CmdAttach : public ParamCommand
class CmdAttach final : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& shaderNames);
String doGet(const void* target) const override;
void doSet(void* target, const String& shaderNames) override;
};

/// Command object for setting macro defines
class CmdPreprocessorDefines : public ParamCommand
class CmdPreprocessorDefines final : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& val);
String doGet(const void* target) const override;
void doSet(void* target, const String& val) override;
};
/// Command object for setting the input operation type (geometry shader only)
class _OgreGL3PlusExport CmdInputOperationType : public ParamCommand
class _OgreGL3PlusExport CmdInputOperationType final : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& val);
String doGet(const void* target) const override;
void doSet(void* target, const String& val) override;
};
/// Command object for setting the output operation type (geometry shader only)
class _OgreGL3PlusExport CmdOutputOperationType : public ParamCommand
class _OgreGL3PlusExport CmdOutputOperationType final : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& val);
String doGet(const void* target) const override;
void doSet(void* target, const String& val) override;
};
/// Command object for setting the maximum output vertices (geometry shader only)
class _OgreGL3PlusExport CmdMaxOutputVertices : public ParamCommand
class _OgreGL3PlusExport CmdMaxOutputVertices final : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& val);
String doGet(const void* target) const override;
void doSet(void* target, const String& val) override;
};
/// Command object for setting matrix packing in column-major order
class CmdColumnMajorMatrices : public ParamCommand
class CmdColumnMajorMatrices final : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& val);
String doGet(const void* target) const override;
void doSet(void* target, const String& val) override;
};
/** Returns the operation type that this geometry program expects to
receive as input
Expand Down Expand Up @@ -154,9 +154,9 @@ namespace Ogre {
String getShaderTypeLabel(GpuProgramType programType);

/// Overridden
bool getPassTransformStates() const;
bool getPassSurfaceAndLightStates() const;
bool getPassFogStates() const;
bool getPassTransformStates() const override;
bool getPassSurfaceAndLightStates() const override;
bool getPassFogStates() const override;

/** Attach another GLSL Shader to this one. */
void attachChildShader(const String& name);
Expand All @@ -167,16 +167,16 @@ namespace Ogre {
const String& getPreprocessorDefines() const { return mPreprocessorDefines; }

/// Overridden from GpuProgram
const String& getLanguage() const;
const String& getLanguage() const override;
/** Sets whether matrix packing in column-major order. */
void setColumnMajorMatrices(bool columnMajor) { mColumnMajorMatrices = columnMajor; }
/** Gets whether matrix packed in column-major order. */
bool getColumnMajorMatrices() const { return mColumnMajorMatrices; }

virtual void setReplaceVersionMacro( bool bReplace );
void setReplaceVersionMacro( bool bReplace ) override;

/// Overridden from GpuProgram
GpuProgramParametersSharedPtr createParameters();
GpuProgramParametersSharedPtr createParameters() override;

/// Compile source into shader object
bool compile( const bool checkErrors = false);
Expand Down Expand Up @@ -206,13 +206,13 @@ namespace Ogre {
void setLinked(GLint flag) { mLinked = flag; }

/// @copydoc Resource::calculateSize
size_t calculateSize() const;
size_t calculateSize() const override;

/// Get the OGRE assigned shader ID.
GLuint getShaderID() const { return mShaderID; }

/// Since GLSL has no assembly, use this shader for binding.
GpuProgram* _getBindingDelegate() { return this; }
GpuProgram* _getBindingDelegate() override { return this; }

protected:
static CmdPreprocessorDefines msCmdPreprocessorDefines;
Expand All @@ -226,23 +226,23 @@ namespace Ogre {

/** Internal load implementation, must be implemented by subclasses.
*/
void loadFromSource();
void loadFromSource() override;
/** Internal method for creating a dummy low-level program for
this high-level program. GLSL does not give access to the
low level implementation of the shader so this method
creates an object sub-classed from GL3PlusShader just to
be compatible with GL3PlusRenderSystem.
*/
void createLowLevelImpl();
void createLowLevelImpl() override;
/// Internal unload implementation, must be implemented by subclasses
void unloadHighLevelImpl();
void unloadHighLevelImpl() override;
/// Overridden from HighLevelGpuProgram
void unloadImpl();
void unloadImpl() override;

/// Populate the passed parameters with name->index map
void populateParameterNames(GpuProgramParametersSharedPtr params);
void populateParameterNames(GpuProgramParametersSharedPtr params) override;
/// Populate the passed parameters with name->index map, must be overridden
void buildConstantDefinitions() const;
void buildConstantDefinitions() const override;
/** Check the compile result for an error with default
precision - and recompile if needed. some glsl compilers
return an error default precision is set to types other
Expand All @@ -252,7 +252,7 @@ namespace Ogre {
*/
void checkAndFixInvalidDefaultPrecisionError( String &message );

virtual void setUniformBlockBinding( const char *blockName, uint32 bindingSlot );
void setUniformBlockBinding( const char *blockName, uint32 bindingSlot ) override;


// /// @copydoc Resource::loadImpl
Expand Down
14 changes: 7 additions & 7 deletions RenderSystems/GL3Plus/include/GLSL/OgreGLSLShaderFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ namespace Ogre
{
/** Factory class for GLSL shaders.
*/
class _OgreGL3PlusExport GLSLShaderFactory : public HighLevelGpuProgramFactory
class _OgreGL3PlusExport GLSLShaderFactory final : public HighLevelGpuProgramFactory
{
protected:
static String mLanguageName;

public:
GLSLShaderFactory(const GL3PlusSupport& support);
~GLSLShaderFactory();
~GLSLShaderFactory() override;
/// Get the name of the language this factory creates shaders for.
const String& getLanguage() const;
const String& getLanguage() const override;
/// Create an instance of GLSLProgram.
HighLevelGpuProgram* create(ResourceManager* creator,
const String& name, ResourceHandle handle,
const String& group, bool isManual, ManualResourceLoader* loader);
void destroy(HighLevelGpuProgram* prog);
HighLevelGpuProgram *create( ResourceManager *creator, const String &name, ResourceHandle handle,
const String &group, bool isManual,
ManualResourceLoader *loader ) override;
void destroy( HighLevelGpuProgram *prog ) override;

private:
static GLSLMonolithicProgramManager* mMonolithicProgramManager;
Expand Down
17 changes: 9 additions & 8 deletions RenderSystems/GL3Plus/include/GLSL/OgreGLSLShaderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Ogre {
//TODO A brief description of what purpose this class serves in GL3+.
// Seems to primarily serve the purpose of creating GpuProgram's based
// on material script programs. Also handles cache creation.
class _OgreGL3PlusExport GLSLShaderManager : public GpuProgramManager
class _OgreGL3PlusExport GLSLShaderManager final : public GpuProgramManager
{
public:
typedef GpuProgram* (*CreateGpuProgramCallback)(ResourceManager* creator,
Expand All @@ -51,17 +51,18 @@ namespace Ogre {

protected:
/// @copydoc ResourceManager::createImpl
Resource* createImpl(const String& name, ResourceHandle handle,
const String& group, bool isManual, ManualResourceLoader* loader,
const NameValuePairList* params);
Resource *createImpl( const String &name, ResourceHandle handle, const String &group,
bool isManual, ManualResourceLoader *loader,
const NameValuePairList *params ) override;
/// Specialised create method with specific parameters.
Resource* createImpl(const String& name, ResourceHandle handle,
const String& group, bool isManual, ManualResourceLoader* loader,
GpuProgramType gptype, const String& syntaxCode);
Resource *createImpl( const String &name, ResourceHandle handle, const String &group,
bool isManual, ManualResourceLoader *loader, GpuProgramType gptype,
const String &syntaxCode ) override;

public:
GLSLShaderManager();
virtual ~GLSLShaderManager();
~GLSLShaderManager() override;

bool registerShaderFactory(const String& syntaxCode, CreateGpuProgramCallback createFn);
bool unregisterShaderFactory(const String& syntaxCode);
};
Expand Down
14 changes: 7 additions & 7 deletions RenderSystems/GL3Plus/include/OgreGL3PlusAsyncTextureTicket.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Ogre
{
/** See AsyncTextureTicket
*/
class _OgreGL3PlusExport GL3PlusAsyncTextureTicket : public AsyncTextureTicket
class _OgreGL3PlusExport GL3PlusAsyncTextureTicket final : public AsyncTextureTicket
{
protected:
GLuint mVboName;
Expand All @@ -53,23 +53,23 @@ namespace Ogre

GLuint createBuffer( uint32 width, uint32 height, uint32 depthOrSlices );

virtual TextureBox mapImpl( uint32 slice );
virtual void unmapImpl();
TextureBox mapImpl( uint32 slice ) override;
void unmapImpl() override;

void waitForDownloadToFinish();

virtual void downloadFromGpu( TextureGpu *textureSrc, uint8 mipLevel,
bool accurateTracking, TextureBox *srcBox=0 );
void downloadFromGpu( TextureGpu *textureSrc, uint8 mipLevel,
bool accurateTracking, TextureBox *srcBox=0 ) override;

public:
GL3PlusAsyncTextureTicket( uint32 width, uint32 height, uint32 depthOrSlices,
TextureTypes::TextureTypes textureType,
PixelFormatGpu pixelFormatFamily,
GL3PlusVaoManager *vaoManager,
bool supportsGetTextureSubImage );
virtual ~GL3PlusAsyncTextureTicket();
~GL3PlusAsyncTextureTicket() override;

virtual bool queryIsTransferDone();
bool queryIsTransferDone() override;
};
}

Expand Down
Loading

0 comments on commit a088029

Please sign in to comment.