GFXGLDevice

Engine/source/gfx/gl/gfxGLDevice.h

More...

Classes:

State Initalization.

State initalization.

allocVertexBuffer(U32 numVerts, const GFXVertexFormat * vertexFormat, U32 vertSize, GFXBufferType bufferType, void * data)

This allocates a vertex buffer and returns a pointer to the allocated buffer.

allocPrimitiveBuffer(U32 numIndices, U32 numPrimitives, GFXBufferType bufferType, void * data)

This allocates a primitive buffer and returns a pointer to the allocated buffer.

Called from GFXVertexFormat to allocate the hardware specific vertex declaration for rendering.

Sets the current vertex declaration on the device.

Sets the vertex buffer on the device.

setVertexStreamFrequency(U32 stream, U32 frequency)

Set the vertex stream frequency on the device.

postDrawPrimitive(U32 primitiveCount)
findVolatileVBO(U32 numVerts, const GFXVertexFormat * vertexFormat, U32 vertSize)

Returns an existing volatile VB which has >= numVerts and the same vert flags/size, or creates a new VB if necessary.

findVolatilePBO(U32 numIndices, U32 numPrimitives)

Returns an existing volatile PB which has >= numIndices, or creates a new PB if necessary.

Vsync callback.

Guaranteed to be called after all extensions have been loaded, use to init card profiler, shader version, max samplers, etc.

If our platform (e.g. OS X) supports a fence extenstion (e.g. GL_APPLE_fence) this will create one, otherwise returns NULL.

Sets mCurrentPB.

Parent 

Render Target functions

Allocate a target for doing render to texture operations, with no depth/stencil buffer.

Allocate a target for a given window.

Updates the render targets and viewport in a device specific manner when they are dirty.

Shader functions

setShader(GFXShader * shader, bool force)
selectSupportedFormat(GFXTextureProfile * profile, const Vector< GFXFormat > & formats, bool texture, bool mustblend, bool mustfilter)

Returns the number of texture samplers that can be used in a shader rendering pass.

Returns the number of simultaneous render targets supported by the device.

Creates a new empty shader which must be initialized and deleted by the caller.

clear(U32 flags, const LinearColorF & color, F32 z, U32 stencil)
drawPrimitive(GFXPrimitiveType primType, U32 vertexStart, U32 primitiveCount)
drawIndexedPrimitive(GFXPrimitiveType primType, U32 startVertex, U32 minIndex, U32 numVerts, U32 startIndex, U32 primitiveCount)

The parameters to drawIndexedPrimitive are somewhat complicated.

This is called before this, or any other device, is deleted in the global destroy() method.

Allocate a fence.

Returns a hardware occlusion query object or NULL if this device does not support them.

This is a helper function to set a default shader for rendering GUI elements on systems which do not support fixed-function operations as well as for things which need just generic position/texture/color shaders.

Returns the number of vertex streams supported by the device.

bool
const char *
interpretDebugResult(long result)

Called by GFXDevice to create a device specific stateblock.

setStateBlockInternal(GFXStateBlock * block, bool force)

Called by GFXDevice to actually set a stateblock.

Called by base GFXDevice to actually set a const buffer.

setCubemapInternal(U32 textureUnit, const GFXGLCubemap * texture)

Public Attributes

Public Functions

GFXGLDevice(U32 adapterIndex)
enterDebugEvent(ColorI color, const char * name)

Returns active graphics adapter type.

Get the fill convention for this device.

Initialize this GFXDevice, optionally specifying a platform window to bind to.

setDebugMarker(ColorI color, const char * name)

Public Static Functions

createInstance(U32 adapterIndex)

Detailed Description

State Initalization.

initStates()

Reimplemented from: GFXDevice

allocVertexBuffer(U32 numVerts, const GFXVertexFormat * vertexFormat, U32 vertSize, GFXBufferType bufferType, void * data)

Reimplemented from: GFXDevice

allocPrimitiveBuffer(U32 numIndices, U32 numPrimitives, GFXBufferType bufferType, void * data)

Reimplemented from: GFXDevice

allocVertexDecl(const GFXVertexFormat * vertexFormat)

Reimplemented from: GFXDevice

setVertexDecl(const GFXVertexDecl * decl)

Reimplemented from: GFXDevice

setVertexStream(U32 stream, GFXVertexBuffer * buffer)

Reimplemented from: GFXDevice

setVertexStreamFrequency(U32 stream, U32 frequency)

Reimplemented from: GFXDevice

primCountToIndexCount(GFXPrimitiveType primType, U32 primitiveCount)

preDrawPrimitive()

postDrawPrimitive(U32 primitiveCount)

findVolatileVBO(U32 numVerts, const GFXVertexFormat * vertexFormat, U32 vertSize)

Returns an existing volatile VB which has >= numVerts and the same vert flags/size, or creates a new VB if necessary.

findVolatilePBO(U32 numIndices, U32 numPrimitives)

Returns an existing volatile PB which has >= numIndices, or creates a new PB if necessary.

vsyncCallback()

Vsync callback.

initGLState()

Guaranteed to be called after all extensions have been loaded, use to init card profiler, shader version, max samplers, etc.

_createPlatformSpecificFence()

If our platform (e.g. OS X) supports a fence extenstion (e.g. GL_APPLE_fence) this will create one, otherwise returns NULL.

setPB(GFXGLPrimitiveBuffer * pb)

Sets mCurrentPB.

