ktx loading fixes
This commit is contained in:
parent
3537d2cca2
commit
af3ae38bd2
2 changed files with 5 additions and 10 deletions
|
|
@ -406,11 +406,11 @@ public:
|
|||
assert(asset);
|
||||
size_t size = AAsset_getLength(asset);
|
||||
assert(size > 0);
|
||||
void *textureData = malloc(size);
|
||||
ktx_uint8_t* textureData = new ktx_uint8_t[size];
|
||||
AAsset_read(asset, textureData, size);
|
||||
AAsset_close(asset);
|
||||
result = ktxTexture_CreateFromMemory(textureData, size, KTX_TEXTURE_CREATE_LOAD_IMAGE_DATA_BIT, target);
|
||||
free(textureData);
|
||||
result = ktxTexture_CreateFromMemory(textureData, size, KTX_TEXTURE_CREATE_LOAD_IMAGE_DATA_BIT, &ktxTexture);
|
||||
delete[] textureData;
|
||||
|
||||
#else
|
||||
result = ktxTexture_CreateFromNamedFile(filename.c_str(), KTX_TEXTURE_CREATE_LOAD_IMAGE_DATA_BIT, &ktxTexture);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void loadTexture(std::string fileName, VkFormat format, bool forceLinearTiling)
|
||||
void loadTexture(std::string filename, VkFormat format, bool forceLinearTiling)
|
||||
{
|
||||
ktxResult result;
|
||||
ktxTexture* ktxTexture;
|
||||
|
|
@ -143,11 +143,6 @@ public:
|
|||
#endif
|
||||
assert(result == KTX_SUCCESS);
|
||||
|
||||
VkFormatProperties formatProperties;
|
||||
|
||||
|
||||
VkFormatProperties formatProperties;
|
||||
|
||||
texture.width = ktxTexture->baseWidth;
|
||||
texture.height = ktxTexture->baseHeight;
|
||||
ktx_uint8_t *ktxTextureData = ktxTexture_GetData(ktxTexture);
|
||||
|
|
@ -159,8 +154,8 @@ public:
|
|||
texture.mipLevels = floor(log2(std::max(texture.width, texture.height))) + 1;
|
||||
|
||||
// Get device properites for the requested texture format
|
||||
VkFormatProperties formatProperties;
|
||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProperties);
|
||||
|
||||
// Mip-chain generation requires support for blit source and destination
|
||||
assert(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT);
|
||||
assert(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue