Go to the source code of this file.
Functions | |
struct varjo_SwapChain * | varjo_D3D11CreateSwapChain (struct varjo_Session *session, struct ID3D11Device *dev, struct varjo_SwapChainConfig2 *config) |
Create a D3D11 swap chain that can be used when submitting layers. More... | |
struct varjo_SwapChain * | varjo_GLCreateSwapChain (struct varjo_Session *session, struct varjo_SwapChainConfig2 *config) |
Create an OpenGL swap chain that can be used when submitting layers. More... | |
struct varjo_SwapChain * | varjo_D3D12CreateSwapChain (struct varjo_Session *session, struct ID3D12CommandQueue *commandQueue, struct varjo_SwapChainConfig2 *config) |
Create a D3D12 swap chain that can be used when submitting layers. More... | |
struct varjo_Texture | varjo_GetSwapChainImage (struct varjo_SwapChain *swapChain, int32_t index) |
Retrieve a swap chain image with the given index. More... | |
void | varjo_AcquireSwapChainImage (struct varjo_SwapChain *swapChain, int32_t *index) |
Acquire (lock) the next image in the swap chain for rendering. More... | |
void | varjo_ReleaseSwapChainImage (struct varjo_SwapChain *swapChain) |
Release a swap chain image previously acquired with a call to varjo_AcquireSwapChainImage. More... | |
void | varjo_FreeSwapChain (struct varjo_SwapChain *swapChain) |
Delete a swap chain object. More... | |
void | varjo_BeginFrameWithLayers (struct varjo_Session *session) |
Begin rendering the frame. More... | |
void | varjo_EndFrameWithLayers (struct varjo_Session *session, struct varjo_SubmitInfoLayers *submitInfo) |
Submit a set of swap chains to the compositor to be displayed. More... | |
void varjo_AcquireSwapChainImage | ( | struct varjo_SwapChain * | swapChain, |
int32_t * | index | ||
) |
Acquire (lock) the next image in the swap chain for rendering.
This function acquires the next image in the swap chain that is available for rendering, and must be called by the client before any rendering is performed into the swap chain. The index of the acquired swap chain image will be written to the location pointed to by the index parameter. The actual texture for the swap chain can be retrieved with a call to varjo_GetSwapChainImage.
After the application is done with rendering to the swap chain image, the image must be released back to the compositor by calling varjo_ReleaseSwapChainImage. This must be done for each swap chain object that is being submitted to the compositor before calling varjo_EndFrameWithLayers.
swapChain | Pointer to the varjo_SwapChain object to acquire the image from. |
index | Pointer to the location where the acquired swap chain image index will be written to. |
void varjo_BeginFrameWithLayers | ( | struct varjo_Session * | session | ) |
Begin rendering the frame.
This function should be called only from the rendering thread and before any rendering work for the given frame is done. Frame must be submitted with varjo_EndFrameWithLayers().
session | Varjo session handle. |
struct varjo_SwapChain* varjo_D3D11CreateSwapChain | ( | struct varjo_Session * | session, |
struct ID3D11Device * | dev, | ||
struct varjo_SwapChainConfig2 * | config | ||
) |
Create a D3D11 swap chain that can be used when submitting layers.
A swap chain object contains the image surfaces that can be rendered into, and submitted to the Varjo Compositor for displaying. Each swap chain contains multiple images in order to perform double- or triple-buffering when compositing the image. The amount of swap chain images created is configured in the numberOfTextures member of the varjo_SwapChainConfig2 struct.
Each frame submission contains references to 1..n swap chain objects; the application is free to render all views into a single swap chain image side-by-side as an atlas, or use a separate swap chain objects for each view (or any other combination imaginable).
Use varjo_FreeSwapChain to free the created swap chain.
When using layers for submitting the images, the calls to varjo_D3D11Init and varjo_D3D11ShutDown are not required.
Possible errors:
session | Varjo session handle. |
dev | Pointer to D3D11 device |
config | Pointer to varjo_SwapChainConfig2 structure describing the swap chain configuration. |
struct varjo_SwapChain* varjo_D3D12CreateSwapChain | ( | struct varjo_Session * | session, |
struct ID3D12CommandQueue * | commandQueue, | ||
struct varjo_SwapChainConfig2 * | config | ||
) |
Create a D3D12 swap chain that can be used when submitting layers.
A swap chain object contains the image surfaces that can be rendered into, and submitted to the Varjo Compositor for displaying. Each swap chain contains multiple images in order to perform double- or triple-buffering when compositing the image. The amount of swap chain images created is configured in the numberOfTextures member of the varjo_SwapChainConfig2 struct.
Each frame submission contains references to 1..n swap chain objects; the application is free to render all views into a single swap chain image side-by-side as an atlas, or use a separate swap chain objects for each view (or any other combination imaginable).
Use varjo_FreeSwapChain to free the created swap chain.
Possible errors:
session | Varjo session handle. |
commandQueue | Pointer to D3D12 command queue with that can be used to submit graphics commands. |
config | Pointer to varjo_SwapChainConfig2 structure describing the swap chain configuration. |
void varjo_EndFrameWithLayers | ( | struct varjo_Session * | session, |
struct varjo_SubmitInfoLayers * | submitInfo | ||
) |
Submit a set of swap chains to the compositor to be displayed.
The submitInfo parameter contains the list of layers that are to be displayed. See varjo_SubmitInfoLayers documentation for more information.
varjo_SubmitInfoLayers structure will be validated. Possible errors raised from validation:
session | Varjo session handle. |
submitInfo | Pointer to layer submit info structure. |
void varjo_FreeSwapChain | ( | struct varjo_SwapChain * | swapChain | ) |
Delete a swap chain object.
swapChain | The varjo_SwapChain object to be deleted. |
struct varjo_Texture varjo_GetSwapChainImage | ( | struct varjo_SwapChain * | swapChain, |
int32_t | index | ||
) |
Retrieve a swap chain image with the given index.
A swap chain contains 1..n images to allow double- or triple-buffering in the compositor. This function can be used to retrieve the underlying texture object for each of those images.
The texture objects retrieved with this function are guaranteed to stay valid for the lifetime of the varjo_SwapChain object, so the application is free to query the textures at application startup time to build other dependent objects (such as Render Target Views etc).
swapChain | Pointer to the varjo_SwapChain object. |
index | The index of the image to retrieve. This value must be in range [0, number of textures in the swap chain[ |
struct varjo_SwapChain* varjo_GLCreateSwapChain | ( | struct varjo_Session * | session, |
struct varjo_SwapChainConfig2 * | config | ||
) |
Create an OpenGL swap chain that can be used when submitting layers.
A swap chain object contains the image surfaces that can be rendered into, and submitted to the Varjo Compositor for displaying. Each swap chain contains multiple images in order to perform double- or triple-buffering when compositing the image. The amount of swap chain images created is configured in the numberOfTextures member of the varjo_SwapChainConfig2 struct.
Each frame submission contains references to 1..n swap chain objects; the application is free to render all views into a single swap chain image side-by-side as an atlas, or use a separate swap chain objects for each view (or any other combination imaginable).
This function expects an OpenGL render context to be active for the calling thread.
When using layers for submitting the images, the calls to varjo_GLInit and varjo_GLShutDown are not required.
Use varjo_FreeSwapChain to free the created swap chain.
Possible errors:
session | Varjo session handle. |
config | Pointer to varjo_SwapChainConfig2 structure describing the swap chain configuration. |
void varjo_ReleaseSwapChainImage | ( | struct varjo_SwapChain * | swapChain | ) |
Release a swap chain image previously acquired with a call to varjo_AcquireSwapChainImage.
swapChain | Pointer to the varjo_SwapChain object where an image was previously acquired from. |