TRendererCreatorHelper Class Reference

This class helps you create renderer. More...

#include <RendererCreatorHelper.h>

Inheritance diagram for TRendererCreatorHelper:

Inheritance graph
[legend]
Collaboration diagram for TRendererCreatorHelper:

Collaboration graph
[legend]
List of all members.

Public Member Functions

BOOL FindRenderersHW (const TString &library, EnumGraphicFormat displayFormat, EnumGraphicFormat backBufferFormat, BOOL windowMode, BOOL fullscreenMode, EnumGraphicFormat depthStencilFormat, EnumGraphicVertexShaderVersion minimumVsVersion, EnumGraphicPixelShaderVersion minimumPsVersion, const TArray< EnumGraphicCaps > *reqCaps)
 This method enumerates renderers from specified library and select indices for such renderers, which meet given requirements.
BOOL FindRenderersSW (const TString &library, EnumGraphicFormat displayFormat, EnumGraphicFormat backBufferFormat, BOOL windowMode, BOOL fullscreenMode, EnumGraphicFormat depthStencilFormat, EnumGraphicVertexShaderVersion minimumVsVersion, EnumGraphicPixelShaderVersion minimumPsVersion, const TArray< EnumGraphicCaps > *reqCaps)
 This method enumerates renderers from specified library and select indices for such renderers, which meet given requirements.
TRendererCreateRenderer (void *wnd, DWORD index, DWORD width, DWORD height, DWORD freqs, EnumGraphicFormat backBufferFormat, EnumGraphicFormat depthStencilFormat, BOOL window, BOOL vsync, EnumGraphicVertexShaderVersion vsVersion, EnumGraphicPixelShaderVersion psVersion, BOOL vsDebug, BOOL psDebug)
 This method creates renderer.
const TArray< DWORD > & GetSelectedDevices (void) const
 Return array with indices for devices that meet given requirements.
const TRendererCapsGetRendererCapabilities (DWORD index) const
 Returns capabilities for devices identified by given index or NULL if index is out of range or no device has been enumerated.
BOOL GetClosestResolution (const DWORD index, DWORD &width, DWORD &height, DWORD &freqs)
 This method find closest available resolution for specified device and resolution.
BOOL FreeEnumerateRenderers (void)
 Destroy previously enumerate renderers.

Static Public Member Functions

static TRendererCreatorHelperCreate (void)
 Create TRendererCreatorHelper object or return previously created object.
static BOOL Destroy (void)
 Destroy actually created TRendererCreatorHelper object.

Detailed Description

This class helps you create renderer.

Only one instance of this class can be created in time. You create it via TRendererCreatorHelper::Create() and destroy via TRendererCreatorHelper::Destroy(). Next calling of TRendererCreatorHelper::Create() returns previously created instance of this object.

When you enumerate renderers via TRendererCreatorHelper::FindRenderers*() you cannot call this method again until you call TRendererCreatorHelper::FreeEnumerateRenderers().

When a renderer exists you cannot call TRendererCreatorHelper::FreeEnumerateRenderers() or destroy this object - you must destroy renderer before do this.

USING: Create object via TRendererCreatorHelper::Create() Enumerate renderers via TRendererCreatorHelper::FindRenderers*() //HW,SW,... Select renderer via TRendererCreatorHelper::GetSelectedDevices() You can get optimal display mode via TRendererCreatorHelper::GetClosestResolution() Create renderer via TRendererCreatorHelper::CreateRenderer() ...here is your application code... End of application Properly destroy renderer an all its resources. Destroy this objects via TRendererCreatorHelper::Destroy()

Todo:
This class is system-dependent - actually is support for Windows only.

Definition at line 49 of file RendererCreatorHelper.h.


Member Function Documentation

TRendererCreatorHelper * TRendererCreatorHelper::Create void   )  [static]
 

Create TRendererCreatorHelper object or return previously created object.

Definition at line 23 of file RendererCreatorHelper.cpp.

References DBGTEXTF.

