Add entry points for hipTexObject*() API
Even though the runtime and driver texture object API is one to one, the structs used by these APIs are not. See hipResourceDesc vs HIP_RESOURCE_DESC differences. These differences are not trivial and most likely won't be able to handled by hipify, so we need new API entry points. Change-Id: Id4bcb1ad0ae15378dbdb5a2ed07e5ea30f320082
This commit is contained in:
@@ -1134,4 +1134,74 @@ hipError_t hipTexRefSetMipmappedArray(textureReference* texRef,
|
||||
hipResourceViewDesc resViewDesc = hip::getResourceViewDesc(mipmappedArray, format);
|
||||
|
||||
HIP_RETURN(ihipCreateTextureObject(&texRef->textureObject, &resDesc, &texDesc, &resViewDesc));
|
||||
}
|
||||
}
|
||||
|
||||
hipError_t hipTexObjectCreate(hipTextureObject_t* pTexObject,
|
||||
const HIP_RESOURCE_DESC* pResDesc,
|
||||
const HIP_TEXTURE_DESC* pTexDesc,
|
||||
const HIP_RESOURCE_VIEW_DESC* pResViewDesc) {
|
||||
HIP_INIT_API(hipTexObjectCreate, pTexObject, pResDesc, pTexDesc, pResViewDesc);
|
||||
|
||||
if ((pTexObject == nullptr) ||
|
||||
(pResDesc == nullptr) || (pTexDesc == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
hipResourceDesc resDesc = hip::getResourceDesc(*pResDesc);
|
||||
hipTextureDesc texDesc = hip::getTextureDesc(*pTexDesc);
|
||||
|
||||
if (pResViewDesc != nullptr) {
|
||||
hipResourceViewDesc resViewDesc = hip::getResourceViewDesc(*pResViewDesc);
|
||||
HIP_RETURN(ihipCreateTextureObject(pTexObject, &resDesc, &texDesc, &resViewDesc));
|
||||
} else {
|
||||
HIP_RETURN(ihipCreateTextureObject(pTexObject, &resDesc, &texDesc, nullptr));
|
||||
}
|
||||
}
|
||||
|
||||
hipError_t hipTexObjectDestroy(hipTextureObject_t texObject) {
|
||||
HIP_INIT_API(hipTexObjectDestroy, texObject);
|
||||
|
||||
HIP_RETURN(ihipDestroyTextureObject(texObject));
|
||||
}
|
||||
|
||||
hipError_t hipTexObjectGetResourceDesc(HIP_RESOURCE_DESC* pResDesc,
|
||||
hipTextureObject_t texObject) {
|
||||
HIP_INIT_API(hipTexObjectGetResourceDesc, pResDesc, texObject);
|
||||
|
||||
if ((pResDesc == nullptr) ||
|
||||
(texObject == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
*pResDesc = hip::getResourceDesc(texObject->resDesc);
|
||||
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
hipError_t hipTexObjectGetResourceViewDesc(HIP_RESOURCE_VIEW_DESC* pResViewDesc,
|
||||
hipTextureObject_t texObject) {
|
||||
HIP_INIT_API(hipTexObjectGetResourceViewDesc, pResViewDesc, texObject);
|
||||
|
||||
if ((pResViewDesc == nullptr) ||
|
||||
(texObject == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
*pResViewDesc = hip::getResourceViewDesc(texObject->resViewDesc);
|
||||
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
hipError_t hipTexObjectGetTextureDesc(HIP_TEXTURE_DESC* pTexDesc,
|
||||
hipTextureObject_t texObject) {
|
||||
HIP_INIT_API(hipTexObjectGetTextureDesc, pTexDesc, texObject);
|
||||
|
||||
if ((pTexDesc == nullptr) ||
|
||||
(texObject == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
*pTexDesc = hip::getTextureDesc(texObject->texDesc);
|
||||
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user