| Flutter Impeller |

Classes | Functions | Variables
impeller::glvk Namespace Reference

## Classes
class | ProcTable
| A proc. table consisting of methods that are useful when interoperating between OpenGL and Vulkan. This is different from the OpenGL proc. table since it may contain more interop extension related methods. More...
class | Trampoline
| An object used to interoperate between OpenGL and Vulkan. More...
class | AutoTrampolineContext
| An RAII object that makes the trampolines EGL context current when constructed and clears the EGL binding on destruction. More...

## Functions
static UniqueEGLImageKHR | CreateEGLImageFromAHBTexture (const EGLDisplay &display, const AHBTextureSourceVK &to_texture)

## Variables
static GLuint | kAttributeIndexPosition = 0u
static GLuint | kAttributeIndexTexCoord = 1u
static constexpr const char * | kVertShader
static constexpr const char * | kFragShader

## Function Documentation

## ◆ CreateEGLImageFromAHBTexture()

static UniqueEGLImageKHR impeller::glvk::CreateEGLImageFromAHBTexture | ( | const EGLDisplay & | display,
|  | const AHBTextureSourceVK & | to_texture
| ) |  |
| static

Definition at line 165 of file trampoline.cc.

167 {
168 if (!android::GetProcTable().eglGetNativeClientBufferANDROID.IsAvailable()) {
169 VALIDATION_LOG << "Could not get native client buffer.";
170 return {};
171 }
172
173 EGLClientBuffer client_buffer =
174 android::GetProcTable().eglGetNativeClientBufferANDROID(
175 to_texture.GetBackingStore()->GetHandle());
176
177 if (!client_buffer) {
178 VALIDATION_LOG
179 << "Could not get client buffer from Android hardware buffer.";
180 return {};
181 }
182
183 auto image = ::eglCreateImageKHR(display, //
184 EGL_NO_CONTEXT, //
185 EGL_NATIVE_BUFFER_ANDROID, //
186 client_buffer, //
187 nullptr //
188 );
189 if (image == NULL) {
190 VALIDATION_LOG << "Could not create EGL Image.";
191 return {};
192 }
193
194 return UniqueEGLImageKHR(EGLImageKHRWithDisplay{image, display});
195 }
impeller::android::GetProcTable
const ProcTable & GetProcTable()
Definition: proc_table.cc:12
impeller::UniqueEGLImageKHR
fml::UniqueObject< EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits > UniqueEGLImageKHR
Definition: image.h:73
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::AHBTextureSourceVK::GetBackingStore(), impeller::android::HardwareBuffer::GetHandle(), impeller::android::GetProcTable(), and VALIDATION_LOG.

Referenced by impeller::glvk::Trampoline::BlitTextureOpenGLToVulkan().

## Variable Documentation

## ◆ kAttributeIndexPosition

GLuint impeller::glvk::kAttributeIndexPosition = 0u
| static

Definition at line 20 of file trampoline.cc.

Referenced by impeller::glvk::Trampoline::BlitTextureOpenGLToVulkan(), and impeller::glvk::Trampoline::Trampoline().

## ◆ kAttributeIndexTexCoord

GLuint impeller::glvk::kAttributeIndexTexCoord = 1u
| static

Definition at line 21 of file trampoline.cc.

Referenced by impeller::glvk::Trampoline::BlitTextureOpenGLToVulkan(), and impeller::glvk::Trampoline::Trampoline().

## ◆ kFragShader

constexpr const char* impeller::glvk::kFragShader
| staticconstexpr

Initial value:
= R"IMPELLER_SHADER(#version 100
#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES uTexture;
uniform mat4 uUVTransformation;
varying vec2 vTexCoord;
void main() {
vec2 texture_coords = (uUVTransformation * vec4(vTexCoord, 0, 1)).xy;
gl_FragColor = texture2D(uTexture, texture_coords);
}
)IMPELLER_SHADER"

Definition at line 39 of file trampoline.cc.

Referenced by impeller::glvk::Trampoline::Trampoline().

## ◆ kVertShader

constexpr const char* impeller::glvk::kVertShader
| staticconstexpr

Initial value:
= R"IMPELLER_SHADER(#version 100
precision mediump float;
attribute vec2 aPosition;
attribute vec2 aTexCoord;
varying vec2 vTexCoord;
void main() {
gl_Position = vec4(aPosition, 0.0, 1.0);
vTexCoord = aTexCoord;
}
)IMPELLER_SHADER"

Definition at line 23 of file trampoline.cc.

Referenced by impeller::glvk::Trampoline::Trampoline().