mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[dxvk] Add initBuffer method
This commit is contained in:
parent
f7e021f791
commit
080aa1a989
@ -1505,6 +1505,22 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxvkContext::initBuffer(
|
||||||
|
const Rc<DxvkBuffer>& buffer) {
|
||||||
|
auto slice = buffer->getSliceHandle();
|
||||||
|
|
||||||
|
m_cmd->cmdFillBuffer(DxvkCmdBuffer::InitBuffer,
|
||||||
|
slice.handle, slice.offset,
|
||||||
|
dxvk::align(slice.length, 4), 0);
|
||||||
|
|
||||||
|
m_initBarriers.accessBuffer(slice,
|
||||||
|
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
|
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||||
|
buffer->info().stages,
|
||||||
|
buffer->info().access);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::initImage(
|
void DxvkContext::initImage(
|
||||||
const Rc<DxvkImage>& image,
|
const Rc<DxvkImage>& image,
|
||||||
const VkImageSubresourceRange& subresources,
|
const VkImageSubresourceRange& subresources,
|
||||||
@ -5234,8 +5250,7 @@ namespace dxvk {
|
|||||||
m_zeroBuffer = m_device->createBuffer(bufInfo,
|
m_zeroBuffer = m_device->createBuffer(bufInfo,
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||||
|
|
||||||
clearBuffer(m_zeroBuffer, 0, bufInfo.size, 0);
|
this->initBuffer(m_zeroBuffer);
|
||||||
m_execBarriers.recordCommands(m_cmd);
|
|
||||||
return m_zeroBuffer;
|
return m_zeroBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,7 +638,17 @@ namespace dxvk {
|
|||||||
void generateMipmaps(
|
void generateMipmaps(
|
||||||
const Rc<DxvkImageView>& imageView,
|
const Rc<DxvkImageView>& imageView,
|
||||||
VkFilter filter);
|
VkFilter filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initializes a buffer
|
||||||
|
*
|
||||||
|
* Clears the given buffer to zero. Only safe to call
|
||||||
|
* if the buffer is not currently in use by the GPU.
|
||||||
|
* \param [in] buffer Buffer to clear
|
||||||
|
*/
|
||||||
|
void initBuffer(
|
||||||
|
const Rc<DxvkBuffer>& buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Initializes an image
|
* \brief Initializes an image
|
||||||
*
|
*
|
||||||
|
@ -179,7 +179,7 @@ namespace dxvk {
|
|||||||
void DxvkUnboundResources::clearBuffer(
|
void DxvkUnboundResources::clearBuffer(
|
||||||
const Rc<DxvkContext>& ctx,
|
const Rc<DxvkContext>& ctx,
|
||||||
const Rc<DxvkBuffer>& buffer) {
|
const Rc<DxvkBuffer>& buffer) {
|
||||||
ctx->clearBuffer(buffer, 0, buffer->info().size, 0);
|
ctx->initBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user