Hi,
When I test PowerVR samples (01_HelloAPI, 02_IntroducingPVRShell, or any others) on an Acer Iconia One 7 tablet that has MTK8167 processor with PowerVR GE8300 GPU, I found that the rendering output is “skewed” under Landscape mode but perfect under portrait mode, see this linked screen shot.
When I debug into the code where we create Vulkan swapchain,
_vulkan.swapchainExtent = surfaceCapabilities.currentExtent;
I found the size is: 600x976 for portrait mode and 976x600 mode for landscape. I started doubting the skewed output is caused by the non-16-pixel-aligned framebuffer width / pitch, then I tried to make it aligned to 16-pixel when creating the frame buffer, like _vulkan.swapchainExtent.width>>4<<4
but did not succeed.
I also tested PVR samples on Windows (nVidia, AMD, Intel), Android (Adreno, Mali) they all do not have this problem. Anyone can give some suggestions?
UPDATED:
I added the following patch to make the rendering correct:
// Get the current surface capabilities
VK_ASSERT(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(_vulkan->device->vkPhyDevice, vkSurface, &vkSurfaceCaps));
/*
* Patch: this patch is only needed for certain PowerVR GPU: the width must be manually aligned to 16-pixel by adding padding.
* Testing device: Acer Iconia One 7 tablet, Android 7 OS, MTK8167 processor with PowerVR GE8300 GPU
*/
const int PIXEL_ALIGNMENT = 4; //16-pixel alignment
vkSurfaceCaps.currentExtent.width = (vkSurfaceCaps.currentExtent.width + (1<<PIXEL_ALIGNMENT) - 1) >> PIXEL_ALIGNMENT << PIXEL_ALIGNMENT;
My patch is simply adding a padding to make the swapchain’s width aligned to 16-pixel if it is not. Should we consider this should have been done by PowerVR Vulkan driver? Or did I use Vulkan in a wrong way?