XLE  v0.02.0
Public Member Functions | List of all members
RenderCore::PresentationChain Class Reference
Inheritance diagram for RenderCore::PresentationChain:
Inheritance graph
[legend]

Public Member Functions

void Present ()
 Finishes a frame, and presents it to the user More...
 
void Resize (unsigned newWidth, unsigned newHeight)
 Resizes the presentation chain More...
 
IDXGI::SwapChain * GetUnderlying () const
 
void AttachToContext (ID3D::DeviceContext *context, ID3D::Device *device)
 
std::shared_ptr< ViewportContextGetViewportContext () const
 Returns a context object that will track the size of the viewport More...
 
 PresentationChain (intrusive_ptr< IDXGI::SwapChain > underlying, const void *attachedWindow)
 

Member Function Documentation

std::shared_ptr< ViewportContext > RenderCore::PresentationChain::GetViewportContext ( ) const
virtual

Returns a context object that will track the size of the viewport

Implements RenderCore::IPresentationChain.

void RenderCore::PresentationChain::Present ( )
virtual

Finishes a frame, and presents it to the user

Present() is used to finish a frame, and present it to the user.

The system will often stall in Present(). This is the most likely place we need to synchronise with the hardware. So, if the CPU is running fast and the GPU can't keep up, we'll get a stall in Present(). Normally, this is a good thing, because it means we're GPU bound.

Back buffers get flipped when we Present(). So any new rendering after Present will go to the next frame.

Normally, present is used like this:

@code
RenderCore::IDevice* device = ...;
RenderCore::IPresentationChain* presentationChain = ...;
device->BeginFrame(presentationChain);
ClearBackBufferAndDepthBuffer(device); // (helps synchronisation in multi-GPU setups)
DoRendering(device);
presentationChain->Present();
\endcode

But in theory we can call Present at any time.

Implements RenderCore::IPresentationChain.

void RenderCore::PresentationChain::Resize ( unsigned  newWidth,
unsigned  newHeight 
)
virtual

Resizes the presentation chain

Resizes the presentation chain. Normally this is called after the output window changes size. If the presentation chain size doesn't match the output window's size, the behaviour is undefined (though on windows, the output is stretched to the window size).

Use the default arguments to automatically adjust to the same size as the window.

Implements RenderCore::IPresentationChain.


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