Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::GpuProgram Class Reference

Defines a program which runs on the GPU such as a vertex or fragment program. More...

#include <OgreGpuProgram.h>

Inheritance diagram for Ogre::GpuProgram:

Inheritance graph
[legend]
List of all members.

Public Methods

 GpuProgram (const String &name, GpuProgramType gptype, const String &syntaxCode)
virtual ~GpuProgram ()
virtual void setSourceFile (const String &filename)
 Sets the filename of the source assembly for this program.

virtual void setSource (const String &source)
 Sets the source assembly for this program from an in-memory string.

virtual const StringgetSyntaxCode (void) const
 Gets the syntax code for this program e.g.

virtual const StringgetSourceFile (void) const
 Gets the name of the file used as source for this program.

virtual const StringgetSource (void) const
 Gets the assembler source for this program.

virtual GpuProgramType getType (void) const
 Get the program type.

void load (void)
 @copydoc Resource::load

virtual GpuProgram * _getBindingDelegate (void)
 Returns the GpuProgram which should be bound to the pipeline.

virtual bool isSupported (void) const
 Returns whether this program can be supported on the current renderer and hardware.

virtual GpuProgramParametersSharedPtr createParameters (void)
 Creates a new parameters object compatible with this program definition.

virtual void setSkeletalAnimationIncluded (bool included)
 Sets whether a vertex program includes the required instructions to perform skeletal animation.

virtual bool isSkeletalAnimationIncluded (void) const
 Returns whether a vertex program includes the required instructions to perform skeletal animation.

virtual void unload ()
 Unloads the resource, but retains data to recreate.

virtual size_t getSize (void) const
 Retrieves info about the size of the resource.

virtual void touch (void)
 'Touches' the resource to indicate it has been used.

time_t getLastAccess (void) const
 Gets the last time the resource was 'touched'.

const StringgetName (void) const
 Gets resource name.

ResourceHandle getHandle (void) const
bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise.

virtual void destroy ()
 A method to make the resource delete itself.


Protected Methods

virtual void loadFromSource (void)=0
 Virtual method which must be implemented by subclasses, load from mSource.


Protected Attributes

GpuProgramType mType
 The type of the program.

String mFilename
 The name of the file to load source from (may be blank).

String mSource
 The assembler source of the program (may be blank until file loaded).

bool mLoadFromFile
 Whether we need to load source from file or not.

String mSyntaxCode
 Syntax code eg arbvp1, vs_2_0 etc.

bool mSkeletalAnimation
 Does this (vertex) program include skeletal animation?

String mName
ResourceHandle mHandle
bool mIsLoaded
time_t mLastAccess
size_t mSize

Detailed Description

Defines a program which runs on the GPU such as a vertex or fragment program.

Remarks:
This class defines the low-level program in assembler code, the sort used to directly assemble into machine instructions for the GPU to execute. By nature, this means that the assembler source is rendersystem specific, which is why this is an abstract class - real instances are created through the RenderSystem. If you wish to use higher level shading languages like HLSL and Cg, you need to use the HighLevelGpuProgram class instead.

Definition at line 455 of file OgreGpuProgram.h.


Constructor & Destructor Documentation

Ogre::GpuProgram::GpuProgram const String   name,
GpuProgramType    gptype,
const String   syntaxCode
 

Definition at line 41 of file OgreGpuProgram.cpp.

References Ogre::GpuProgramType, and Ogre::Resource::mName.

virtual Ogre::GpuProgram::~GpuProgram   [virtual]
 

Definition at line 474 of file OgreGpuProgram.h.

References Ogre::GpuProgramType.


Member Function Documentation

virtual GpuProgram* Ogre::GpuProgram::_getBindingDelegate void    [virtual]
 

Returns the GpuProgram which should be bound to the pipeline.

Remarks:
This method is simply to allow some subclasses of GpuProgram to delegate the program which is bound to the pipeline to a delegate, if required.

Reimplemented in Ogre::HighLevelGpuProgram.

Definition at line 504 of file OgreGpuProgram.h.

