mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Implement buffer uploads on SDMA
This commit is contained in:
parent
0a40e2c868
commit
eb71c62b33
@ -2054,6 +2054,37 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::uploadBuffer(
|
||||
const Rc<DxvkBuffer>& buffer,
|
||||
const void* data) {
|
||||
auto bufferSlice = buffer->getSliceHandle();
|
||||
|
||||
auto stagingSlice = m_staging.alloc(CACHE_LINE_SIZE, bufferSlice.length);
|
||||
auto stagingHandle = stagingSlice.getSliceHandle();
|
||||
std::memcpy(stagingHandle.mapPtr, data, bufferSlice.length);
|
||||
|
||||
VkBufferCopy region;
|
||||
region.srcOffset = stagingHandle.offset;
|
||||
region.dstOffset = bufferSlice.offset;
|
||||
region.size = bufferSlice.length;
|
||||
|
||||
m_cmd->cmdCopyBuffer(DxvkCmdBuffer::SdmaBuffer,
|
||||
stagingHandle.handle, bufferSlice.handle, 1, ®ion);
|
||||
|
||||
m_sdmaBarriers.releaseBuffer(
|
||||
m_initBarriers, bufferSlice,
|
||||
m_device->queues().transfer.queueFamily,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
m_device->queues().graphics.queueFamily,
|
||||
buffer->info().stages,
|
||||
buffer->info().access);
|
||||
|
||||
m_cmd->trackResource(stagingSlice.buffer());
|
||||
m_cmd->trackResource(buffer);
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setViewports(
|
||||
uint32_t viewportCount,
|
||||
const VkViewport* viewports,
|
||||
|
@ -772,6 +772,17 @@ namespace dxvk {
|
||||
VkDeviceSize pitchPerLayer,
|
||||
VkFormat format);
|
||||
|
||||
/**
|
||||
* \brief Uses transfer queue to initialize buffer
|
||||
*
|
||||
* Only safe to use if the buffer is not in use by the GPU.
|
||||
* \param [in] buffer The buffer to initialize
|
||||
* \param [in] data The data to copy to the buffer
|
||||
*/
|
||||
void uploadBuffer(
|
||||
const Rc<DxvkBuffer>& buffer,
|
||||
const void* data);
|
||||
|
||||
/**
|
||||
* \brief Sets viewports
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user