Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions RenderSystems/NULL/include/OgreNULLGpuProgramManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE-Next
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2017 Torus Knot Software Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/

#ifndef _OgreNULLGpuProgramManager_H_
#define _OgreNULLGpuProgramManager_H_

#include "OgreNULLPrerequisites.h"

#include "OgreGpuProgramManager.h"

namespace Ogre
{
/** Dummy GpuProgramManager, so that scripts declaring low level programs can be
parsed instead of asserting on a missing singleton.

Every program it hands out is inert: it holds no microcode, compiles nothing
and reports isSupported() == false, since there is no GPU to compile for.
*/
class _OgreNULLExport NULLGpuProgramManager final : public GpuProgramManager
{
protected:
/// @copydoc ResourceManager::createImpl
Resource *createImpl( const String &name, ResourceHandle handle, const String &group,
bool isManual, ManualResourceLoader *loader,
const NameValuePairList *createParams ) 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 ) override;

public:
NULLGpuProgramManager();
~NULLGpuProgramManager() override;
};
} // namespace Ogre

#endif
1 change: 1 addition & 0 deletions RenderSystems/NULL/include/OgreNULLPrerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ THE SOFTWARE.
namespace Ogre
{
// Forward declarations
class NULLGpuProgramManager;
class NULLStagingBuffer;
class NULLRenderSystem;
class NULLVaoManager;
Expand Down
1 change: 1 addition & 0 deletions RenderSystems/NULL/include/OgreNULLRenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace Ogre
bool mInitialized;

v1::HardwareBufferManager *mHardwareBufferManager;
NULLGpuProgramManager *mShaderManager;

ConfigOptionMap mOptions;

Expand Down
97 changes: 97 additions & 0 deletions RenderSystems/NULL/src/OgreNULLGpuProgramManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE-Next
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2017 Torus Knot Software Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/

#include "OgreNULLGpuProgramManager.h"

#include "OgreGpuProgram.h"
#include "OgreResourceGroupManager.h"

namespace Ogre
{
/// The low level counterpart of OgreMain's NullProgram: it exists so a script can
/// declare a program, and does nothing else.
class NULLGpuProgram final : public GpuProgram
{
protected:
void loadFromSource() override {}
void unloadImpl() override {}

public:
NULLGpuProgram( ResourceManager *creator, const String &name, ResourceHandle handle,
const String &group, bool isManual, ManualResourceLoader *loader ) :
GpuProgram( creator, name, handle, group, isManual, loader )
{
}
~NULLGpuProgram() override {}

/// Overridden from GpuProgram - never supported, nothing was compiled
bool isSupported() const override { return false; }

size_t calculateSize() const override { return 0; }

/// Overridden from StringInterface
bool setParameter( const String & /*name*/, const String & /*value*/ ) override
{
// always silently ignore all parameters so as not to report errors on
// unsupported platforms
return true;
}
};
//-----------------------------------------------------------------------------
NULLGpuProgramManager::NULLGpuProgramManager() : GpuProgramManager()
{
// Superclass sets up members

// Register with resource group manager
ResourceGroupManager::getSingleton()._registerResourceManager( mResourceType, this );
}
//-----------------------------------------------------------------------------
NULLGpuProgramManager::~NULLGpuProgramManager()
{
// Unregister with resource group manager
ResourceGroupManager::getSingleton()._unregisterResourceManager( mResourceType );
}
//-----------------------------------------------------------------------------
Resource *NULLGpuProgramManager::createImpl( const String &name, ResourceHandle handle,
const String &group, bool isManual,
ManualResourceLoader *loader,
const NameValuePairList * )
{
// The declaration is accepted whatever it says: syntax and type only matter to a
// compiler, and there is none
return new NULLGpuProgram( this, name, handle, group, isManual, loader );
}
//-----------------------------------------------------------------------------
Resource *NULLGpuProgramManager::createImpl( const String &name, ResourceHandle handle,
const String &group, bool isManual,
ManualResourceLoader *loader, GpuProgramType,
const String & )
{
return new NULLGpuProgram( this, name, handle, group, isManual, loader );
}
} // namespace Ogre
8 changes: 7 additions & 1 deletion RenderSystems/NULL/src/OgreNULLRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Copyright (c) 2000-2014 Torus Knot Software Ltd
#include "OgreNULLRenderSystem.h"

#include "OgreDefaultHardwareBufferManager.h"
#include "OgreNULLGpuProgramManager.h"
#include "OgreNULLTextureGpuManager.h"
#include "OgreNULLWindow.h"
#include "OgreRenderPassDescriptor.h"
Expand All @@ -40,7 +41,8 @@ namespace Ogre
NULLRenderSystem::NULLRenderSystem() :
RenderSystem(),
mInitialized( false ),
mHardwareBufferManager( 0 )
mHardwareBufferManager( 0 ),
mShaderManager( 0 )
{
}
//-------------------------------------------------------------------------
Expand All @@ -50,6 +52,9 @@ namespace Ogre
{
OGRE_DELETE mHardwareBufferManager;
mHardwareBufferManager = 0;

OGRE_DELETE mShaderManager;
mShaderManager = 0;
}
//-------------------------------------------------------------------------
const String &NULLRenderSystem::getName() const
Expand Down Expand Up @@ -143,6 +148,7 @@ namespace Ogre
mHardwareBufferManager = new v1::DefaultHardwareBufferManager();
mVaoManager = OGRE_NEW NULLVaoManager();
mTextureGpuManager = OGRE_NEW NULLTextureGpuManager( mVaoManager, this );
mShaderManager = OGRE_NEW NULLGpuProgramManager();

mInitialized = true;
}
Expand Down
Loading