Referenced by Ogre::SceneManager::renderShadowVolumesToStencil(), and Ogre::SceneManager::setPass().

GpuProgramParametersSharedPtr Ogre::GpuProgram::createParameters void    [virtual]
 

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.

Reimplemented in Ogre::HighLevelGpuProgram, and Ogre::D3D9HLSLProgram.

Definition at line 94 of file OgreGpuProgram.cpp.

References Ogre::GpuProgramParametersSharedPtr.

Referenced by Ogre::GpuProgramUsage::setProgram(), and Ogre::GpuProgramUsage::setProgramName().

virtual void Ogre::Resource::destroy void    [virtual, inherited]
 

A method to make the resource delete itself.

Note:
This exists because Resource objects could be created in other processes, and they need to be destroyed in the process that created them.

Definition at line 137 of file OgreResource.h.

ResourceHandle Ogre::Resource::getHandle void    const [inherited]
 

Definition at line 120 of file OgreResource.h.

References Ogre::ResourceHandle.

Referenced by Ogre::Material::clone(), Ogre::BspLevel::loadQuake3Level(), and Ogre::ResourceManager::unload().

time_t Ogre::Resource::getLastAccess void    const [inherited]
 

Gets the last time the resource was 'touched'.

Definition at line 108 of file OgreResource.h.

const String& Ogre::Resource::getName void    const [inherited]
 

Gets resource name.

Reimplemented in Ogre::Material, and Ogre::Overlay.

Definition at line 115 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_loadCubeTex(), Ogre::Mesh::_notifySkeleton(), Ogre::ResourceManager::add(), Ogre::PopupMenuGuiElement::addListItem(), Ogre::ListGuiElement::addListItem(), Ogre::PopupMenuGuiElement::addMenuItem(), Ogre::MeshManager::createPrefabPlane(), Ogre::TTYGuiElement::getFontName(), Ogre::TextAreaGuiElement::getFontName(), Ogre::PopupMenuGuiElement::getListItemName(), Ogre::ListGuiElement::getListItemName(), Ogre::GpuProgramUsage::getProgramName(), Ogre::MeshSerializer::importMesh(), Ogre::GLTexture::load(), Ogre::TextureManager::loadImage(), Ogre::TextureManager::loadRawData(), Ogre::FontManager::logBadAttrib(), Ogre::MeshSerializerImpl_v1::readMaterial(), Ogre::MeshSerializerImpl::readMeshLodInfo(), Ogre::MeshSerializerImpl_v1::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readMeshLodUsageManual(), Ogre::PopupMenuGuiElement::removeListItem(), Ogre::ListGuiElement::removeListItem(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), and Ogre::ResourceManager::unload().

virtual size_t Ogre::Resource::getSize void    const [virtual, inherited]
 

Retrieves info about the size of the resource.

Definition at line 93 of file OgreResource.h.

Referenced by Ogre::ResourceManager::unload().

virtual const String& Ogre::GpuProgram::getSource void    const [virtual]
 

Gets the assembler source for this program.

Definition at line 494 of file OgreGpuProgram.h.

virtual const String& Ogre::GpuProgram::getSourceFile void    const [virtual]
 

Gets the name of the file used as source for this program.

Definition at line 492 of file OgreGpuProgram.h.

virtual const String& Ogre::GpuProgram::getSyntaxCode void    const [virtual]
 

Gets the syntax code for this program e.g.

arbvp1, fp20, vs_1_1 etc

Definition at line 489 of file OgreGpuProgram.h.

virtual GpuProgramType Ogre::GpuProgram::getType void    const [virtual]
 

Get the program type.

Definition at line 496 of file OgreGpuProgram.h.

Referenced by Ogre::GLRenderSystem::bindGpuProgram(), and Ogre::D3D9RenderSystem::bindGpuProgram().

bool Ogre::Resource::isLoaded void    const [inherited]
 

Returns true if the Resource has been loaded, false otherwise.

Definition at line 127 of file OgreResource.h.

