mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Implement depth-stencil upload via temporary buffer
This commit is contained in:
parent
0d889e0dcd
commit
b3ea1b02eb
@ -1776,6 +1776,46 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::updateDepthStencilImage(
|
||||
const Rc<DxvkImage>& image,
|
||||
const VkImageSubresourceLayers& subresources,
|
||||
VkOffset2D imageOffset,
|
||||
VkExtent2D imageExtent,
|
||||
const void* data,
|
||||
VkDeviceSize pitchPerRow,
|
||||
VkDeviceSize pitchPerLayer,
|
||||
VkFormat format) {
|
||||
auto formatInfo = imageFormatInfo(format);
|
||||
|
||||
VkExtent3D extent3D;
|
||||
extent3D.width = imageExtent.width;
|
||||
extent3D.height = imageExtent.height;
|
||||
extent3D.depth = subresources.layerCount;
|
||||
|
||||
VkDeviceSize pixelCount = extent3D.width * extent3D.height * extent3D.depth;
|
||||
|
||||
DxvkBufferCreateInfo tmpBufferInfo;
|
||||
tmpBufferInfo.size = pixelCount * formatInfo->elementSize;
|
||||
tmpBufferInfo.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
|
||||
tmpBufferInfo.stages = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
tmpBufferInfo.access = VK_ACCESS_SHADER_READ_BIT;
|
||||
|
||||
auto tmpBuffer = m_device->createBuffer(tmpBufferInfo,
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||
|
||||
util::packImageData(
|
||||
reinterpret_cast<char*>(tmpBuffer->mapPtr(0)),
|
||||
reinterpret_cast<const char*>(data),
|
||||
extent3D, formatInfo->elementSize,
|
||||
pitchPerRow, pitchPerLayer);
|
||||
|
||||
copyPackedBufferToDepthStencilImage(
|
||||
image, subresources, imageOffset, imageExtent,
|
||||
tmpBuffer, 0, format);
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setViewports(
|
||||
uint32_t viewportCount,
|
||||
const VkViewport* viewports,
|
||||
|
@ -676,6 +676,28 @@ namespace dxvk {
|
||||
VkDeviceSize pitchPerRow,
|
||||
VkDeviceSize pitchPerLayer);
|
||||
|
||||
/**
|
||||
* \brief Updates an depth-stencil image
|
||||
*
|
||||
* \param [in] image Destination image
|
||||
* \param [in] subsresources Image subresources to update
|
||||
* \param [in] imageOffset Offset of the image area to update
|
||||
* \param [in] imageExtent Size of the image area to update
|
||||
* \param [in] data Source data
|
||||
* \param [in] pitchPerRow Row pitch of the source data
|
||||
* \param [in] pitchPerLayer Layer pitch of the source data
|
||||
* \param [in] format Packed depth-stencil format
|
||||
*/
|
||||
void updateDepthStencilImage(
|
||||
const Rc<DxvkImage>& image,
|
||||
const VkImageSubresourceLayers& subresources,
|
||||
VkOffset2D imageOffset,
|
||||
VkExtent2D imageExtent,
|
||||
const void* data,
|
||||
VkDeviceSize pitchPerRow,
|
||||
VkDeviceSize pitchPerLayer,
|
||||
VkFormat format);
|
||||
|
||||
/**
|
||||
* \brief Sets viewports
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user