Implement FlipRotate without WIC for non-Windows platforms - #746
Open
Joel Kiptoo (Kiptoo-Deus) wants to merge 1 commit into
Open
Joel Kiptoo (Kiptoo-Deus) wants to merge 1 commit into
Joel Kiptoo (Kiptoo-Deus) wants to merge 1 commit into
Conversation
FlipRotate was the only image operation that always needed WIC, so it was not available when building for Linux / WSL. On non-Windows platforms it now moves whole pixels directly, for any format with a whole number of bytes per pixel that is not compressed, packed, planar or palettized (others return HRESULT_E_NOT_SUPPORTED). Flips are applied to the source before the rotation, which is how WIC combines WICBitmapTransformOptions. The Windows code paths are unchanged. Fixes microsoft#350
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #350.
FlipRotatewas the only image operation that always used WIC, soDirectXTexFlipRotate.cppwas only built on Windows and the functions were declared under#ifdef _WIN32.This builds it on all platforms. On Windows nothing changes: the WIC path and the float16/float32 conversion path are the same code, now inside
#ifdef _WIN32. On other platforms, a newPerformFlipRotatemoves whole pixels directly:HRESULT_E_NOT_SUPPORTED, checked before the result is allocated.memcpywhen there's no horizontal flip and no 90/270 rotation.IWICBitmapFlipRotator(dlls/windowscodecs/fliprotate.c), where the flip is applied to the source before the rotation (e.g.TEX_FR_ROTATE90 | TEX_FR_FLIP_HORIZONTALis an anti-transpose). I couldn't check this against WIC itself, so it would be worth confirming on Windows. It only matters for a 90/270 rotation combined with exactly one flip.Testing on macOS (arm64, Apple clang), building
DirectXTexwith its own CMake against the vcpkgdirectx-headersanddirectxmathports:DirectXTexFlipRotate.cppincluded, with no new warnings.FlipRotateoverloads against a straightforward reference (flip the source, then rotate clockwise in 90 degree steps) for every rotation/flip combination, on a 7x5 image with 3 array slices, inR8_UNORM,R16_UNORM,R8G8B8A8_UNORM,R16G16B16A16_FLOAT,R32G32B32_FLOATandR32G32B32A32_UINT(1 to 16 bytes per pixel). It also checks thatBC1_UNORM,NV12,YUY2,R1_UNORM,P8andR8G8_B8G8_UNORMreturnHRESULT_E_NOT_SUPPORTED, and that null pixels returnE_POINTER. 187 checks pass.I haven't built the Windows configurations. The only change there is the added
#ifdef _WIN32guards around the existing code.