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:
parent
43dbc9f1d6
commit
cb3daaf856
@ -801,25 +801,22 @@ namespace dxvk {
|
||||
cSrcImage, cSrcLayers, VkOffset3D { 0, 0, 0 },
|
||||
cDstImage->mipLevelExtent(cDstLayers.mipLevel));
|
||||
});
|
||||
} else if (!srcFormatInfo.flags.test(DxgiFormatFlag::Typeless)
|
||||
&& !dstFormatInfo.flags.test(DxgiFormatFlag::Typeless)) {
|
||||
if (dstDesc.Format != srcDesc.Format) {
|
||||
Logger::err("D3D11: ResolveSubresource: Incompatible formats");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const VkFormat format = m_parent->LookupFormat(
|
||||
Format, DxgiFormatMode::Any).format;
|
||||
|
||||
EmitCs([
|
||||
cDstImage = dstTextureInfo->image,
|
||||
cSrcImage = srcTextureInfo->image,
|
||||
cDstSubres = dstSubresourceLayers,
|
||||
cSrcSubres = srcSubresourceLayers
|
||||
cSrcSubres = srcSubresourceLayers,
|
||||
cFormat = format
|
||||
] (DxvkContext* ctx) {
|
||||
ctx->resolveImage(
|
||||
cDstImage, cDstSubres,
|
||||
cSrcImage, cSrcSubres);
|
||||
cSrcImage, cSrcSubres,
|
||||
cFormat);
|
||||
});
|
||||
} else {
|
||||
Logger::err("D3D11: ResolveSubresource with typeless images currently not supported");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,8 @@ namespace dxvk {
|
||||
if (m_backBufferResolve != nullptr) {
|
||||
m_context->resolveImage(
|
||||
m_backBufferResolve, resolveSubresources,
|
||||
m_backBuffer, resolveSubresources);
|
||||
m_backBuffer, resolveSubresources,
|
||||
VK_FORMAT_UNDEFINED);
|
||||
}
|
||||
|
||||
const DxvkSwapSemaphores sem = m_swapchain->getSemaphorePair();
|
||||
|
@ -897,9 +897,13 @@ namespace dxvk {
|
||||
const Rc<DxvkImage>& dstImage,
|
||||
const VkImageSubresourceLayers& dstSubresources,
|
||||
const Rc<DxvkImage>& srcImage,
|
||||
const VkImageSubresourceLayers& srcSubresources) {
|
||||
const VkImageSubresourceLayers& srcSubresources,
|
||||
VkFormat format) {
|
||||
this->renderPassEnd();
|
||||
|
||||
|
||||
if (format == VK_FORMAT_UNDEFINED)
|
||||
format = srcImage->info().format;
|
||||
|
||||
VkImageSubresourceRange dstSubresourceRange = {
|
||||
dstSubresources.aspectMask,
|
||||
dstSubresources.mipLevel, 1,
|
||||
@ -932,19 +936,24 @@ namespace dxvk {
|
||||
VK_ACCESS_TRANSFER_READ_BIT);
|
||||
m_barriers.recordCommands(m_cmd);
|
||||
|
||||
VkImageResolve imageRegion;
|
||||
imageRegion.srcSubresource = srcSubresources;
|
||||
imageRegion.srcOffset = VkOffset3D { 0, 0, 0 };
|
||||
imageRegion.dstSubresource = dstSubresources;
|
||||
imageRegion.dstOffset = VkOffset3D { 0, 0, 0 };
|
||||
imageRegion.extent = srcImage->mipLevelExtent(srcSubresources.mipLevel);
|
||||
|
||||
m_cmd->cmdResolveImage(
|
||||
srcImage->handle(),
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
dstImage->handle(),
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
1, &imageRegion);
|
||||
if (srcImage->info().format == format
|
||||
&& dstImage->info().format == format) {
|
||||
VkImageResolve imageRegion;
|
||||
imageRegion.srcSubresource = srcSubresources;
|
||||
imageRegion.srcOffset = VkOffset3D { 0, 0, 0 };
|
||||
imageRegion.dstSubresource = dstSubresources;
|
||||
imageRegion.dstOffset = VkOffset3D { 0, 0, 0 };
|
||||
imageRegion.extent = srcImage->mipLevelExtent(srcSubresources.mipLevel);
|
||||
|
||||
m_cmd->cmdResolveImage(
|
||||
srcImage->handle(),
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
dstImage->handle(),
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
1, &imageRegion);
|
||||
} else {
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
m_barriers.accessImage(
|
||||
dstImage, dstSubresourceRange,
|
||||
|
@ -405,17 +405,22 @@ namespace dxvk {
|
||||
*
|
||||
* Resolves a multisampled image into a non-multisampled
|
||||
* 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] dstSubresources Subresources to write to
|
||||
* \param [in] srcImage Source image
|
||||
* \param [in] srcSubresources Subresources to read from
|
||||
* \param [in] format Format for the resolve operation
|
||||
*/
|
||||
void resolveImage(
|
||||
const Rc<DxvkImage>& dstImage,
|
||||
const VkImageSubresourceLayers& dstSubresources,
|
||||
const Rc<DxvkImage>& srcImage,
|
||||
const VkImageSubresourceLayers& srcSubresources);
|
||||
const VkImageSubresourceLayers& srcSubresources,
|
||||
VkFormat format);
|
||||
|
||||
/**
|
||||
* \brief Updates a buffer
|
||||
|
Loading…
Reference in New Issue
Block a user