GFXAdapter::CreateDeviceInstanceDelegate mCreateDeviceInstance 
U32 mAdapterIndex 
StrongRefPtr< GFXGLVertexBuffer > mCurrentVB [VERTEX_STREAM_COUNT]
U32 mCurrentVB_Divisor [VERTEX_STREAM_COUNT]
bool mNeedUpdateVertexAttrib 
StrongRefPtr< GFXGLPrimitiveBuffer > mCurrentPB 
U32 mDrawInstancesCount 
GFXShader * mCurrentShader 
GFXShaderRef mGenericShader [GS_COUNT]
GFXShaderConstBufferRef mGenericShaderBuffer [GS_COUNT]
GFXShaderConstHandle * mModelViewProjSC [GS_COUNT]
MatrixF m_mCurrentWorld 

Since GL does not have separate world and view matrices we need to track them.

MatrixF m_mCurrentView 
void * mContext 
void * mPixelFormat 
F32 mPixelShaderVersion 
bool mSupportsAnisotropic 
U32 mNumVertexStream 
U32 mMaxShaderTextures 
U32 mMaxFFTextures 
U32 mMaxTRColors 
RectI mClip 
GFXGLStateBlockRef mCurrentGLStateBlock 
GLenum mActiveTextureType [GFX_TEXTURE_STAGE_COUNT]
Vector< StrongRefPtr< GFXGLVertexBuffer > > mVolatileVBs 

Pool of existing volatile VBs so we can reuse previously created ones.

Vector< StrongRefPtr< GFXGLPrimitiveBuffer > > mVolatilePBs 

Pool of existing volatile PBs so we can reuse previously created ones.

GFXGLStateCache * mOpenglStateCache 
GFXWindowTargetRef * mWindowRT 
bool mUseGlMap 
typedef GFXDevice Parent 

Render Target functions

allocRenderToTextureTarget(bool genMips)

Reimplemented from: GFXDevice

allocWindowTarget(PlatformWindow * window)

Reimplemented from: GFXDevice

_updateRenderTargets()

Reimplemented from: GFXDevice

Shader functions

getPixelShaderVersion()

Reimplemented from: GFXDevice

setPixelShaderVersion(F32 version)

Reimplemented from: GFXDevice

setShader(GFXShader * shader, bool force)

Reimplemented from: GFXDevice

selectSupportedFormat(GFXTextureProfile * profile, const Vector< GFXFormat > & formats, bool texture, bool mustblend, bool mustfilter)

Reimplemented from: GFXDevice

getNumSamplers()

Reimplemented from: GFXDevice

getNumRenderTargets()

Reimplemented from: GFXDevice

createShader()

Reimplemented from: GFXDevice

copyResource(GFXTextureObject * pDst, GFXCubemap * pSrc, const U32 face)

Reimplemented from: GFXDevice

clear(U32 flags, const LinearColorF & color, F32 z, U32 stencil)

Reimplemented from: GFXDevice

clearColorAttachment(const U32 attachment, const LinearColorF & color)

Reimplemented from: GFXDevice

beginSceneInternal()

Reimplemented from: GFXDevice

endSceneInternal()

Reimplemented from: GFXDevice

drawPrimitive(GFXPrimitiveType primType, U32 vertexStart, U32 primitiveCount)

Reimplemented from: GFXDevice

drawIndexedPrimitive(GFXPrimitiveType primType, U32 startVertex, U32 minIndex, U32 numVerts, U32 startIndex, U32 primitiveCount)

Reimplemented from: GFXDevice

setClipRect(const RectI & rect)

Reimplemented from: GFXDevice

getClipRect()

Reimplemented from: GFXDevice

preDestroy()

Reimplemented from: GFXDevice

getMaxDynamicVerts()

Reimplemented from: GFXDevice

getMaxDynamicIndices()

Reimplemented from: GFXDevice

createFence()

Reimplemented from: GFXDevice

createOcclusionQuery()

Reimplemented from: GFXDevice

getCurrentStateBlock()

setupGenericShaders(GenericShaderType type)

Reimplemented from: GFXDevice

supportsAnisotropic()

getOpenglCache()

getDefaultDepthTex()

getNumVertexStreams()

Returns the number of vertex streams supported by the device.

glUseMap()

interpretDebugResult(long result)

Reimplemented from: GFXDevice

createStateBlockInternal(const GFXStateBlockDesc & desc)

Reimplemented from: GFXDevice

setStateBlockInternal(GFXStateBlock * block, bool force)

Reimplemented from: GFXDevice

setShaderConstBufferInternal(GFXShaderConstBuffer * buffer)

Reimplemented from: GFXDevice

setTextureInternal(U32 textureUnit, const GFXTextureObject * texture)

Reimplemented from: GFXDevice

setCubemapInternal(U32 textureUnit, const GFXGLCubemap * texture)

setCubemapArrayInternal(U32 textureUnit, const GFXGLCubemapArray * texture)

setTextureArrayInternal(U32 textureUnit, const GFXGLTextureArray * texture)

Public Attributes

GLCapabilities mCapabilities 

Public Functions

GFXGLDevice(U32 adapterIndex)

~GFXGLDevice()

activate()

createCubemap()

Reimplemented from: GFXDevice

createCubemapArray()

Reimplemented from: GFXDevice

createTextureArray()

Reimplemented from: GFXDevice

deactivate()

enterDebugEvent(ColorI color, const char * name)

Reimplemented from: GFXDevice

enumerateVideoModes()

Reimplemented from: GFXDevice

getAdapterType()

Reimplemented from: GFXDevice

getFillConventionOffset()

Reimplemented from: GFXDevice

getTotalVideoMemory()

getTotalVideoMemory_GL_EXT()

init(const GFXVideoMode & mode, PlatformWindow * window)

Reimplemented from: GFXDevice

leaveDebugEvent()

Reimplemented from: GFXDevice

resurrect()

setDebugMarker(ColorI color, const char * name)

Reimplemented from: GFXDevice

zombify()

Public Static Functions

createInstance(U32 adapterIndex)

enumerateAdapters(Vector< GFXAdapter * > & adapterList)