From e0107c579235d9641efbbdcdc6fe59f49aeed711 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 30 Oct 2019 18:11:27 -0400 Subject: [PATCH] P4 to Git Change 2022168 by jujiang@JJ-OCL-hip on 2019/10/30 18:06:41 SWDEV-208594 - [HIP][Windows] Output mismatch with texture ref test functions with float4 type -Fix TexRef1D float/float4, and TexRef2D tests. http://ocltc.amd.com/reviews/r/18203/ Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#26 edit --- hipamd/api/hip/hip_texture.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/hipamd/api/hip/hip_texture.cpp b/hipamd/api/hip/hip_texture.cpp index 2634d799c1..23c1566c09 100644 --- a/hipamd/api/hip/hip_texture.cpp +++ b/hipamd/api/hip/hip_texture.cpp @@ -402,13 +402,8 @@ hipError_t ihipBindTexture(cl_mem_object_type type, if (hip::getCurrentContext()) { cl_image_format image_format; - if (nullptr == desc) { - getDrvChannelOrderAndType(tex->format, tex->numChannels, - &image_format.image_channel_order, &image_format.image_channel_data_type); - } else { - getChannelOrderAndType(*desc, hipReadModeElementType, - &image_format.image_channel_order, &image_format.image_channel_data_type); - } + getChannelOrderAndType(*desc, hipReadModeElementType, + &image_format.image_channel_order, &image_format.image_channel_data_type); const amd::Image::Format imageFormat(image_format); amd::Memory* memory = getMemoryObject(devPtr, *offset); amd::Image* image = new (*hip::getCurrentContext()) amd::Image(*memory->asBuffer(), @@ -431,17 +426,13 @@ hipError_t ihipBindTexture(cl_mem_object_type type, case CL_MEM_OBJECT_IMAGE1D: resDesc.resType = hipResourceTypeLinear; resDesc.res.linear.devPtr = const_cast(devPtr); - if (nullptr != desc) { - resDesc.res.linear.desc = *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); - if (nullptr != desc) { - resDesc.res.pitch2D.desc = *desc; - } + resDesc.res.pitch2D.desc = *desc; resDesc.res.pitch2D.width = width; resDesc.res.pitch2D.height = height; resDesc.res.pitch2D.pitchInBytes = pitch; @@ -704,7 +695,7 @@ hipError_t hipTexRefSetAddress(size_t* offset, textureReference* tex, hipDevicep &image_format.image_channel_order, &image_format.image_channel_data_type); const amd::Image::Format imageFormat(image_format); - HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, nullptr, size / imageFormat.getElementSize(), 1, size)); + HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, &tex->channelDesc, size / imageFormat.getElementSize(), 1, size)); } hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc, @@ -716,5 +707,5 @@ hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPT } size_t offset; - HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, &offset, tex, devPtr, nullptr, desc->Width, desc->Height, pitch)); + HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, &offset, tex, devPtr, &tex->channelDesc, desc->Width, desc->Height, pitch)); }