GFXD3D9Device

Engine/source/gfx/D3D9/gfxD3D9Device.h

More...

Classes:

Render Targets

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

Private Types

Parent 

Protected Types

VertexDeclMap 

Used to lookup a vertex declaration for the vertex format.

Protected Attributes

Adapter index because D3D supports multiple adapters.

Track the last const buffer we've used.

LPDIRECT3D9

D3D Handle.

LPDIRECT3DDEVICE9

Handle for D3DDevice.

LPDIRECT3DDEVICE9EX

Handle for D3DDevice9Ex.

LPDIRECT3D9EX

D3D9Ex Handle.

IDirect3DSurface9 *
IDirect3DSurface9 *
IDirect3DSurface9 *
D3DDISPLAYMODE

The current adapter display mode.

IDirect3DPixelShader9 *
IDirect3DVertexShader9 *
D3DMULTISAMPLE_TYPE

Profiled (via caps)

Profiled (via caps)

Temporary matrix, no assurances on value at all.

The stream 0 vertex buffer used for volatile VB offseting.

Public Static Attributes

Protected Static Functions

Protected Functions

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

Called by GFXDevice to create a device specific stateblock.

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

The parameters to drawIndexedPrimitive are somewhat complicated.

findVBPool(const GFXVertexFormat * vertexFormat, U32 numVertsNeeded)

State initialization.

To manage creating and re-creating of these when device is aquired.

This you will probably never, ever use, but it is used to generate the code for the initStates() function.

To release all resources we control from D3DPOOL_DEFAULT.

setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable)

Called by base GFXDevice to actually set a const buffer.

setStateBlockInternal(GFXStateBlock * block, bool force)

Called by GFXDevice to actually set a stateblock.

D3DPRESENT_PARAMETERS

Device helper function.

Public Static Functions

createInstance(U32 adapterIndex)

Public Functions

GFXD3D9Device(LPDIRECT3D9 d3d, U32 index)

Constructor.

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

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

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.

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

clear(U32 flags, ColorI color, F32 z, U32 stencil)

Allocate a fence.

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

createRenderSurface(U32 width, U32 height, GFXFormat format, U32 mipLevel)
destroyD3DResource(IDirect3DResource9 * d3dResource)
drawPrimitive(GFXPrimitiveType primType, U32 vertexStart, U32 primitiveCount)

Returns active graphics adapter type.

IDirect3DSurface9 *
LPDIRECT3D9
LPDIRECT3DDEVICE9
const D3DDISPLAYMODE &

Get the fill convention for this device.

D3DMULTISAMPLE_TYPE

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

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

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

bool

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

reset(D3DPRESENT_PARAMETERS & d3dpp)

Reset.

setShader(GFXShader * shader, bool force)

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.

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.

Detailed Description

Render Targets

_updateRenderTargets()

Reimplemented from: GFXDevice

Private Types

typedef GFXDevice Parent 

Protected Types

typedef StrongRefPtr< GFXD3D9VertexBuffer > RPGDVB 
typedef Map< String, D3D9VertexDecl * > VertexDeclMap 

Used to lookup a vertex declaration for the vertex format.

Public Friends

Protected Attributes

U32 mAdapterIndex 

Adapter index because D3D supports multiple adapters.

RectI mClipRect 
S32 mCreateFenceType 
StrongRefPtr< GFXD3D9ShaderConstBuffer > mCurrentConstBuffer 

Track the last const buffer we've used.

Used to notify new constant buffers that they should send all of their constants up

GFXD3D9PrimitiveBuffer * mCurrentPB 
LPDIRECT3D9 mD3D 

D3D Handle.

LPDIRECT3DDEVICE9 mD3DDevice 

Handle for D3DDevice.

LPDIRECT3DDEVICE9EX mD3DDeviceEx 

Handle for D3DDevice9Ex.

LPDIRECT3D9EX mD3DEx 

D3D9Ex Handle.

IDirect3DSurface9 * mDeviceBackbuffer 
IDirect3DSurface9 * mDeviceColor 
IDirect3DSurface9 * mDeviceDepthStencil 
D3DDISPLAYMODE mDisplayMode 

The current adapter display mode.

StrongRefPtr< GFXD3D9PrimitiveBuffer > mDynamicPB 

Dynamic index buffer.

GFXShaderRef mGenericShader [GS_COUNT]
GFXShaderConstBufferRef mGenericShaderBuffer [GS_COUNT]
IDirect3DPixelShader9 * mLastPixShader 
IDirect3DVertexShader9 * mLastVertShader 
GFXShaderConstHandle * mModelViewProjSC [GS_COUNT]
DWORD mMultisampleLevel 
D3DMULTISAMPLE_TYPE mMultisampleType 
U32 mNumRenderTargets 

Profiled (via caps)

U32 mNumSamplers 

Profiled (via caps)

bool mOcclusionQuerySupported 
F32 mPixVersion 
MatrixF mTempMatrix 

Temporary matrix, no assurances on value at all.

VertexDeclMap mVertexDecls 
GFXD3D9VertexBuffer * mVolatileVB 

The stream 0 vertex buffer used for volatile VB offseting.

Vector< RPGDVB > mVolatileVBList 

Public Static Attributes

D3DXFNTable smD3DX 

Protected Static Functions

initD3DXFnTable()

Protected Functions

_setPrimitiveBuffer(GFXPrimitiveBuffer * buffer)

createShader()

Reimplemented from: GFXDevice

createStateBlockInternal(const GFXStateBlockDesc & desc)

Reimplemented from: GFXDevice

createVBPool(const GFXVertexFormat * vertexFormat, U32 vertSize)

disableShaders(bool force)

Reimplemented from: GFXDevice

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

Reimplemented from: GFXDevice

findVBPool(const GFXVertexFormat * vertexFormat, U32 numVertsNeeded)

initStates()

Reimplemented from: GFXDevice

Reimplemented by: GFXPCD3D9Device

reacquireDefaultPoolResources()

To manage creating and re-creating of these when device is aquired.

regenStates()

This you will probably never, ever use, but it is used to generate the code for the initStates() function.

releaseDefaultPoolResources()

To release all resources we control from D3DPOOL_DEFAULT.

setGlobalAmbientInternal(ColorF color)

Reimplemented from: GFXDevice

setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable)

Reimplemented from: GFXDevice

setLightMaterialInternal(const GFXLightMaterial mat)

Reimplemented from: GFXDevice

setShaderConstBufferInternal(GFXShaderConstBuffer * buffer)

Reimplemented from: GFXDevice

setStateBlockInternal(GFXStateBlock * block, bool force)

Reimplemented from: GFXDevice

setTextureInternal(U32 textureUnit, const GFXTextureObject * texture)

Reimplemented from: GFXDevice

setupPresentParams(const GFXVideoMode & mode, const HWND & hwnd)

Device helper function.

Reimplemented by: GFXPCD3D9Device

Public Static Functions

createInstance(U32 adapterIndex)

Public Functions

GFXD3D9Device(LPDIRECT3D9 d3d, U32 index)

Constructor.

Parameters:

d3d

Direct3D object to instantiate this device with

index

Adapter index since D3D can use multiple graphics adapters

~GFXD3D9Device()

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

Reimplemented from: GFXDevice

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

Reimplemented from: GFXDevice

allocVertexDecl(const GFXVertexFormat * vertexFormat)

Reimplemented from: GFXDevice

beginSceneInternal()

Reimplemented from: GFXDevice

Reimplemented by: GFXPCD3D9Device

clear(U32 flags, ColorI color, F32 z, U32 stencil)

Reimplemented from: GFXDevice

createCubemap()

Reimplemented from: GFXDevice

createFence()

Reimplemented from: GFXDevice

createOcclusionQuery()

Reimplemented from: GFXDevice

createRenderSurface(U32 width, U32 height, GFXFormat format, U32 mipLevel)

deallocVertexBuffer(GFXD3D9VertexBuffer * vertBuff)

destroyD3DResource(IDirect3DResource9 * d3dResource)

doParanoidStateCheck()

Reimplemented from: GFXDevice

drawPrimitive(GFXPrimitiveType primType, U32 vertexStart, U32 primitiveCount)

Reimplemented from: GFXDevice

endSceneInternal()

Reimplemented from: GFXDevice

getAdapterType()

Reimplemented from: GFXDevice

getAdaterIndex()

getBackBuffer()

getClipRect()

Reimplemented from: GFXDevice

getD3D()

getDevice()

getDisplayMode()

getFillConventionOffset()

Reimplemented from: GFXDevice

getMaxDynamicIndices()

Reimplemented from: GFXDevice

getMaxDynamicVerts()

Reimplemented from: GFXDevice

getMultisampleLevel()

getMultisampleType()

getNumRenderTargets()

Reimplemented from: GFXDevice

getNumSamplers()

Reimplemented from: GFXDevice

getPixelShaderVersion()

Reimplemented from: GFXDevice

init(const GFXVideoMode & mode, PlatformWindow * window)

Reimplemented from: GFXDevice

Reimplemented by: GFXPCD3D9Device

isD3D9Ex()

preDestroy()

Reimplemented from: GFXDevice

reset(D3DPRESENT_PARAMETERS & d3dpp)

Reset.

Reimplemented by: GFXPCD3D9Device

setClipRect(const RectI & rect)

Reimplemented from: GFXDevice

setPixelShaderVersion(F32 version)

Reimplemented from: GFXDevice

setShader(GFXShader * shader, bool force)

Reimplemented from: GFXDevice

setupGenericShaders(GenericShaderType type)

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