From f9e24d213d6e09275b2b48cabdca919fd4ebf5fa Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 2 Oct 2019 16:24:33 -0400
Subject: [PATCH] P4 to Git Change 2007650 by jujiang@JJ-OCL-hip on 2019/10/02
16:04:31
SWDEV-205724 - Issue with hipTexRefSetAddress in HIP/PAL on Windows
Handle nullptr channel format desc
http://ocltc.amd.com/reviews/r/18065/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#20 edit
[ROCm/hip commit: 4c3b676041a736bab4e3b06dc89e8edaf6fdc7cf]
---
projects/hip/api/hip/hip_texture.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/projects/hip/api/hip/hip_texture.cpp b/projects/hip/api/hip/hip_texture.cpp
index 70b11109d7..5809a75200 100644
--- a/projects/hip/api/hip/hip_texture.cpp
+++ b/projects/hip/api/hip/hip_texture.cpp
@@ -386,13 +386,17 @@ hipError_t ihipBindTexture(cl_mem_object_type type,
case CL_MEM_OBJECT_IMAGE1D:
resDesc.resType = hipResourceTypeLinear;
resDesc.res.linear.devPtr = const_cast(devPtr);
- resDesc.res.linear.desc = *desc;
+ if (nullptr != desc) {
+ resDesc.res.linear.desc = *desc;
+ }
resDesc.res.linear.sizeInBytes = image->getSize();
break;
case CL_MEM_OBJECT_IMAGE2D:
resDesc.resType = hipResourceTypePitch2D;
resDesc.res.pitch2D.devPtr = const_cast(devPtr);
- resDesc.res.pitch2D.desc = *desc;
+ if (nullptr != desc) {
+ resDesc.res.pitch2D.desc = *desc;
+ }
resDesc.res.pitch2D.width = width;
resDesc.res.pitch2D.height = height;
resDesc.res.pitch2D.pitchInBytes = pitch;