GFXTextureTarget Class Reference

#include <gfxTarget.h>

Inheritance diagram for GFXTextureTarget:

Inheritance graph
[legend]
List of all members.

Detailed Description

A render target associated with one or more textures.

Although some APIs allow directly selecting any texture or surfaces, in some cases it is necessary to allocate helper resources to enable RTT operations.

Note:
A GFXTextureTarget will retain references to textures that are attached to it, so be sure to clear them out when you're done!

Different APIs have different restrictions on what they can support here. Be aware when mixing cubemaps vs. non-cubemaps, or targets of different resolutions. The devices will attempt to limit behavior to things that are safely portable, but they cannot catch every possible situation for all drivers and API - so make sure to actually test things!


Public Types

 DepthStencil
 Color0
 Color1
 Color2
 Color3
 Color4
 MaxRenderSlotId
enum  RenderSlot {
  DepthStencil,
  Color0,
  Color1,
  Color2,
  Color3,
  Color4,
  MaxRenderSlotId
}

Public Member Functions

virtual ~GFXTextureTarget ()
virtual void attachTexture (RenderSlot slot, GFXTextureObject *tex, U32 mipLevel=0, U32 zOffset=0)=0
 Attach a surface to a given slot as part of this render target.
virtual void attachTexture (RenderSlot slot, GFXCubemap *tex, U32 face, U32 mipLevel=0)=0
 Support binding to cubemaps.
virtual void clearAttachments ()=0
 Detach all bound textures.

Static Public Attributes

static GFXTextureObjectsDefaultDepthStencil


Member Enumeration Documentation

Enumerator:
DepthStencil 
Color0 
Color1 
Color2 
Color3 
Color4 
MaxRenderSlotId 


Constructor & Destructor Documentation

virtual GFXTextureTarget::~GFXTextureTarget (  )  [inline, virtual]


Member Function Documentation

virtual void GFXTextureTarget::attachTexture ( RenderSlot  slot,
GFXTextureObject tex,
U32  mipLevel = 0,
U32  zOffset = 0 
) [pure virtual]

Attach a surface to a given slot as part of this render target.

Parameters:
slot What slot is used for multiple render target (MRT) effects. Most of the time you'll use Color0.
tex A texture and miplevel to bind for rendering, or else NULL/0 to clear a slot.
mipLevel What level of this texture are we rendering to?
zOffset If this is a depth texture, what z level are we rendering to?

virtual void GFXTextureTarget::attachTexture ( RenderSlot  slot,
GFXCubemap tex,
U32  face,
U32  mipLevel = 0 
) [pure virtual]

Support binding to cubemaps.

Parameters:
slot What slot is used for multiple render target (MRT) effects. Most of the time you'll use Color0.
tex What cubemap will we be rendering to?
face A face identifier.
mipLevel What level of this texture are we rendering to?

virtual void GFXTextureTarget::clearAttachments (  )  [pure virtual]

Detach all bound textures.

This is a helper function to make it easy to make sure a GFXTextureTarget is entirely empty before you move on to other rendering tasks. Because a GFXTextureTarget will keep references to bound GFXTextureObjects, not clearing can results in resource leaks and hard to track down bugs.

Implemented in GFXD3D8TextureTarget, GFX360TextureTarget, GFXD3D9TextureTarget, and GFXGLTextureTarget.


Member Data Documentation