MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / UnloadTextureData

Function UnloadTextureData

Chapter_14/src/Textures.cpp:63–74  ·  view source on GitHub ↗

* Releases texture data memory using the same method it was allocated */

Source from the content-addressed store, hash-verified

61 * Releases texture data memory using the same method it was allocated
62 */
63 void UnloadTextureData(TextureData& textureData) {
64
65 if (textureData.texels) {
66 if (textureData.stbAllocation)
67 stbi_image_free(textureData.texels);
68 else
69 delete[] textureData.texels;
70 }
71
72 textureData.texels = nullptr;
73 textureData.stbAllocation = false;
74 }
75
76 /**
77 * Compute the aligned memory required for the texture.

Callers 2

FormatTextureFunction · 0.85
UnloadTextureFunction · 0.85

Calls 1

stbi_image_freeFunction · 0.50

Tested by

no test coverage detected