XLE  v0.02.0
Public Member Functions | List of all members
RenderCore::IPresentationChain Class Referenceabstract

Represents a set of back buffer for rendering to a window More...

#include <IDevice.h>

Inheritance diagram for RenderCore::IPresentationChain:
Inheritance graph
[legend]

Public Member Functions

virtual void Present ()=0
 Finishes a frame, and presents it to the user More...
 
virtual void Resize (unsigned newWidth=0, unsigned newHeight=0)=0
 Resizes the presentation chain More...
 
virtual std::shared_ptr< ViewportContextGetViewportContext () const =0
 Returns a context object that will track the size of the viewport More...
 

Detailed Description

Represents a set of back buffer for rendering to a window

For most platforms we require 1 or more back buffers, and some output window to render on. This is want the presentation chain is for.

Normally there is only one RenderCore::Device, but sometimes we need multiple PresentationChains (for example, if we want to render to multiple windows, in an editor.

PresentationChain closely matches IDXGISwapChain behaviour in windows.

Call RenderCore::IDevice::CreatePresentationChain to create a new chain.

See also
RenderCore::IDevice::CreatePresentationChain

Member Function Documentation

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

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

Implemented in RenderCore::PresentationChain.

virtual void RenderCore::IPresentationChain::Present ( )
pure 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.

Implemented in RenderCore::PresentationChain.

virtual void RenderCore::IPresentationChain::Resize ( unsigned  newWidth = 0,
unsigned  newHeight = 0 
)
pure 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.

Implemented in RenderCore::PresentationChain.


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