summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFLoader.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-01 05:40:10 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-01 05:40:10 +0000
commit8cb15ebb5da1fc825a211548d51a7e77bb981647 (patch)
tree672f8cf5e267d898abb30a83425af3b0a5567357 /AssetLoader/src/GLTFLoader.cpp
parentGLTF Loader: implemented buffer suballocation in cache (diff)
downloadDiligentTools-8cb15ebb5da1fc825a211548d51a7e77bb981647.tar.gz
DiligentTools-8cb15ebb5da1fc825a211548d51a7e77bb981647.zip
GLTF Loader: added GetFirstIndexLocation and GetBaseVertex methods
Diffstat (limited to 'AssetLoader/src/GLTFLoader.cpp')
-rw-r--r--AssetLoader/src/GLTFLoader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/AssetLoader/src/GLTFLoader.cpp b/AssetLoader/src/GLTFLoader.cpp
index bfd074d..9fe0cd2 100644
--- a/AssetLoader/src/GLTFLoader.cpp
+++ b/AssetLoader/src/GLTFLoader.cpp
@@ -895,9 +895,10 @@ void Model::PrepareGPUResources(IDeviceContext* pCtx)
auto UpdateBuffer = [&](BUFFER_ID BuffId, const void* pData, size_t Size) //
{
- Uint32 Offset = 0;
- auto* pBuffer = GetBuffer(BuffId, Offset);
- pCtx->UpdateBuffer(pBuffer, Offset, static_cast<Uint32>(Size), pData, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
+ auto* pBuffer = GetBuffer(BuffId);
+ VERIFY_EXPR(pBuffer != nullptr);
+ auto Offset = Buffers[BuffId].CacheAllocation.IsValid() ? Buffers[BuffId].CacheAllocation.Region.UnalignedOffset : 0;
+ pCtx->UpdateBuffer(pBuffer, static_cast<Uint32>(Offset), static_cast<Uint32>(Size), pData, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
if (Buffers[BuffId].pBuffer != nullptr)
{
VERIFY_EXPR(Buffers[BuffId].pBuffer == pBuffer);