Add full swizzle set support for vector types #1409
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.
This PR introduces an expansion of the swizzle operation support in AdaptiveCpp, allowing for the full set of swizzle permutations with repetition for 1D, 2D and 3D vectors. This change aligns AdaptiveCpp's functionality more closely with GLSL/HLSL and DPC++, enhancing its flexibility and utility for developers.
In practice, the full range of swizzle operations greatly simplifies the process of porting code from GLSL/HLSL to SYCL. This feature is supported by DPC++ and is in line with the behavior observed in other shading languages, indicating a common expectation among developers for how swizzle operations should behave. Despite the current ambiguity in the SYCL specification, providing comprehensive swizzle support in AdaptiveCpp can significantly improve developer productivity and the ease of codebase transitions.
The SYCL specification's current ambiguity regarding swizzle operations for vectors smaller than 4 elements has led to differing implementations. This PR assumes a more permissive interpretation, aiming to standardize the user experience across SYCL implementations.
Related discussions: