From f4df28905e27f5adff4deee874d4d1fb08f2d766 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 6 Dec 2019 14:53:41 -0500
Subject: [PATCH] P4 to Git Change 2042093 by jujiang@JJ-HIP on 2019/12/06
14:44:16
SWDEV-214490 - Update HIP RT for texture3D in HIP/PAL on Windows
-Update hipTexRefSetArray
http://ocltc.amd.com/reviews/r/18356/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#29 edit
---
api/hip/hip_texture.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/api/hip/hip_texture.cpp b/api/hip/hip_texture.cpp
index 1edd0b8aca..d1c228707b 100644
--- a/api/hip/hip_texture.cpp
+++ b/api/hip/hip_texture.cpp
@@ -718,13 +718,27 @@ hipError_t hipTexRefSetArray(textureReference* tex, hipArray_const_t array, unsi
HIP_INIT_API(NONE, tex, array, flags);
size_t offset = 0;
+ cl_mem_object_type clType;
if ((tex == nullptr) || (array == nullptr)) {
HIP_RETURN(hipErrorInvalidImage);
}
- HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, &offset, tex, array->data, &array->desc, array->width,
- array->height, 0));
+ switch(array->textureType) {
+ case hipTextureType3D:
+ clType = CL_MEM_OBJECT_IMAGE3D;
+ break;
+ case hipTextureType2D:
+ clType = CL_MEM_OBJECT_IMAGE2D;
+ break;
+ case hipTextureType1D:
+ clType = CL_MEM_OBJECT_IMAGE1D;
+ break;
+ default:
+ HIP_RETURN(hipErrorInvalidValue);
+ }
+ HIP_RETURN(ihipBindTexture(clType, &offset, tex, array->data, &array->desc, array->width,
+ array->height, array->depth));
}
hipError_t hipTexRefGetAddress(hipDeviceptr_t* dev_ptr, textureReference tex) {