Skip to content

Commit

Permalink
HnTextureUtils: eliminated source data copy when creating texture loader
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Oct 31, 2024
1 parent f7bf044 commit d6a500b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Hydrogent/src/HnTextureUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

#include "HnTextureUtils.hpp"

#include "ProxyDataBlob.hpp"
#include "RefCntContainer.hpp"

#include "pxr/usd/ar/asset.h"
#include "pxr/usd/ar/resolver.h"

Expand All @@ -52,8 +55,11 @@ RefCntAutoPtr<ITextureLoader> CreateTextureLoaderFromSdfPath(const char*
if (!Buffer)
return {};

RefCntAutoPtr<IObject> pAssetData = RefCntContainer<std::shared_ptr<const char>>::Create(Buffer);
RefCntAutoPtr<IDataBlob> pDataBlob = ProxyDataBlob::Create(Buffer.get(), Asset->GetSize(), pAssetData);

RefCntAutoPtr<ITextureLoader> pLoader;
CreateTextureLoaderFromMemory(Buffer.get(), Asset->GetSize(), true, LoadInfo, &pLoader);
CreateTextureLoaderFromDataBlob(pDataBlob, LoadInfo, &pLoader);

return pLoader;
}
Expand Down

0 comments on commit d6a500b

Please sign in to comment.