TRenderer * TRendererCreatorHelper::CreateRenderer void *  wnd,
DWORD  index,
DWORD  width,
DWORD  height,
DWORD  freqs,
EnumGraphicFormat  backBufferFormat,
EnumGraphicFormat  depthStencilFormat,
BOOL  window,
BOOL  vsync,
EnumGraphicVertexShaderVersion  vsVersion,
EnumGraphicPixelShaderVersion  psVersion,
BOOL  vsDebug,
BOOL  psDebug
 

This method creates renderer.

If renderer is already created method returns pointer to this one. You must call method FindRenderers* to enumerate renderers before you create a rendererer. After successfully calling this function you cannot destroy TRendererCreatorHelper until you destroy created renderer!!!

Parameters:
wnd [in] variable argument, under Windows is equal to handle to windows (HWND) where renderer will be created
index [in] index of renderer device capabilities dedicated to create renderer
width [in] width of backbuffer in pixels (must be available for this enumerated device)
height [in] height of backbuffer in pixels (must be available for this enumerated device)
freqs [in] refresh rate in Hz (must be available for this enumerated device)
backBufferFormat [in] format of backbuffer (must be one from those which are compatible with this display format in device caps structure, its recommended to use such a format which is available in fullscreen and windowed mode to like X8R8G8B8)
depthStencilFormat [in] format of depth stencil surface used in device (must be available on device and must be compatible with backbuffer format)
window [in] determines whether renderer will be created in window (may be changed later)
vsync [in] determines whether vertical synchronization will be used
vsVersion [in] version of vertex shader (determines number of VS registers, must be available on device)
psVersion [in] version of pixel shader (determines number of PS registers and texture samplers, must be available on device)
vsDebug [in] determines whether renderer will be support vertex shader debugging, if renderer doesnt supported debugging, warning will be printed
psDebug [in] determines whether renderer will be support pixel shader debugging (WARNING: Pixel shader debugging is on most hardware available only on reference (software) device), if renderer doesnt supported debugging, warning will be printed

Definition at line 183 of file RendererCreatorHelper.cpp.

References TRendererCreator::CreateRenderer(), and DBGTEXTF.

Here is the call graph for this function:

BOOL TRendererCreatorHelper::Destroy void   )  [static]
 

Destroy actually created TRendererCreatorHelper object.

Cannot destroy object if an renderer from created from this object already exists. Returns TRUE if object was destroyed, FALSE otherwise.

Definition at line 42 of file RendererCreatorHelper.cpp.

References DBGTEXTF, FALSE, and FreeEnumerateRenderers().

Referenced by TGlobalsGraphic::Destroy().

Here is the call graph for this function:

BOOL TRendererCreatorHelper::FindRenderersHW const TString library,
EnumGraphicFormat  displayFormat,
EnumGraphicFormat  backBufferFormat,
BOOL  windowMode,
BOOL  fullscreenMode,
EnumGraphicFormat  depthStencilFormat,
EnumGraphicVertexShaderVersion  minimumVsVersion,
EnumGraphicPixelShaderVersion  minimumPsVersion,
const TArray< EnumGraphicCaps > *  reqCaps
 

This method enumerates renderers from specified library and select indices for such renderers, which meet given requirements.

This method selects HW device only.

If previous method FindRenderers* was called this method method returns TRUE and does nothing.

Parameters:
library [in] name of file with DLL where renderer is stored
displayFormat [in] required format of front buffer (GRAPH_FMT_UNKNOWN for all formats)
backBufferFormat [in] required backbuffer format (GRAPH_FMT_UNKNOWN for all formats)
windowMode [in] determine whether specified backbuffer format must me supported in window mode
fullscreenMode [in] determine whether specified backbuffer format must me supported in fullscreen mode
depthStencilFormat [in] required depth-stencil format (GRAPH_FMT_UNKNOWN for all formats)
minimumVsVersion [in] minimal version for vertex shaders
minimumPsVersion [in] minimal version for pixel shaders
reqCaps [in] array with required device's capabilities

Definition at line 226 of file RendererCreatorHelper.cpp.

References TArray< T, align, size, step >::Clear(), DBGTEXTF, FALSE, TArray< T, align, size, step >::GetItem(), TRendererCreator::GetRendererCapabilities(), TRendererCreator::GetRenderersCount(), TArray< T, align, size, step >::GetSize(), GRAPH_CAPS_HARDWARE, GRAPH_FMT_UNKNOWN, and TRUE.

Here is the call graph for this function:

BOOL TRendererCreatorHelper::FindRenderersSW const TString library,
EnumGraphicFormat  displayFormat,
EnumGraphicFormat  backBufferFormat,
BOOL  windowMode,
BOOL  fullscreenMode,
EnumGraphicFormat  depthStencilFormat,
EnumGraphicVertexShaderVersion  minimumVsVersion,
EnumGraphicPixelShaderVersion  minimumPsVersion,
const TArray< EnumGraphicCaps > *  reqCaps
 

This method enumerates renderers from specified library and select indices for such renderers, which meet given requirements.

This method selects SW device only.

If previous method FindRenderers* was called this method method returns TRUE and does nothing.

Parameters:
library [in] name of file with DLL where renderer is stored
displayFormat [in] required format of front buffer (GRAPH_FMT_UNKNOWN for all formats)
backBufferFormat [in] required backbuffer format (GRAPH_FMT_UNKNOWN for all formats)
windowMode [in] determine whether specified backbuffer format must me supported in window mode
fullscreenMode [in] determine whether specified backbuffer format must me supported in fullscreen mode
depthStencilFormat [in] required depth-stencil format (GRAPH_FMT_UNKNOWN for all formats)
minimumVsVersion [in] minimal version for vertex shaders
minimumPsVersion [in] minimal version for pixel shaders
reqCaps [in] array with required device's capabilities

Definition at line 317 of file RendererCreatorHelper.cpp.

References TArray< T, align, size, step >::Clear(), DBGTEXTF, FALSE, TArray< T, align, size, step >::GetItem(), TRendererCreator::GetRendererCapabilities(), TRendererCreator::GetRenderersCount(), TArray< T, align, size, step >::GetSize(), GRAPH_CAPS_HARDWARE, GRAPH_FMT_UNKNOWN, and TRUE.

Here is the call graph for this function:

BOOL TRendererCreatorHelper::FreeEnumerateRenderers void   ) 
 

Destroy previously enumerate renderers.

This method can be called only when no renderer exists.

Definition at line 129 of file RendererCreatorHelper.cpp.

References TArray< T, align, size, step >::Clear(), DBGTEXTF, TRendererCreator::Destroy(), FALSE, TRendererCreator::FreeEnumerateRenderers(), and TRUE.

Referenced by Destroy().

Here is the call graph for this function:

BOOL TRendererCreatorHelper::GetClosestResolution const DWORD  index,
DWORD width,
DWORD height,
DWORD freqs
 

This method find closest available resolution for specified device and resolution.

At first search for closest resolution. After this search for best frequency. Return FALSE if resolution cannot be created or when index of device is out of range.

Parameters:
index [in] index of device
width [in/out] required/founded width in pixels
height [in/out] required/founded height in pixels
freqs [in/out] required/founded freqs

Definition at line 402 of file RendererCreatorHelper.cpp.

References NSMath::NSStdMath::abs(), DBGTEXTF, FALSE, TRendererCaps::GetDisplayMode(), TRendererCaps::GetDisplayModesCount(), TRendererDisplayMode::GetRefreshRate(), TRendererDisplayMode::GetRefreshRatesCount(), TRendererCreator::GetRendererCapabilities(), NSMath::NSStdMath::sqrt(), and TRUE.

Here is the call graph for this function:

const TRendererCaps * TRendererCreatorHelper::GetRendererCapabilities DWORD  index  )  const
 

Returns capabilities for devices identified by given index or NULL if index is out of range or no device has been enumerated.

Parameters:
index [in] zero-based index of device

Definition at line 114 of file RendererCreatorHelper.cpp.

References TRendererCreator::GetRendererCapabilities().

Here is the call graph for this function:

const TArray<DWORD>& TRendererCreatorHelper::GetSelectedDevices void   )  const [inline]
 

Return array with indices for devices that meet given requirements.

This method should be called after successful call of FindRenderers* method.

Definition at line 111 of file RendererCreatorHelper.h.


The documentation for this class was generated from the following files:
Generated on Wed Nov 28 22:43:42 2007 for Joy4D by  doxygen 1.4.6-NO