From 853247f32fa63c9679b2b9e5bdbc4e61ccc6280a Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Wed, 21 Oct 2020 17:41:31 -0700 Subject: [PATCH] Vulkan: ReadPixels y-flip workaround. --- filament/backend/src/vulkan/VulkanDriver.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 1bd7c58bd6..3e4a00438d 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -1436,15 +1436,8 @@ void VulkanDriver::readPixels(Handle src, uint32_t x, uint32_t y vkMapMemory(device, stagingMemory, 0, VK_WHOLE_SIZE, 0, (void**) &srcPixels); srcPixels += subResourceLayout.offset; - // TODO: investigate why this Y-flip conditional exists. At least two SwiftShader-based - // tests (viewer_basic_test.cc and gltf_viewer batch mode) seem to require "false". However - // test_ReadPixels.cpp with MoltenVK requires "true" to be consistent with OpenGL and Metal. - // One hypothesis is that this is due to the layout of the SwiftShader backbuffer. - #ifdef FILAMENT_USE_SWIFTSHADER - constexpr bool flipY = false; - #else + // TODO: investigate why this Y-flip exists. constexpr bool flipY = true; - #endif if (!DataReshaper::reshapeImage(closure, getComponentType(srcFormat), srcPixels, subResourceLayout.rowPitch, width, height, swizzle, flipY)) { utils::slog.e << "Unsupported PixelDataFormat or PixelDataType" << utils::io::endl;