Description
llvm-project/clang/lib/Headers/hlsl/hlsl_intrinsics.h
Lines 2084 to 2093 in 556eb82
llvm-project/clang/lib/Headers/hlsl/hlsl_intrinsics.h
Lines 1446 to 1454 in 556eb82
llvm-project/clang/lib/Headers/hlsl/hlsl_intrinsics.h
Lines 933 to 942 in 556eb82
The fix:
we need to exclude vec1s and limit to vec4. the apis need something similar to c++
std::enable_if_t<(N > 1 && N <=4)
Long term we will want to support long vectors we may want to do those like so
_HLSL_AVAILABILITY(shadermodel, 6.9)
template <int N, typename = std::enable_if_t<(N >4)>>
For this ticket though we will only restrict the vector range.
Obviously std can't work maybe we can do something like:
template <int N>
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
const inline __detail::enable_if_t<(N > 1 && N <= 4),half>
distance(vector<half, N> X, vector<half, N> Y) {
return __detail::distance_vec_impl(X, Y);
}
template <int N>
const inline __detail::enable_if_t<(N > 1 && N <= 4),float>
distance(vector<float, N> X, vector<float, N> Y) {
return __detail::distance_vec_impl(X, Y);
}
template <int N>
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
const inline __detail::enable_if_t<(N > 1 && N <= 4),half>
length(vector<half, N> X) {
return __detail::length_vec_impl(X);
}
template <int N>
const inline __detail::enable_if_t<(N > 1 && N <= 4),float>
length(vector<float, N> X) {
return __detail::length_vec_impl(X);
}
template <int L>
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
const inline __detail::enable_if_t<(L > 1 && L <= 4),vector<half, L>>
reflect(vector<half, L> I, vector<half, L> N) {
return __detail::reflect_vec_impl(I, N);
}
template <int L>
const inline __detail::enable_if_t<(L > 1 && L <= 4),vector<float, L>>
reflect(vector<float, L> I, vector<float, L> N) {
return __detail::reflect_vec_impl(I, N);
}
Will likely need to see what other options are to restrict vector ranges.
Metadata
Metadata
Assignees
Type
Projects
Status
Closed
Activity
fmod
HLSL Function #99118[HLSL] Reorganize aliased intrinsics into their own file
[HLSL] Add bounds checks for the hlsl vector arguments and return types
[HLSL] Add bounds checks for the hlsl vector arguments and return typ…