![]() |
|
Hydra Graphics Interface Interop. More...
#include <hgiInterop.h>
Public Member Functions | |
| HGIINTEROP_API void | TransferToApp (Hgi *srcHgi, HgiTextureHandle const &srcColor, HgiTextureHandle const &srcDepth, TfToken const &dstApi, VtValue const &dstFramebuffer, GfVec4i const &dstRegion, GfVec4f const &normalizedSrcRegion=GfVec4f(0.0F, 0.0F, 1.0F, 1.0F)) |
| Composite the provided textures over the application / viewer's framebuffer contents. | |
Hydra Graphics Interface Interop.
HgiInterop provides functionality to transfer render targets between supported APIs as efficiently as possible.
Definition at line 33 of file hgiInterop.h.
| HGIINTEROP_API void TransferToApp | ( | Hgi * | srcHgi, |
| HgiTextureHandle const & | srcColor, | ||
| HgiTextureHandle const & | srcDepth, | ||
| TfToken const & | dstApi, | ||
| VtValue const & | dstFramebuffer, | ||
| GfVec4i const & | dstRegion, | ||
| GfVec4f const & | normalizedSrcRegion = GfVec4f(0.0F, 0.0F, 1.0F, 1.0F) ) |
Composite the provided textures over the application / viewer's framebuffer contents.
srcHgi: Determines the source format/platform of the textures. Eg. if hgi is of type HgiMetal, the textures are HgiMetalTexture. srcColor: is the source color aov texture to composite to screen. srcDepth: (optional) is the depth aov texture to composite to screen. dstApi: Determines what target format/platform the application is using. E.g. If hgi==HgiMetal and dstApi==OpenGL then TransferToApp will present the metal textures to the gl application. dstFramebuffer: The framebuffer that the source textures are presented into. This is a VtValue that encoding a framebuffer in a dstApi specific way. E.g., a uint32_t (aka GLuint) for framebuffer object for dstApi==OpenGL. For backwards compatibility, the currently bound framebuffer is used when the VtValue is empty.
dstRegion: Subrect region of the framebuffer over which to composite. Coordinates are (left, BOTTOM, width, height) which is the same convention as OpenGL viewport coordinates. Note this is specified in pixel coordinates.
normalizedSrcRegion: Normalized [0,1] sub-rectangle of the source textures to sample. Coordinates are (left, bottom, width, height). Identity is (0, 0, 1, 1) which samples the entire texture. Note this is specified in normalized coordinates.
Note: To composite correctly, blending is enabled. If srcDepth is provided, depth testing is enabled. As a result, the contents of the application framebuffer matter. In order to use the contents of srcColor and srcDepth as-is (i.e., blit), the color attachment should be cleared to (0,0,0,0) and the depth attachment needs to be cleared to 1.