| 940 | } |
| 941 | |
| 942 | hipError_t hipTexRefGetArray(hipArray_t* pArray, const textureReference* texRef) { |
| 943 | // TODO overload operator<<(ostream&, textureReference&). |
| 944 | HIP_INIT_API(hipTexRefGetArray, pArray, texRef); |
| 945 | |
| 946 | if ((pArray == nullptr) || (texRef == nullptr)) { |
| 947 | HIP_RETURN(hipErrorInvalidValue); |
| 948 | } |
| 949 | |
| 950 | hipResourceDesc resDesc = {}; |
| 951 | // TODO use ihipGetTextureObjectResourceDesc() to not pollute the API trace. |
| 952 | hipError_t error = ihipGetTextureObjectResourceDesc(&resDesc, texRef->textureObject); |
| 953 | if (error != hipSuccess) { |
| 954 | HIP_RETURN(error); |
| 955 | } |
| 956 | |
| 957 | switch (resDesc.resType) { |
| 958 | case hipResourceTypeLinear: |
| 959 | case hipResourceTypePitch2D: |
| 960 | case hipResourceTypeMipmappedArray: { |
| 961 | HIP_RETURN(hipErrorInvalidValue); |
| 962 | } |
| 963 | case hipResourceTypeArray: |
| 964 | *pArray = resDesc.res.array.array; |
| 965 | break; |
| 966 | } |
| 967 | |
| 968 | HIP_RETURN(hipSuccess); |
| 969 | } |
| 970 | |
| 971 | hipError_t hipTexRefSetArray(textureReference* texRef, hipArray_const_t array, unsigned int flags) { |
| 972 | HIP_INIT_API(hipTexRefSetArray, texRef, array, flags); |
nothing calls this directly
no test coverage detected