Added support for -
    hipTexRefGetArray
    hipTexRefGetAddressMode
    hipTexRefGetAddress



[ROCm/hip commit: bec725dec2]
Этот коммит содержится в:
Rahul Garg authored and Maneesh Gupta committed 2019-10-04 13:38:45 +05:30
1 родитель d8a79dda8c
Коммит 3b9b5fca8d
3 files changed
+55

No files matched your search

+48
Просмотреть файл
@@ -437,6 +437,7 @@ hipError_t ihipBindTextureImpl(TlsData *tls_, int dim, enum hipTextureReadMode r
return hipErrorRuntimeOther;
}
getHipTextureObject(&textureObject, pTexture->image, pTexture->sampler);
pTexture->devPtr = (void*) devPtr;
textureHash[textureObject] = pTexture;
}
@@ -509,6 +510,7 @@ hipError_t ihipBindTexture2DImpl(TlsData *tls, int dim, enum hipTextureReadMode
return hipErrorRuntimeOther;
}
getHipTextureObject(&textureObject, pTexture->image, pTexture->sampler);
pTexture->devPtr = (void*) devPtr;
textureHash[textureObject] = pTexture;
}
@@ -607,6 +609,7 @@ hipError_t ihipBindTextureToArrayImpl(TlsData *tls_, int dim, enum hipTextureRea
return hipErrorRuntimeOther;
}
getHipTextureObject(&textureObject, pTexture->image, pTexture->sampler);
pTexture->devPtr = (void*) array;
textureHash[textureObject] = pTexture;
}
@@ -724,6 +727,17 @@ hipError_t hipTexRefSetAddressMode(textureReference* tex, int dim, hipTextureAdd
return ihipLogStatus(hip_status);
}
hipError_t hipTexRefGetAddressMode(hipTextureAddressMode* am, textureReference tex, int dim) {
HIP_INIT_API(hipTexRefGetAddressMode,am, &tex, dim);
if ((am == nullptr) || (dim >= 3))
return ihipLogStatus(hipErrorInvalidValue);
*am = tex.addressMode[dim];
return ihipLogStatus(hipSuccess);
}
hipError_t hipTexRefSetArray(textureReference* tex, hipArray_const_t array, unsigned int flags) {
HIP_INIT_API(hipTexRefSetArray, tex, array, flags);
hipError_t hip_status = hipSuccess;
@@ -733,6 +747,23 @@ hipError_t hipTexRefSetArray(textureReference* tex, hipArray_const_t array, unsi
return ihipLogStatus(hip_status);
}
hipError_t hipTexRefGetArray(hipArray_t* array, textureReference tex) {
HIP_INIT_API(hipTexRefGetArray, array, &tex);
if (array == nullptr)
return ihipLogStatus(hipErrorInvalidValue);
hipTexture* pTexture = textureHash[tex.textureObject];
if((pTexture == nullptr) || (hipResourceTypeArray != pTexture->resDesc.resType))
return ihipLogStatus(hipErrorInvalidImage);
if (pTexture->devPtr == nullptr)
return ihipLogStatus(hipErrorUnknown);
*array = reinterpret_cast<hipArray_t>(pTexture->devPtr);
return ihipLogStatus(hipSuccess);
}
hipError_t hipTexRefSetAddress(size_t* offset, textureReference* tex, hipDeviceptr_t devPtr,
size_t size) {
@@ -744,6 +775,23 @@ hipError_t hipTexRefSetAddress(size_t* offset, textureReference* tex, hipDevicep
return ihipLogStatus(hip_status);
}
hipError_t hipTexRefGetAddress(hipDeviceptr_t* dev_ptr, textureReference tex) {
HIP_INIT_API(hipTexRefGetAddress,dev_ptr, &tex);
if (dev_ptr == nullptr)
return ihipLogStatus(hipErrorInvalidValue);
hipTexture* pTexture = textureHash[tex.textureObject];
if (pTexture == nullptr)
return ihipLogStatus(hipErrorInvalidImage);
if (pTexture->devPtr == nullptr)
return ihipLogStatus(hipErrorUnknown);
*dev_ptr = reinterpret_cast<hipDeviceptr_t>(pTexture->devPtr);
return ihipLogStatus(hipSuccess);
}
hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc,
hipDeviceptr_t devPtr, size_t pitch) {
HIP_INIT_API(hipTexRefSetAddress2D, tex, desc, devPtr, pitch);