Referenced by Ogre::GpuProgramUsage::_load(), Ogre::SceneManager::deriveShadowCasterPass(), Ogre::SceneManager::deriveShadowReceiverPass(), Ogre::Technique::isLoaded(), Ogre::D3D9Texture::load(), Ogre::D3D9Texture::unload(), and Ogre::D3D9Texture::~D3D9Texture().

virtual bool Ogre::GpuProgram::isSkeletalAnimationIncluded void    const [virtual]
 

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.

Definition at line 533 of file OgreGpuProgram.h.

Referenced by isSupported(), Ogre::D3D9HLSLProgram::isSupported(), Ogre::CgProgram::isSupported(), and Ogre::Entity::reevaluateVertexProcessing().

bool Ogre::GpuProgram::isSupported void    const [virtual]
 

Returns whether this program can be supported on the current renderer and hardware.

Reimplemented in Ogre::CgProgram, and Ogre::D3D9HLSLProgram.

Definition at line 82 of file OgreGpuProgram.cpp.

References isSkeletalAnimationIncluded(), mSyntaxCode, and Ogre::RSC_VERTEX_FORMAT_UBYTE4.

Referenced by Ogre::Technique::_compile(), Ogre::HighLevelGpuProgram::createParameters(), Ogre::parseFragmentProgramRef(), Ogre::parseParamIndexed(), Ogre::parseParamIndexedAuto(), Ogre::parseParamNamed(), Ogre::parseParamNamedAuto(), Ogre::parseShadowCasterVertexProgramRef(), Ogre::parseShadowReceiverVertexProgramRef(), and Ogre::parseVertexProgramRef().

void Ogre::GpuProgram::load void    [virtual]
 

@copydoc Resource::load

Implements Ogre::Resource.

Reimplemented in Ogre::HighLevelGpuProgram, and Ogre::D3D9GpuProgram.

Definition at line 62 of file OgreGpuProgram.cpp.

References Ogre::DataChunk::getAsString(), loadFromSource(), mFilename, Ogre::Resource::mIsLoaded, mSource, and Ogre::Resource::unload().

Referenced by Ogre::GpuProgramUsage::_load(), Ogre::SceneManager::deriveShadowCasterPass(), Ogre::SceneManager::deriveShadowReceiverPass(), Ogre::ShadowVolumeExtrudeProgram::initialise(), and Ogre::HighLevelGpuProgram::load().

virtual void Ogre::GpuProgram::loadFromSource void    [protected, pure virtual]
 

Virtual method which must be implemented by subclasses, load from mSource.

Implemented in Ogre::CgProgram, Ogre::D3D7GpuProgram, Ogre::D3D9GpuProgram, Ogre::D3D9HLSLProgram, Ogre::GLGpuNvparseProgram, Ogre::GLGpuProgram, and Ogre::GLArbGpuProgram.

Referenced by load(), and Ogre::HighLevelGpuProgram::loadHighLevelImpl().

virtual void Ogre::GpuProgram::setSkeletalAnimationIncluded bool    included [virtual]
 

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.

Definition at line 524 of file OgreGpuProgram.h.

Referenced by Ogre::MaterialSerializer::finishProgramDefinition().

void Ogre::GpuProgram::setSource const String   source [virtual]
 

Sets the source assembly for this program from an in-memory string.

Remarks:
Setting this will have no effect until you (re)load the program.

Definition at line 54 of file OgreGpuProgram.cpp.

References mFilename, mLoadFromFile, and mSource.

Referenced by Ogre::GpuProgramManager::createProgramFromString(), and Ogre::GpuProgramManager::loadFromString().

void Ogre::GpuProgram::setSourceFile const String   filename [virtual]
 

Sets the filename of the source assembly for this program.

Remarks:
Setting this will have no effect until you (re)load the program.

Definition at line 47 of file OgreGpuProgram.cpp.

References mFilename, mLoadFromFile, and mSource.

Referenced by Ogre::GpuProgramManager::createProgram(), Ogre::MaterialSerializer::finishProgramDefinition(), and Ogre::GpuProgramManager::load().

