From 8401146cd6db5d72e34300e61750a505c4836d4e Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 3 Oct 2018 12:07:38 +0530 Subject: [PATCH] Corrected the width calculation logic to accomodate multi channels [ROCm/hip commit: 5a3d89e99c3006f08a7eb631e9da6912daf52330] --- projects/hip/src/hip_texture.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/hip/src/hip_texture.cpp b/projects/hip/src/hip_texture.cpp index 85fb006d43..521e0e24de 100644 --- a/projects/hip/src/hip_texture.cpp +++ b/projects/hip/src/hip_texture.cpp @@ -198,7 +198,6 @@ bool getHipTextureObject(hipTextureObject_t* pTexObject, hsa_ext_image_t& image, return true; } -size_t channelFormatKindSize[] = {sizeof(unsigned),sizeof(signed),sizeof(float),sizeof(unsigned)}; // Texture Object APIs hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResourceDesc* pResDesc, const hipTextureDesc* pTexDesc, @@ -264,7 +263,7 @@ hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResou break; case hipResourceTypeLinear: devPtr = pResDesc->res.linear.devPtr; - imageDescriptor.width = pResDesc->res.linear.sizeInBytes/channelFormatKindSize[pResDesc->res.linear.desc.f]; + imageDescriptor.width = pResDesc->res.linear.sizeInBytes/((pResDesc->res.linear.desc.x + pResDesc->res.linear.desc.y + pResDesc->res.linear.desc.z + pResDesc->res.linear.desc.w)/8); imageDescriptor.height = 1; imageDescriptor.depth = 0; imageDescriptor.array_size = 0;