Skip to content

Commit 8e6acba

Browse files
GPUUploadManager: add pDstBuffer, DstOffset, and NumBytes parameters to callback
1 parent 1a889f9 commit 8e6acba

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

Graphics/GraphicsTools/interface/GPUUploadManager.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ typedef struct GPUUploadManagerCreateInfo GPUUploadManagerCreateInfo;
4848
/// Callback function type for GPU upload enqueued callback.
4949
/// This callback is called when the GPU copy operation is scheduled for execution
5050
/// in the render thread.
51-
typedef void (*GPUUploadEnqueuedCallbackType)(void*);
51+
typedef void (*GPUUploadEnqueuedCallbackType)(IBuffer* pDstBuffer,
52+
Uint32 DstOffset,
53+
Uint32 NumBytes,
54+
void* pUserData);
5255

5356
// clang-format off
5457

Graphics/GraphicsTools/src/GPUUploadManagerImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void GPUUploadManagerImpl::Page::ExecutePendingOps(IDeviceContext* pContext, Uin
248248

249249
if (Op.Callback != nullptr)
250250
{
251-
Op.Callback(Op.pCallbackData);
251+
Op.Callback(Op.pDstBuffer, Op.DstOffset, Op.NumBytes, Op.pCallbackData);
252252
}
253253
}
254254
m_NumPendingOps.store(0);

Tests/DiligentCoreTest/src/GraphicsTools/GPUUploadManagerPageTest.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,13 @@ TEST(GPUUploadManagerPageTest, ScheduleBufferUpdateParallel)
240240
static constexpr size_t kNumIterations = kNumUpdates;
241241

242242
Uint32 NumUpdatesScheduled = 0;
243-
auto Callback = MakeCallback([&NumUpdatesScheduled] {
244-
NumUpdatesScheduled++;
245-
});
243+
auto Callback =
244+
MakeCallback(
245+
[&NumUpdatesScheduled](IBuffer* pDstBuffer,
246+
Uint32 DstOffset,
247+
Uint32 NumBytes) {
248+
NumUpdatesScheduled++;
249+
});
246250

247251
std::atomic<size_t> UpdatesScheduled{0};
248252
for (size_t t = 0; t < kNumThreads; ++t)

0 commit comments

Comments
 (0)