Update hipModuleGetTexRef API

This commit is contained in:
Rahul Garg
2017-11-19 22:10:46 +05:30
parent e2e499461a
commit 76f174b536
3 changed files with 14 additions and 12 deletions
@@ -1968,7 +1968,7 @@ hipError_t hipModuleGetFunction(hipFunction_t *function, hipModule_t module, con
*/ */
hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes, hipModule_t hmod, const char *name); hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes, hipModule_t hmod, const char *name);
hipError_t hipModuleGetTexRef(hipDeviceptr_t *dptr, hipModule_t hmod, const char* name); hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const char* name);
/** /**
* @brief builds module from code object which resides in host memory. Image is pointer to that location. * @brief builds module from code object which resides in host memory. Image is pointer to that location.
* *
@@ -72,12 +72,14 @@ bool runTest(int argc, char **argv)
copyParam.height = height; copyParam.height = height;
hipMemcpy_2D(&copyParam); hipMemcpy_2D(&copyParam);
hipTexRefSetAddressMode(&tex, 0, hipAddressModeWrap); textureReference* texref;
hipTexRefSetAddressMode(&tex, 1, hipAddressModeWrap); hipModuleGetTexRef(&texref, Module, "tex");
hipTexRefSetFilterMode(&tex, hipFilterModePoint); hipTexRefSetAddressMode(texref, 0, hipAddressModeWrap);
hipTexRefSetFlags(&tex, 0); hipTexRefSetAddressMode(texref, 1, hipAddressModeWrap);
hipTexRefSetFormat(&tex, HIP_AD_FORMAT_FLOAT, 1); hipTexRefSetFilterMode(texref, hipFilterModePoint);
hipTexRefSetArray(&tex, array, HIP_TRSA_OVERRIDE_FORMAT); hipTexRefSetFlags(texref, 0);
hipTexRefSetFormat(texref, HIP_AD_FORMAT_FLOAT, 1);
hipTexRefSetArray(texref, array, HIP_TRSA_OVERRIDE_FORMAT);
float* dData = NULL; float* dData = NULL;
hipMalloc((void **) &dData, size); hipMalloc((void **) &dData, size);
+4 -4
View File
@@ -838,11 +838,11 @@ hipError_t hipModuleLoadDataEx(hipModule_t *module, const void *image, unsigned
return hipModuleLoadData(module, image); return hipModuleLoadData(module, image);
} }
hipError_t hipModuleGetTexRef(hipDeviceptr_t *dptr, hipModule_t hmod, const char* name) hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const char* name)
{ {
HIP_INIT_API(dptr, hmod, name); HIP_INIT_API(texRef, hmod, name);
hipError_t ret = hipSuccess; hipError_t ret = hipSuccess;
if(dptr == NULL){ if(texRef == NULL){
return ihipLogStatus(hipErrorInvalidValue); return ihipLogStatus(hipErrorInvalidValue);
} }
if(name == NULL || hmod == NULL){ if(name == NULL || hmod == NULL){
@@ -851,7 +851,7 @@ hipError_t hipModuleGetTexRef(hipDeviceptr_t *dptr, hipModule_t hmod, const char
else{ else{
const auto it = coGlobals.find(name); const auto it = coGlobals.find(name);
if (it == coGlobals.end()) return ihipLogStatus(hipErrorInvalidValue); if (it == coGlobals.end()) return ihipLogStatus(hipErrorInvalidValue);
*dptr = reinterpret_cast<void*>(it->second); *texRef = reinterpret_cast<textureReference*>(it->second);
return ihipLogStatus(ret); return ihipLogStatus(ret);
} }
} }