1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 10:24:12 +01:00

[dxvk] Support depth-stencil meta-copy operations

This commit is contained in:
Philip Rebohle 2019-07-18 16:43:19 +02:00
parent 0dd8cba199
commit e611dff45e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 28 additions and 12 deletions

View File

@ -2740,18 +2740,24 @@ namespace dxvk {
srcViewInfo.type = viewType; srcViewInfo.type = viewType;
srcViewInfo.format = srcImage->info().format; srcViewInfo.format = srcImage->info().format;
srcViewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; srcViewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
srcViewInfo.aspect = srcSubresource.aspectMask; srcViewInfo.aspect = srcSubresource.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_COLOR_BIT);
srcViewInfo.minLevel = srcSubresource.mipLevel; srcViewInfo.minLevel = srcSubresource.mipLevel;
srcViewInfo.numLevels = 1; srcViewInfo.numLevels = 1;
srcViewInfo.minLayer = srcSubresource.baseArrayLayer; srcViewInfo.minLayer = srcSubresource.baseArrayLayer;
srcViewInfo.numLayers = srcSubresource.layerCount; srcViewInfo.numLayers = srcSubresource.layerCount;
auto tgtImageView = m_device->createImageView(tgtImage, tgtViewInfo); Rc<DxvkImageView> tgtImageView = m_device->createImageView(tgtImage, tgtViewInfo);
auto srcImageView = m_device->createImageView(srcImage, srcViewInfo); Rc<DxvkImageView> srcImageView = m_device->createImageView(srcImage, srcViewInfo);
Rc<DxvkImageView> srcStencilView;
if (srcSubresource.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) {
srcViewInfo.aspect = VK_IMAGE_ASPECT_STENCIL_BIT;
srcStencilView = m_device->createImageView(srcImage, srcViewInfo);
}
// Create framebuffer and pipeline for the copy // Create framebuffer and pipeline for the copy
Rc<DxvkMetaCopyRenderPass> fb = new DxvkMetaCopyRenderPass( Rc<DxvkMetaCopyRenderPass> fb = new DxvkMetaCopyRenderPass(
m_device->vkd(), tgtImageView, srcImageView, m_device->vkd(), tgtImageView, srcImageView, srcStencilView,
tgtImage->isFullSubresource(tgtSubresource, extent)); tgtImage->isFullSubresource(tgtSubresource, extent));
auto pipeInfo = m_metaCopy->getPipeline( auto pipeInfo = m_metaCopy->getPipeline(
@ -2775,6 +2781,12 @@ namespace dxvk {
descriptorWrite.dstSet = allocateDescriptorSet(pipeInfo.dsetLayout); descriptorWrite.dstSet = allocateDescriptorSet(pipeInfo.dsetLayout);
m_cmd->updateDescriptorSets(1, &descriptorWrite); m_cmd->updateDescriptorSets(1, &descriptorWrite);
if (srcSubresource.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) {
descriptorImage.imageView = srcStencilView->handle();
descriptorWrite.dstBinding = 1;
m_cmd->updateDescriptorSets(1, &descriptorWrite);
}
VkViewport viewport; VkViewport viewport;
viewport.x = float(tgtOffset.x); viewport.x = float(tgtOffset.x);

View File

@ -19,12 +19,14 @@ namespace dxvk {
const Rc<vk::DeviceFn>& vkd, const Rc<vk::DeviceFn>& vkd,
const Rc<DxvkImageView>& dstImageView, const Rc<DxvkImageView>& dstImageView,
const Rc<DxvkImageView>& srcImageView, const Rc<DxvkImageView>& srcImageView,
const Rc<DxvkImageView>& srcStencilView,
bool discardDst) bool discardDst)
: m_vkd (vkd), : m_vkd (vkd),
m_dstImageView(dstImageView), m_dstImageView (dstImageView),
m_srcImageView(srcImageView), m_srcImageView (srcImageView),
m_renderPass (createRenderPass(discardDst)), m_srcStencilView(srcStencilView),
m_framebuffer (createFramebuffer()) { m_renderPass (createRenderPass(discardDst)),
m_framebuffer (createFramebuffer()) {
} }

View File

@ -63,6 +63,7 @@ namespace dxvk {
const Rc<vk::DeviceFn>& vkd, const Rc<vk::DeviceFn>& vkd,
const Rc<DxvkImageView>& dstImageView, const Rc<DxvkImageView>& dstImageView,
const Rc<DxvkImageView>& srcImageView, const Rc<DxvkImageView>& srcImageView,
const Rc<DxvkImageView>& srcStencilView,
bool discardDst); bool discardDst);
~DxvkMetaCopyRenderPass(); ~DxvkMetaCopyRenderPass();
@ -77,10 +78,11 @@ namespace dxvk {
private: private:
const Rc<vk::DeviceFn> m_vkd; Rc<vk::DeviceFn> m_vkd;
const Rc<DxvkImageView> m_dstImageView; Rc<DxvkImageView> m_dstImageView;
const Rc<DxvkImageView> m_srcImageView; Rc<DxvkImageView> m_srcImageView;
Rc<DxvkImageView> m_srcStencilView;
VkRenderPass m_renderPass = VK_NULL_HANDLE; VkRenderPass m_renderPass = VK_NULL_HANDLE;
VkFramebuffer m_framebuffer = VK_NULL_HANDLE; VkFramebuffer m_framebuffer = VK_NULL_HANDLE;