vkCmdBlitImage() support format component swizzling.

This commit is contained in:
Bill Hollings 2019-08-12 16:35:59 -04:00
parent f824c1a955
commit 74e8af1525
3 changed files with 10 additions and 5 deletions

View File

@ -26,6 +26,7 @@ Released TBD
- Ensure Vulkan loader magic number is set every time before returning any dispatchable Vulkan handle. - Ensure Vulkan loader magic number is set every time before returning any dispatchable Vulkan handle.
- Fix crash when `VkDeviceCreateInfo` specifies queue families out of numerical order. - Fix crash when `VkDeviceCreateInfo` specifies queue families out of numerical order.
- Fix crash in `vkDestroyPipelineLayout()`. - Fix crash in `vkDestroyPipelineLayout()`.
- `vkCmdBlitImage()` support format component swizzling.
- `vkCmdClearImage()` set error if attempt made to clear 1D image, and fix validation of depth attachment formats. - `vkCmdClearImage()` set error if attempt made to clear 1D image, and fix validation of depth attachment formats.
- Remove error logging on `VK_TIMEOUT` of `VkSemaphore` and `VkFence`. - Remove error logging on `VK_TIMEOUT` of `VkSemaphore` and `VkFence`.
- Consolidate the various linkable objects into a `MVKLinkableMixin` template base class. - Consolidate the various linkable objects into a `MVKLinkableMixin` template base class.

View File

@ -52,7 +52,8 @@ public:
protected: protected:
void setContent(VkImage srcImage, VkImageLayout srcImageLayout, void setContent(VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, MVKCommandUse commandUse); VkImage dstImage, VkImageLayout dstImageLayout,
bool formatsMustMatch, MVKCommandUse commandUse);
void addImageCopyRegion(const VkImageCopy& region); void addImageCopyRegion(const VkImageCopy& region);
void addTempBufferImageCopyRegion(const VkImageCopy& region); void addTempBufferImageCopyRegion(const VkImageCopy& region);

View File

@ -41,7 +41,7 @@ void MVKCmdCopyImage::setContent(VkImage srcImage,
const VkImageCopy* pRegions, const VkImageCopy* pRegions,
MVKCommandUse commandUse) { MVKCommandUse commandUse) {
setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, commandUse); setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, false, commandUse);
for (uint32_t i = 0; i < regionCount; i++) { for (uint32_t i = 0; i < regionCount; i++) {
addImageCopyRegion(pRegions[i]); addImageCopyRegion(pRegions[i]);
@ -56,11 +56,12 @@ void MVKCmdCopyImage::setContent(VkImage srcImage,
} }
} }
// Sets basic content for use by this class and subclasses // Sets common content for use by this class and subclasses
void MVKCmdCopyImage::setContent(VkImage srcImage, void MVKCmdCopyImage::setContent(VkImage srcImage,
VkImageLayout srcImageLayout, VkImageLayout srcImageLayout,
VkImage dstImage, VkImage dstImage,
VkImageLayout dstImageLayout, VkImageLayout dstImageLayout,
bool formatsMustMatch,
MVKCommandUse commandUse) { MVKCommandUse commandUse) {
_srcImage = (MVKImage*)srcImage; _srcImage = (MVKImage*)srcImage;
_srcLayout = srcImageLayout; _srcLayout = srcImageLayout;
@ -76,7 +77,9 @@ void MVKCmdCopyImage::setContent(VkImage srcImage,
_isDstCompressed = _dstImage->getIsCompressed(); _isDstCompressed = _dstImage->getIsCompressed();
uint32_t dstBytesPerBlock = mvkMTLPixelFormatBytesPerBlock(_dstMTLPixFmt); uint32_t dstBytesPerBlock = mvkMTLPixelFormatBytesPerBlock(_dstMTLPixFmt);
_canCopyFormats = (srcBytesPerBlock == dstBytesPerBlock) && (_srcSampleCount == _dstSampleCount); _canCopyFormats = formatsMustMatch
? (_dstMTLPixFmt == _srcMTLPixFmt)
: ((dstBytesPerBlock == srcBytesPerBlock) && (_dstSampleCount == _srcSampleCount));
_useTempBuffer = (_srcMTLPixFmt != _dstMTLPixFmt) && (_isSrcCompressed || _isDstCompressed); // Different formats and at least one is compressed _useTempBuffer = (_srcMTLPixFmt != _dstMTLPixFmt) && (_isSrcCompressed || _isDstCompressed); // Different formats and at least one is compressed
_commandUse = commandUse; _commandUse = commandUse;
@ -214,7 +217,7 @@ void MVKCmdBlitImage::setContent(VkImage srcImage,
VkFilter filter, VkFilter filter,
MVKCommandUse commandUse) { MVKCommandUse commandUse) {
MVKCmdCopyImage::setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, commandUse); MVKCmdCopyImage::setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, true, commandUse);
_mtlFilter = mvkMTLSamplerMinMagFilterFromVkFilter(filter); _mtlFilter = mvkMTLSamplerMinMagFilterFromVkFilter(filter);