From 18c0c9dea9ff73f1526473aacb85f9a6bb272b13 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 10 Jan 2021 14:46:13 -0800 Subject: GLTF loader: reworked initial texture data to be stored as user data in the texture/allocation to make sure that GPU data is always initialized before the first use --- TextureLoader/src/TextureLoader.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'TextureLoader/src/TextureLoader.cpp') diff --git a/TextureLoader/src/TextureLoader.cpp b/TextureLoader/src/TextureLoader.cpp index d402fed..d0021f6 100644 --- a/TextureLoader/src/TextureLoader.cpp +++ b/TextureLoader/src/TextureLoader.cpp @@ -205,14 +205,15 @@ void CreateTextureFromImage(Image* pSrcImage, pDevice->CreateTexture(TexDesc, &TexData, ppTexture); } -void CreateTextureFromDDS(IDataBlob* pDDSData, +void CreateTextureFromDDS(const void* pDDSData, + size_t DataSize, const TextureLoadInfo& TexLoadInfo, IRenderDevice* pDevice, ITexture** ppTexture) { CreateDDSTextureFromMemoryEx(pDevice, - reinterpret_cast(pDDSData->GetDataPtr()), - static_cast(pDDSData->GetSize()), + reinterpret_cast(pDDSData), + DataSize, 0, // maxSize TexLoadInfo.Usage, TexLoadInfo.Name, @@ -269,12 +270,13 @@ extern "C" Diligent::CreateTextureFromImage(pSrcImage, TexLoadInfo, pDevice, ppTexture); } - void Diligent_CreateTextureFromDDS(Diligent::IDataBlob* pDDSData, + void Diligent_CreateTextureFromDDS(const void* pDDSData, + size_t DataSize, const Diligent::TextureLoadInfo& TexLoadInfo, Diligent::IRenderDevice* pDevice, Diligent::ITexture** ppTexture) { - Diligent::CreateTextureFromDDS(pDDSData, TexLoadInfo, pDevice, ppTexture); + Diligent::CreateTextureFromDDS(pDDSData, DataSize, TexLoadInfo, pDevice, ppTexture); } -} \ No newline at end of file +} -- cgit v1.2.3