Right so the answer is very easy it turns out:
Using the MiniEngine examples, create a DynamicUploadBuffer
, map it, copy the data to be transferred into it, then use WriteBuffer
to update the portion of gpu buffer:
float * buffer = (float*)m_TransformUploadBuffer.Map();
memcpy(buffer, &trans_mat, 16 * sizeof(float));
auto index = 1;
ComputeContext& Ctx = ComputeContext::Begin(L"UploadTest");
Ctx.WriteBuffer(m_TransformBuffer, index * sizeof(float) * 16, buffer, 16*sizeof(float));
Ctx.Finish(true);
m_TransformUploadBuffer.Unmap();