Do not create YcbcrConversion for RGB565 passed as external format
Since we don't support external formats (we replace
them to internal ones and cut off VkExternalFormatANDROID
from struct chains), a vkCreateSampler call with
a conversion based on an external format with
another external format provided does not make sence.
This change returns a predefined value
(VK_YCBCR_CONVERSION_DO_NOTHING of type
VkSamplerYcbcrConversion) for CreateSamplerYcbcrConversion
when RGB565 is passed as an external format.
This special value (VK_YCBCR_CONVERSION_DO_NOTHING) is
checked later in vkCreateSampler and the whole
VkSamplerYcbcrConversionInfo is discarded.
Bug: 134771579
Test: CtsGraphicsTestCases android.graphics.cts.BasicVulkanGpuTest
Change-Id: I6c0a085866178391eb330b0005a687914be5e865
Signed-off-by: Roman Kiryanov <rkir@google.com>
diff --git a/system/vulkan/func_table.cpp b/system/vulkan/func_table.cpp
index f0ed982..a5227ec 100644
--- a/system/vulkan/func_table.cpp
+++ b/system/vulkan/func_table.cpp
@@ -812,7 +812,8 @@
AEMU_SCOPED_TRACE("vkCreateSampler");
auto vkEnc = HostConnection::get()->vkEncoder();
VkResult vkCreateSampler_VkResult_return = (VkResult)0;
- vkCreateSampler_VkResult_return = vkEnc->vkCreateSampler(device, pCreateInfo, pAllocator, pSampler);
+ auto resources = ResourceTracker::get();
+ vkCreateSampler_VkResult_return = resources->on_vkCreateSampler(vkEnc, VK_SUCCESS, device, pCreateInfo, pAllocator, pSampler);
return vkCreateSampler_VkResult_return;
}
static void entry_vkDestroySampler(
@@ -1777,7 +1778,8 @@
{
AEMU_SCOPED_TRACE("vkDestroySamplerYcbcrConversion");
auto vkEnc = HostConnection::get()->vkEncoder();
- vkEnc->vkDestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator);
+ auto resources = ResourceTracker::get();
+ resources->on_vkDestroySamplerYcbcrConversion(vkEnc, device, ycbcrConversion, pAllocator);
}
static VkResult entry_vkCreateDescriptorUpdateTemplate(
VkDevice device,
@@ -2822,7 +2824,8 @@
{
AEMU_SCOPED_TRACE("vkDestroySamplerYcbcrConversionKHR");
auto vkEnc = HostConnection::get()->vkEncoder();
- vkEnc->vkDestroySamplerYcbcrConversionKHR(device, ycbcrConversion, pAllocator);
+ auto resources = ResourceTracker::get();
+ resources->on_vkDestroySamplerYcbcrConversionKHR(vkEnc, device, ycbcrConversion, pAllocator);
}
#endif
#ifdef VK_KHR_bind_memory2