virtual void Ogre::Resource::touch void    [virtual, inherited]
 

'Touches' the resource to indicate it has been used.

Reimplemented in Ogre::Material.

Definition at line 100 of file OgreResource.h.

Referenced by Ogre::Mesh::clone(), Ogre::MeshManager::createCurvedIllusionPlane(), Ogre::MeshManager::createCurvedPlane(), Ogre::MeshManager::createPlane(), and Ogre::ResourceManager::load().

virtual void Ogre::Resource::unload void    [virtual, inherited]
 

Unloads the resource, but retains data to recreate.

Reimplemented in Ogre::ArchiveEx, Ogre::DynLib, Ogre::Font, Ogre::HighLevelGpuProgram, Ogre::Material, Ogre::Mesh, Ogre::Overlay, Ogre::Skeleton, Ogre::SkeletonInstance, Ogre::Zip, Ogre::BspLevel, Ogre::Quake3Shader, Ogre::D3DTexture, Ogre::D3D9GpuVertexProgram, Ogre::D3D9GpuFragmentProgram, Ogre::D3D9Texture, Ogre::GLGpuNvparseProgram, Ogre::GLArbGpuProgram, and Ogre::GLTexture.

Definition at line 89 of file OgreResource.h.

Referenced by load(), Ogre::D3D9GpuProgram::load(), Ogre::ResourceManager::unload(), Ogre::HighLevelGpuProgram::unload(), and Ogre::D3D7RenderTexture::~D3D7RenderTexture().


Member Data Documentation

String Ogre::GpuProgram::mFilename [protected]
 

The name of the file to load source from (may be blank).

Definition at line 461 of file OgreGpuProgram.h.

Referenced by load(), Ogre::D3D9GpuProgram::load(), Ogre::HighLevelGpuProgram::loadHighLevelImpl(), setSource(), and setSourceFile().

ResourceHandle Ogre::Resource::mHandle [protected, inherited]
 

Definition at line 57 of file OgreResource.h.

Referenced by Ogre::ResourceManager::add(), Ogre::Material::clone(), Ogre::Material::copyDetailsTo(), and Ogre::Material::operator=().

bool Ogre::Resource::mIsLoaded [protected, inherited]
 

Definition at line 58 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_initMembers(), Ogre::D3D9Texture::_loadCubeTex(), Ogre::D3D9Texture::_loadNormTex(), Ogre::D3D9Texture::_loadVolumeTex(), Ogre::Material::_notifyNeedsRecompile(), Ogre::Material::clone(), Ogre::D3DTexture::createSurface2D(), Ogre::D3DTexture::createSurface3D(), Ogre::D3D9Texture::D3D9Texture(), Ogre::D3DTexture::D3DTexture(), Ogre::DynLib::DynLib(), Ogre::Zip::load(), Ogre::SkeletonInstance::load(), Ogre::Skeleton::load(), Ogre::PatchMesh::load(), Ogre::Mesh::load(), Ogre::Material::load(), Ogre::HighLevelGpuProgram::load(), load(), Ogre::GLTexture::load(), Ogre::Font::load(), Ogre::DynLib::load(), Ogre::D3D9Texture::load(), Ogre::D3D9GpuProgram::load(), Ogre::D3DTexture::load(), Ogre::BspLevel::load(), Ogre::D3D9Texture::loadImage(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), Ogre::Material::Material(), Ogre::Material::operator=(), Ogre::Skeleton::unload(), Ogre::Mesh::unload(), Ogre::Material::unload(), Ogre::HighLevelGpuProgram::unload(), Ogre::GLTexture::unload(), Ogre::Font::unload(), Ogre::DynLib::unload(), Ogre::D3D9Texture::unload(), Ogre::D3DTexture::unload(), and Ogre::BspLevel::~BspLevel().

time_t Ogre::Resource::mLastAccess [protected, inherited]
 

Definition at line 59 of file OgreResource.h.

Referenced by Ogre::Material::operator=().

bool Ogre::GpuProgram::mLoadFromFile [protected]
 

Whether we need to load source from file or not.

