Skip to content

Commit

Permalink
Merge pull request OGRECave#319 from paroj/glcleanup
Browse files Browse the repository at this point in the history
Glcleanup
  • Loading branch information
paroj authored Jan 21, 2017
2 parents db0a3c8 + b869bb3 commit dbb8bd4
Show file tree
Hide file tree
Showing 20 changed files with 206 additions and 461 deletions.
4 changes: 4 additions & 0 deletions OgreMain/src/OgreHighLevelGpuProgram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ namespace Ogre
}

}
catch (const RuntimeAssertionException&)
{
throw;
}
catch (const Exception& e)
{
// will already have been logged
Expand Down
1 change: 1 addition & 0 deletions OgreMain/src/OgreResourceGroupManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ namespace Ogre {
const String& resourceName, const String& groupName,
bool searchGroupsIfNotFound, Resource* resourceBeingLoaded) const
{
OgreAssert(!resourceName.empty(), "resourceName is empty string");
OGRE_LOCK_AUTO_MUTEX;

if(mLoadingListener)
Expand Down
10 changes: 8 additions & 2 deletions RenderSystems/GL/src/OgreGLGpuProgramManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ Resource* GLGpuProgramManager::createImpl(const String& name, ResourceHandle han
{
// No factory, this is an unsupported syntax code, probably for another rendersystem
// Create a basic one, it doesn't matter what it is since it won't be used
return new GLGpuProgram(this, name, handle, group, isManual, loader);
// we have to forward the syntax code though
GpuProgram* ret = new GLGpuProgram(this, name, handle, group, isManual, loader);
ret->setSyntaxCode(paramSyntax->second);
return ret;
}

GpuProgramType gpt;
Expand Down Expand Up @@ -108,7 +111,10 @@ Resource* GLGpuProgramManager::createImpl(const String& name, ResourceHandle han
{
// No factory, this is an unsupported syntax code, probably for another rendersystem
// Create a basic one, it doesn't matter what it is since it won't be used
return new GLGpuProgram(this, name, handle, group, isManual, loader);
// we have to forward the syntax code though
GpuProgram* ret = new GLGpuProgram(this, name, handle, group, isManual, loader);
ret->setSyntaxCode(syntaxCode);
return ret;
}

return (iter->second)(this, name, handle, group, isManual, loader, gptype, syntaxCode);
Expand Down
10 changes: 8 additions & 2 deletions RenderSystems/GL3Plus/src/GLSL/OgreGLSLShaderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ namespace Ogre {
{
// No factory, this is an unsupported syntax code, probably for another rendersystem
// Create a basic one, it doesn't matter what it is since it won't be used
return new GLSLShader(this, name, handle, group, isManual, loader);
// we have to forward the syntax code though
GpuProgram* ret = new GLSLShader(this, name, handle, group, isManual, loader);
ret->setSyntaxCode(paramSyntax->second);
return ret;
}

GpuProgramType gpt;
Expand Down Expand Up @@ -135,7 +138,10 @@ namespace Ogre {
{
// No factory, this is an unsupported syntax code, probably for another rendersystem
// Create a basic one, it doesn't matter what it is since it won't be used
return new GLSLShader(this, name, handle, group, isManual, loader);
// we have to forward the syntax code though
GpuProgram* ret = new GLSLShader(this, name, handle, group, isManual, loader);
ret->setSyntaxCode(syntaxCode);
return ret;
}

return (iter->second)(this, name, handle, group, isManual, loader, gptype, syntaxCode);
Expand Down
72 changes: 0 additions & 72 deletions RenderSystems/GLES2/include/OgreGLES2GpuProgram.h

This file was deleted.

7 changes: 3 additions & 4 deletions RenderSystems/GLES2/include/OgreGLES2RenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ THE SOFTWARE.

#include "OgreMaterialManager.h"
#include "OgreRenderSystem.h"
#include "OgreGLES2GpuProgram.h"
#include "OgreGLSLESProgram.h"
#include "OgreGLRenderSystemCommon.h"

namespace Ogre {
Expand All @@ -52,7 +52,6 @@ namespace Ogre {
#if !OGRE_NO_GLES2_CG_SUPPORT
class GLSLESCgProgramFactory;
#endif
class GLSLESGpuProgram;
class HardwareBufferManager;
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_EMSCRIPTEN
class GLES2ManagedResourceManager;
Expand Down Expand Up @@ -129,8 +128,8 @@ namespace Ogre {

GLint getCombinedMinMipFilter(void) const;

GLES2GpuProgram* mCurrentVertexProgram;
GLES2GpuProgram* mCurrentFragmentProgram;
GLSLESProgram* mCurrentVertexProgram;
GLSLESProgram* mCurrentFragmentProgram;

GLint getTextureAddressingMode(TextureUnitState::TextureAddressingMode tam) const;
GLenum getBlendMode(SceneBlendFactor ogreBlend) const;
Expand Down
79 changes: 0 additions & 79 deletions RenderSystems/GLES2/src/GLSLES/include/OgreGLSLESGpuProgram.h

This file was deleted.

16 changes: 16 additions & 0 deletions RenderSystems/GLES2/src/GLSLES/include/OgreGLSLESProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ namespace Ogre {
/// compile source into shader object
bool compile( const bool checkErrors = false);

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

/// Execute the binding functions for this program
void bindProgram(void);
/// Execute the unbinding functions for this program
void unbindProgram(void);
/// Execute the param binding functions for this program
void bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask);
/// Execute the shared param binding functions for this program
void bindProgramSharedParameters(GpuProgramParametersSharedPtr params, uint16 mask);
/// Execute the pass iteration param binding functions for this program
void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);

size_t calculateSize(void) const;

protected:
#if !OGRE_NO_GLES2_GLSL_OPTIMISER
static CmdOptimisation msCmdOptimisation;
Expand Down
Loading

0 comments on commit dbb8bd4

Please sign in to comment.