Texture driver APIs support

这个提交包含在:
Rahul Garg
2017-11-09 22:10:55 +05:30
父节点 31bcb59f62
当前提交 ef09c4918d
修改 8 个文件,包含 4114 行新增17 行删除
+23 -1
查看文件
@@ -40,6 +40,8 @@ THE SOFTWARE.
#include "hip_hcc_internal.h"
#include "trace_helper.h"
//TODO Add support for multiple modules
static std::unordered_map<std::string, uintptr_t> coGlobals;
//TODO Use Pool APIs from HCC to get memory regions.
#include <cassert>
@@ -262,7 +264,9 @@ namespace
symbol_section_accessor{self_reader, process_symtab}, x);
assert(tmp.first);
if (coGlobals.count(x) == 0) {
coGlobals.emplace(x, tmp.first);
}
void* p = nullptr;
hsa_amd_memory_lock(
reinterpret_cast<void*>(tmp.first), tmp.second, &agent, 1, &p);
@@ -833,3 +837,21 @@ hipError_t hipModuleLoadDataEx(hipModule_t *module, const void *image, unsigned
{
return hipModuleLoadData(module, image);
}
hipError_t hipModuleGetTexRef(hipDeviceptr_t *dptr, hipModule_t hmod, const char* name)
{
HIP_INIT_API(dptr, hmod, name);
hipError_t ret = hipSuccess;
if(dptr == NULL){
return ihipLogStatus(hipErrorInvalidValue);
}
if(name == NULL || hmod == NULL){
return ihipLogStatus(hipErrorNotInitialized);
}
else{
const auto it = coGlobals.find(name);
if (it == coGlobals.end()) return ihipLogStatus(hipErrorInvalidValue);
*dptr = reinterpret_cast<void*>(it->second);
return ihipLogStatus(ret);
}
}