|
Kanzi Graphics Engine
|
Shared 2D image texture. More...
#include "kzu_resource_common.h"#include "kzu_texture_base.h"#include <system/debug/kzs_error.h>#include <system/kzs_types.h>#include <system/kzs_header.h>Typedefs | |
| typedef kzsError(* | kzuSharedImageTextureExternalTextureCreateFunction )(struct KzuSharedImageTexture *imageTexture, kzUint *out_textureHandle) |
| Callback for creating external texture. More... | |
Functions | |
| kzsError | kzuSharedImageTextureCreate (const struct KzuResourceManager *resourceManager, kzString name, enum KzuTextureChannels channels, kzUint width, kzUint height, void *clientBuffer, void *userData, kzBool isExternalTexture, struct KzuSharedImageTexture **out_imageTexture) |
| Creates a shared 2D image texture that can perform data updates asynchronously. More... | |
| kzsError | kzuSharedImageTextureCreateExternal (const struct KzuResourceManager *resourceManager, kzString name, kzUint width, kzUint height, void *userData, kzUint externalTextureHandle, kzuSharedImageTextureExternalTextureCreateFunction externalTextureCreator, struct KzuSharedImageTexture **out_imageTexture) |
| Creates a shared 2D image texture that shares texture data with a texture created in the same or another OpenGL context. More... | |
| kzsError | kzuSharedImageTextureRegisterToFactory (const struct KzuFactory *factory) |
| Registers shared image texture type to factory. More... | |
| struct KzuTexture * | kzuSharedImageTextureToTexture (const struct KzuSharedImageTexture *imageTexture) |
| Converts 2D image texture to texture. More... | |
| struct KzuSharedImageTexture * | kzuSharedImageTextureFromTexture (const struct KzuTexture *texture) |
| Converts texture to 2D image texture. More... | |
| struct KzuGPUResource * | kzuSharedImageTextureToGPUResource (const struct KzuSharedImageTexture *imageTexture) |
| Converts 2D image texture to GPU resource. More... | |
| struct KzuSharedImageTexture * | kzuSharedImageTextureFromGPUResource (const struct KzuGPUResource *gpuResource) |
| Converts GPU resource to 2D image texture. More... | |
| struct KzuResource * | kzuSharedImageTextureToResource (const struct KzuSharedImageTexture *imageTexture) |
| Converts 2D image texture to resource. More... | |
| struct KzuSharedImageTexture * | kzuSharedImageTextureFromResource (const struct KzuResource *resource) |
| Converts resource to 2D image texture. More... | |
| kzsError | kzuSharedImageTextureLock (struct KzuSharedImageTexture *imageTexture) |
| Locks data update. More... | |
| kzsError | kzuSharedImageTextureUpdate (struct KzuSharedImageTexture *imageTexture, void *data, kzUint dataSize) |
| Performs the data update for image texture. More... | |
| kzsError | kzuSharedImageTextureUnlock (struct KzuSharedImageTexture *imageTexture) |
| Unlocks data update for image texture. More... | |
| void * | kzuSharedImageTextureGetUserData (const struct KzuSharedImageTexture *imageTexture) |
| Gets user data. More... | |
Variables | |
| const KzuResourceType | KZU_RESOURCE_TYPE_SHARED_IMAGE_TEXTURE |
| Resource type identifier for shared 2D image texture. More... | |
Shared 2D image texture.
Copyright 2008-2019 by Rightware. All rights reserved.
| typedef kzsError(* kzuSharedImageTextureExternalTextureCreateFunction)(struct KzuSharedImageTexture *imageTexture, kzUint *out_textureHandle) |
Callback for creating external texture.
On Android, OpenGL context is recreated when resumed.
| kzsError kzuSharedImageTextureCreate | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| enum KzuTextureChannels | channels, | ||
| kzUint | width, | ||
| kzUint | height, | ||
| void * | clientBuffer, | ||
| void * | userData, | ||
| kzBool | isExternalTexture, | ||
| struct KzuSharedImageTexture ** | out_imageTexture | ||
| ) |
Creates a shared 2D image texture that can perform data updates asynchronously.
It's by default an RGBA8 texture, unless otherwise specified in client buffer.
| width | Width of the texture. |
| height | Height of the texture. |
| clientBuffer | Client buffer to perform the data upload, for example Android GraphicBuffer. When KZ_NULL, ignored. |
| userData | Platform specific user data of the client buffer, directly EGL config when utilizing. When KZ_NULL, ignored. |
| isExternalTexture | Is texture external, can be utilized when retrieving data non-RGB format such as YUV and doing the conversion on GPU via EXTERNAL_TEXTURE_OES extension. When using external textures in OpenGL shader, user must make sure that sampler uniform is type of samplerExternalOES instead of sampler2D and extension #extension GL_OES_EGL_image_external : require has been specified. |
| kzsError kzuSharedImageTextureCreateExternal | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| kzUint | width, | ||
| kzUint | height, | ||
| void * | userData, | ||
| kzUint | externalTextureHandle, | ||
| kzuSharedImageTextureExternalTextureCreateFunction | externalTextureCreator, | ||
| struct KzuSharedImageTexture ** | out_imageTexture | ||
| ) |
Creates a shared 2D image texture that shares texture data with a texture created in the same or another OpenGL context.
When using external textures in OpenGL shader, user must make sure that sampler uniform is type of samplerExternalOES instead of sampler2D and extension #extension GL_OES_EGL_image_external : require has been specified.
| externalTextureHandle | Texture handle of the texture being shared. |
| kzsError kzuSharedImageTextureRegisterToFactory | ( | const struct KzuFactory * | factory) |
Registers shared image texture type to factory.
| struct KzuTexture* kzuSharedImageTextureToTexture | ( | const struct KzuSharedImageTexture * | imageTexture) |
Converts 2D image texture to texture.
| struct KzuSharedImageTexture* kzuSharedImageTextureFromTexture | ( | const struct KzuTexture * | texture) |
Converts texture to 2D image texture.
| struct KzuGPUResource* kzuSharedImageTextureToGPUResource | ( | const struct KzuSharedImageTexture * | imageTexture) |
Converts 2D image texture to GPU resource.
| struct KzuSharedImageTexture* kzuSharedImageTextureFromGPUResource | ( | const struct KzuGPUResource * | gpuResource) |
Converts GPU resource to 2D image texture.
| struct KzuResource* kzuSharedImageTextureToResource | ( | const struct KzuSharedImageTexture * | imageTexture) |
Converts 2D image texture to resource.
| struct KzuSharedImageTexture* kzuSharedImageTextureFromResource | ( | const struct KzuResource * | resource) |
Converts resource to 2D image texture.
| kzsError kzuSharedImageTextureLock | ( | struct KzuSharedImageTexture * | imageTexture) |
Locks data update.
When locked, data can be safely updated in separate thread / process.
| kzsError kzuSharedImageTextureUpdate | ( | struct KzuSharedImageTexture * | imageTexture, |
| void * | data, | ||
| kzUint | dataSize | ||
| ) |
Performs the data update for image texture.
Must be called between Lock and Unlock.
| kzsError kzuSharedImageTextureUnlock | ( | struct KzuSharedImageTexture * | imageTexture) |
Unlocks data update for image texture.
When unlocked, main thread can safely take the data into use.
| void* kzuSharedImageTextureGetUserData | ( | const struct KzuSharedImageTexture * | imageTexture) |
Gets user data.
| const KzuResourceType KZU_RESOURCE_TYPE_SHARED_IMAGE_TEXTURE |
Resource type identifier for shared 2D image texture.