From 9bbba2ee75fd3ed211c588cc3bbfd02716d73802 Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 30 Apr 2018 01:03:06 -0400 Subject: [PATCH] P4 to Git Change 1547686 by cpaquot@cpaquot-ocl-lc-lnx on 2018/04/30 00:52:23 SWDEV-145570 - [HIP] CreateTexture with hipArray Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#6 edit [ROCm/hip commit: 5fc5d098a95c17d1a51afbdf777da3183e16eadb] --- projects/hip/api/hip/hip_texture.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/projects/hip/api/hip/hip_texture.cpp b/projects/hip/api/hip/hip_texture.cpp index fbc8c4b481..220332a57b 100644 --- a/projects/hip/api/hip/hip_texture.cpp +++ b/projects/hip/api/hip/hip_texture.cpp @@ -158,7 +158,26 @@ hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResou switch (pResDesc->resType) { case hipResourceTypeArray: - assert(0); + { + memory = amd::SvmManager::FindSvmBuffer(pResDesc->res.array.array->data); + + getChannelOrderAndType(pResDesc->res.array.array->desc, pTexDesc->readMode, + &image_format.image_channel_order, &image_format.image_channel_data_type); + const amd::Image::Format imageFormat(image_format); + switch (pResDesc->res.array.array->type) { + case hipArrayLayered: + case hipArrayCubemap: + assert(0); + break; + case hipArraySurfaceLoadStore: + case hipArrayTextureGather: + case hipArrayDefault: + default: + image = new (*g_context) amd::Image(*memory->asBuffer(), CL_MEM_OBJECT_IMAGE2D, memory->getMemFlags(), imageFormat, + pResDesc->res.array.array->width, pResDesc->res.array.array->height, 1, 0, 0); + break; + } + } break; case hipResourceTypeMipmappedArray: assert(0);