1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 22:24:15 +01:00

[dxvk] Change resolveImage interface to accept an explicit format

This commit is contained in:
Philip Rebohle 2018-02-20 22:26:23 +01:00
parent 43dbc9f1d6
commit cb3daaf856
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 40 additions and 28 deletions

View File

@ -801,25 +801,22 @@ namespace dxvk {
cSrcImage, cSrcLayers, VkOffset3D { 0, 0, 0 }, cSrcImage, cSrcLayers, VkOffset3D { 0, 0, 0 },
cDstImage->mipLevelExtent(cDstLayers.mipLevel)); cDstImage->mipLevelExtent(cDstLayers.mipLevel));
}); });
} else if (!srcFormatInfo.flags.test(DxgiFormatFlag::Typeless) } else {
&& !dstFormatInfo.flags.test(DxgiFormatFlag::Typeless)) { const VkFormat format = m_parent->LookupFormat(
if (dstDesc.Format != srcDesc.Format) { Format, DxgiFormatMode::Any).format;
Logger::err("D3D11: ResolveSubresource: Incompatible formats");
return;
}
EmitCs([ EmitCs([
cDstImage = dstTextureInfo->image, cDstImage = dstTextureInfo->image,
cSrcImage = srcTextureInfo->image, cSrcImage = srcTextureInfo->image,
cDstSubres = dstSubresourceLayers, cDstSubres = dstSubresourceLayers,
cSrcSubres = srcSubresourceLayers cSrcSubres = srcSubresourceLayers,
cFormat = format
] (DxvkContext* ctx) { ] (DxvkContext* ctx) {
ctx->resolveImage( ctx->resolveImage(
cDstImage, cDstSubres, cDstImage, cDstSubres,
cSrcImage, cSrcSubres); cSrcImage, cSrcSubres,
cFormat);
}); });
} else {
Logger::err("D3D11: ResolveSubresource with typeless images currently not supported");
} }
} }

View File

@ -171,7 +171,8 @@ namespace dxvk {
if (m_backBufferResolve != nullptr) { if (m_backBufferResolve != nullptr) {
m_context->resolveImage( m_context->resolveImage(
m_backBufferResolve, resolveSubresources, m_backBufferResolve, resolveSubresources,
m_backBuffer, resolveSubresources); m_backBuffer, resolveSubresources,
VK_FORMAT_UNDEFINED);
} }
const DxvkSwapSemaphores sem = m_swapchain->getSemaphorePair(); const DxvkSwapSemaphores sem = m_swapchain->getSemaphorePair();

View File

@ -897,9 +897,13 @@ namespace dxvk {
const Rc<DxvkImage>& dstImage, const Rc<DxvkImage>& dstImage,
const VkImageSubresourceLayers& dstSubresources, const VkImageSubresourceLayers& dstSubresources,
const Rc<DxvkImage>& srcImage, const Rc<DxvkImage>& srcImage,
const VkImageSubresourceLayers& srcSubresources) { const VkImageSubresourceLayers& srcSubresources,
VkFormat format) {
this->renderPassEnd(); this->renderPassEnd();
if (format == VK_FORMAT_UNDEFINED)
format = srcImage->info().format;
VkImageSubresourceRange dstSubresourceRange = { VkImageSubresourceRange dstSubresourceRange = {
dstSubresources.aspectMask, dstSubresources.aspectMask,
dstSubresources.mipLevel, 1, dstSubresources.mipLevel, 1,
@ -932,19 +936,24 @@ namespace dxvk {
VK_ACCESS_TRANSFER_READ_BIT); VK_ACCESS_TRANSFER_READ_BIT);
m_barriers.recordCommands(m_cmd); m_barriers.recordCommands(m_cmd);
VkImageResolve imageRegion; if (srcImage->info().format == format
imageRegion.srcSubresource = srcSubresources; && dstImage->info().format == format) {
imageRegion.srcOffset = VkOffset3D { 0, 0, 0 }; VkImageResolve imageRegion;
imageRegion.dstSubresource = dstSubresources; imageRegion.srcSubresource = srcSubresources;
imageRegion.dstOffset = VkOffset3D { 0, 0, 0 }; imageRegion.srcOffset = VkOffset3D { 0, 0, 0 };
imageRegion.extent = srcImage->mipLevelExtent(srcSubresources.mipLevel); imageRegion.dstSubresource = dstSubresources;
imageRegion.dstOffset = VkOffset3D { 0, 0, 0 };
m_cmd->cmdResolveImage( imageRegion.extent = srcImage->mipLevelExtent(srcSubresources.mipLevel);
srcImage->handle(),
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, m_cmd->cmdResolveImage(
dstImage->handle(), srcImage->handle(),
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
1, &imageRegion); dstImage->handle(),
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &imageRegion);
} else {
// TODO implement
}
m_barriers.accessImage( m_barriers.accessImage(
dstImage, dstSubresourceRange, dstImage, dstSubresourceRange,

View File

@ -405,17 +405,22 @@ namespace dxvk {
* *
* Resolves a multisampled image into a non-multisampled * Resolves a multisampled image into a non-multisampled
* image. The subresources of both images must have the * image. The subresources of both images must have the
* same size and compatible formats * same size and compatible formats.
* A format can be specified for the resolve operation.
* If it is \c VK_FORMAT_UNDEFINED, the resolve operation
* will use the source image format.
* \param [in] dstImage Destination image * \param [in] dstImage Destination image
* \param [in] dstSubresources Subresources to write to * \param [in] dstSubresources Subresources to write to
* \param [in] srcImage Source image * \param [in] srcImage Source image
* \param [in] srcSubresources Subresources to read from * \param [in] srcSubresources Subresources to read from
* \param [in] format Format for the resolve operation
*/ */
void resolveImage( void resolveImage(
const Rc<DxvkImage>& dstImage, const Rc<DxvkImage>& dstImage,
const VkImageSubresourceLayers& dstSubresources, const VkImageSubresourceLayers& dstSubresources,
const Rc<DxvkImage>& srcImage, const Rc<DxvkImage>& srcImage,
const VkImageSubresourceLayers& srcSubresources); const VkImageSubresourceLayers& srcSubresources,
VkFormat format);
/** /**
* \brief Updates a buffer * \brief Updates a buffer