An object used to interoperate between OpenGL and Vulkan. More...
#include <trampoline.h>
Classes | |
struct | GLTextureInfo |
Describes an OpenGL texture along with information on how to sample from it. More... | |
Public Member Functions | |
Trampoline () | |
Constructs a new trampoline. It is recommended that these objects be cached and reused for all conversion operations. More... | |
~Trampoline () | |
Destroys the trampoline. There are no threading restrictions. EGL contexts on already bound to the callers thread may become unbound after a call to this method. More... | |
Trampoline (const Trampoline &)=delete | |
Trampoline & | operator= (const Trampoline &)=delete |
bool | IsValid () const |
Determines if this is a valid trampoline. There is no error recovery mechanism if a trampoline cannot be constructed and an invalid trampoline must be immediately discarded. More... | |
bool | BlitTextureOpenGLToVulkan (const GLTextureInfo &src_texture, const AHBTextureSourceVK &dst_texture) const |
Perform a blit operation from the source OpenGL texture to a target Vulkan texture. More... | |
AutoTrampolineContext | MakeCurrentContext () const |
Make the EGL context associated with this trampoline current on the calling thread. More... | |
Friends | |
class | AutoTrampolineContext |
An object used to interoperate between OpenGL and Vulkan.
While these are not super expensive to create, they do manage an internal EGL context as well as some OpenGL state. For this reason, it is recommended that callers cache these for the duration of the lifecycle of main rendering context.
Definition at line 27 of file trampoline.h.
impeller::glvk::Trampoline::Trampoline | ( | ) |
Constructs a new trampoline. It is recommended that these objects be cached and reused for all conversion operations.
EGL contexts on already bound to the callers thread may become unbound after a call to this method.
Definition at line 57 of file trampoline.cc.
References impeller::egl::ConfigDescriptor::api, impeller::egl::ConfigDescriptor::color_format, impeller::egl::CreateProcAddressResolver(), impeller::egl::ConfigDescriptor::depth_bits, impeller::glvk::kAttributeIndexPosition, impeller::glvk::kAttributeIndexTexCoord, impeller::glvk::kFragShader, impeller::egl::kOne, impeller::egl::kOpenGLES2, impeller::egl::kPBuffer, impeller::egl::kRGBA8888, impeller::glvk::kVertShader, impeller::egl::kZero, impeller::egl::ConfigDescriptor::samples, impeller::egl::ConfigDescriptor::stencil_bits, impeller::egl::ConfigDescriptor::surface_type, and VALIDATION_LOG.
impeller::glvk::Trampoline::~Trampoline | ( | ) |
Destroys the trampoline. There are no threading restrictions. EGL contexts on already bound to the callers thread may become unbound after a call to this method.
Definition at line 153 of file trampoline.cc.
References MakeCurrentContext().
|
delete |
bool impeller::glvk::Trampoline::BlitTextureOpenGLToVulkan | ( | const GLTextureInfo & | src_texture, |
const AHBTextureSourceVK & | dst_texture | ||
) | const |
Perform a blit operation from the source OpenGL texture to a target Vulkan texture.
It is the callers responsibility to ensure that the EGL context associated with the trampoline is already current before making this call.
It is also the responsibility of the caller to ensure that the destination texture is the color-attachment-optimal layout. Failure to ensure this will lead to validation error.
MakeCurrentContext
[in] | src_texture | The source OpenGL texture. |
[in] | dst_texture | The destination Vulkan texture. |
Definition at line 197 of file trampoline.cc.
References impeller::glvk::CreateEGLImageFromAHBTexture(), impeller::TextureSourceVK::GetTextureDescriptor(), impeller::glvk::kAttributeIndexPosition, impeller::glvk::kAttributeIndexTexCoord, impeller::TextureDescriptor::size, impeller::glvk::Trampoline::GLTextureInfo::target, impeller::glvk::Trampoline::GLTextureInfo::texture, impeller::glvk::Trampoline::GLTextureInfo::uv_transformation, and VALIDATION_LOG.
bool impeller::glvk::Trampoline::IsValid | ( | ) | const |
Determines if this is a valid trampoline. There is no error recovery mechanism if a trampoline cannot be constructed and an invalid trampoline must be immediately discarded.
Definition at line 161 of file trampoline.cc.
AutoTrampolineContext impeller::glvk::Trampoline::MakeCurrentContext | ( | ) | const |
Make the EGL context associated with this trampoline current on the calling thread.
Definition at line 313 of file trampoline.cc.
Referenced by ~Trampoline().
|
delete |
|
friend |
Definition at line 111 of file trampoline.h.