MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ktxTexture1_CreateFromMemory

Function ktxTexture1_CreateFromMemory

lib/texture1.c:767–789  ·  view source on GitHub ↗

* @memberof ktxTexture1 * @~English * @brief Create a ktxTexture1 from KTX-formatted data in memory. * * The address of a newly created texture reflecting the contents of the * serialized KTX data is written to the location pointed at by @p newTex. * * The create flag KTX_TEXTURE_CREATE_LOAD_IMAGE_DATA_BIT should not be set, * if the ktxTexture1 is ultimately to be uploaded to OpenGL or Vu

Source from the content-addressed store, hash-verified

765 * For other exceptions, see ktxTexture1_CreateFromStdioStream().
766 */
767KTX_error_code
768ktxTexture1_CreateFromMemory(const ktx_uint8_t* bytes, ktx_size_t size,
769 ktxTextureCreateFlags createFlags,
770 ktxTexture1** newTex)
771{
772 KTX_error_code result;
773 if (newTex == NULL)
774 return KTX_INVALID_VALUE;
775
776 ktxTexture1* tex = (ktxTexture1*)malloc(sizeof(ktxTexture1));
777 if (tex == NULL)
778 return KTX_OUT_OF_MEMORY;
779
780 result = ktxTexture1_constructFromMemory(tex, bytes, size,
781 createFlags);
782 if (result == KTX_SUCCESS)
783 *newTex = (ktxTexture1*)tex;
784 else {
785 free(tex);
786 *newTex = NULL;
787 }
788 return result;
789}
790
791/**
792 * @memberof ktxTexture1

Callers 1

TEST_FFunction · 0.85

Calls 1

Tested by 1

TEST_FFunction · 0.68