Return correct GrBackendFormat when ycbcr conversion is valid.

Bug: skia:
Change-Id: Ieb24c0169a150c153a468fbbe9a8f60766516860
Reviewed-on: https://skia-review.googlesource.com/c/193698
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Greg Daniel 2019-02-21 12:40:21 -05:00 committed by Skia Commit-Bot
parent 651446cc5d
commit 89df78400a

View File

@ -55,6 +55,11 @@ public:
} }
VkFormat imageFormat() const { return fInfo.fFormat; } VkFormat imageFormat() const { return fInfo.fFormat; }
GrBackendFormat getBackendFormat() const { GrBackendFormat getBackendFormat() const {
if (fResource && this->ycbcrConversionInfo().isValid()) {
SkASSERT(this->imageFormat() == VK_FORMAT_UNDEFINED);
return GrBackendFormat::MakeVk(this->ycbcrConversionInfo());
}
SkASSERT(this->imageFormat() != VK_FORMAT_UNDEFINED);
return GrBackendFormat::MakeVk(this->imageFormat()); return GrBackendFormat::MakeVk(this->imageFormat());
} }
uint32_t mipLevels() const { return fInfo.fLevelCount; } uint32_t mipLevels() const { return fInfo.fLevelCount; }