Definition at line 465 of file OgreGpuProgram.h.

Referenced by setSource(), and setSourceFile().

String Ogre::Resource::mName [protected, inherited]
 

Definition at line 56 of file OgreResource.h.

Referenced by Ogre::Skeleton::_dumpContents(), Ogre::Mesh::_rationaliseBoneAssignments(), Ogre::BspLevel::BspLevel(), Ogre::Mesh::buildEdgeList(), Ogre::Mesh::buildTangentVectors(), Ogre::Material::clone(), Ogre::Material::compile(), Ogre::Material::copyDetailsTo(), Ogre::Quake3Shader::createAsMaterial(), Ogre::D3D9HLSLProgram::createLowLevelImpl(), Ogre::CgProgram::createLowLevelImpl(), Ogre::Font::createTextureFromFont(), Ogre::D3D9Texture::D3D9Texture(), Ogre::D3DTexture::D3DTexture(), Ogre::DynLib::DynLib(), Ogre::Font::Font(), Ogre::Mesh::generateLodLevels(), Ogre::Material::getBestTechnique(), Ogre::Overlay::getName(), Ogre::Material::getName(), Ogre::GLTexture::GLTexture(), GpuProgram(), Ogre::Zip::load(), Ogre::Skeleton::load(), Ogre::Mesh::load(), Ogre::GLTexture::load(), Ogre::Font::load(), Ogre::DynLib::load(), Ogre::D3DTexture::load(), Ogre::BspLevel::load(), Ogre::D3D9GpuFragmentProgram::loadFromMicrocode(), Ogre::D3D9GpuVertexProgram::loadFromMicrocode(), Ogre::GLArbGpuProgram::loadFromSource(), Ogre::D3D9HLSLProgram::loadFromSource(), Ogre::D3D9GpuProgram::loadFromSource(), Ogre::CgProgram::loadFromSource(), Ogre::GLTexture::loadImages(), Ogre::Material::Material(), Ogre::Mesh::Mesh(), Ogre::Material::operator=(), Ogre::Overlay::Overlay(), Ogre::Quake3Shader::Quake3Shader(), Ogre::CgProgram::selectProfile(), Ogre::Mesh::setSkeletonName(), Ogre::Skeleton::Skeleton(), Ogre::StringResource::StringResource(), Ogre::Zip::unload(), Ogre::DynLib::unload(), Ogre::CgProgram::unloadImpl(), and Ogre::Zip::Zip().

size_t Ogre::Resource::mSize [protected, inherited]
 

Definition at line 60 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_setFinalAttributes(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), and Ogre::Material::operator=().

bool Ogre::GpuProgram::mSkeletalAnimation [protected]
 

Does this (vertex) program include skeletal animation?

Definition at line 469 of file OgreGpuProgram.h.

String Ogre::GpuProgram::mSource [protected]
 

The assembler source of the program (may be blank until file loaded).

Definition at line 463 of file OgreGpuProgram.h.

Referenced by load(), Ogre::D3D9GpuProgram::load(), Ogre::GLArbGpuProgram::loadFromSource(), Ogre::GLGpuNvparseProgram::loadFromSource(), Ogre::D3D9HLSLProgram::loadFromSource(), Ogre::D3D9GpuProgram::loadFromSource(), Ogre::CgProgram::loadFromSource(), Ogre::HighLevelGpuProgram::loadHighLevelImpl(), setSource(), and setSourceFile().

String Ogre::GpuProgram::mSyntaxCode [protected]
 

Syntax code eg arbvp1, vs_2_0 etc.

Definition at line 467 of file OgreGpuProgram.h.

Referenced by isSupported().

GpuProgramType Ogre::GpuProgram::mType [protected]
 

The type of the program.

Definition at line 459 of file OgreGpuProgram.h.

Referenced by Ogre::GLArbGpuProgram::bindProgramParameters(), Ogre::D3D9HLSLProgram::createLowLevelImpl(), and Ogre::CgProgram::createLowLevelImpl().


The documentation for this class was generated from the following files:

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:25:46 2004