diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f246b05ec..4c89c93668 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,7 @@ if(HIP_PLATFORM STREQUAL "hcc") src/hip_module.cpp src/hip_db.cpp src/grid_launch.cpp + src/hip_texture.cpp src/env.cpp) set(SOURCE_FILES_DEVICE diff --git a/bin/hipify-perl b/bin/hipify-perl index 27acc5bccc..4b6e6e89b9 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -283,6 +283,7 @@ while (@ARGV) { $ft{'mem'} += s/\bcudaMemcpy2D\b/hipMemcpy2D/g; $ft{'mem'} += s/\bcudaMemcpy2DToArray\b/hipMemcpy2DToArray/g; + $ft{'mem'} += s/\bcudaMemcpyToArray\b/hipMemcpyToArray/g; #-------- # Memory management: @@ -302,6 +303,7 @@ while (@ARGV) { $ft{'mem'} += s/\bcudaHostGetDevicePointer\b/hipHostGetDevicePointer/g; $ft{'mem'} += s/\bcudaMallocArray\b/hipMallocArray/g; + $ft{'mem'} += s/\bcudaFreeArray\b/hipFreeArray/g; $ft{'mem'} += s/\bcudaMallocPitch\b/hipMallocPitch/g; @@ -511,11 +513,14 @@ while (@ARGV) { $ft{'tex'} += s/\bcudaFilterModePoint\b/hipFilterModePoint/g; $ft{'tex'} += s/\bcudaReadModeElementType\b/hipReadModeElementType/g; - $ft{'tex'} += s/\bcudaArray\b/hipArrary/g; + $ft{'tex'} += s/\bcudaArray\b/hipArray/g; $ft{'tex'} += s/\bcudaCreateChannelDesc\b/hipCreateChannelDesc/g; $ft{'tex'} += s/\bcudaBindTexture\b/hipBindTexture/g; $ft{'tex'} += s/\bcudaBindTextureToArray\b/hipBindTextureToArray/g; $ft{'tex'} += s/\bcudaUnbindTexture\b/hipUnbindTexture/g; + $ft{'tex'} += s/\bcudaChannelFormatKindFloat\b/hipChannelFormatKindFloat/g; + $ft{'tex'} += s/\bcudaAddressMode/hipAddressMode/g; + $ft{'tex'} += s/\bcudaFilterMode/hipFilterMode/g; } diff --git a/include/hip/hcc_detail/driver_types.h b/include/hip/hcc_detail/driver_types.h index 3578ddc609..ce5e9789be 100644 --- a/include/hip/hcc_detail/driver_types.h +++ b/include/hip/hcc_detail/driver_types.h @@ -25,20 +25,220 @@ THE SOFTWARE. enum hipChannelFormatKind { - hipChannelFormatKindSigned = 0, - hipChannelFormatKindUnsigned = 1, - hipChannelFormatKindFloat = 2, - hipChannelFormatKindNone = 3 + hipChannelFormatKindSigned = 0, + hipChannelFormatKindUnsigned = 1, + hipChannelFormatKindFloat = 2, + hipChannelFormatKindNone = 3 }; struct hipChannelFormatDesc { - int x; - int y; - int z; - int w; - enum hipChannelFormatKind f; + int x; + int y; + int z; + int w; + enum hipChannelFormatKind f; }; +struct hipArray { + void* data; //FIXME: generalize this + struct hipChannelFormatDesc desc; + unsigned int type; + unsigned int width; + unsigned int height; + unsigned int depth; +}; + +typedef struct hipArray* hipArray_t; + +typedef const struct hipArray* hipArray_const_t; + +// TODO: It needs to be modified since it was just copied from hipArray. +struct hipMipmappedArray { + void* data; //FIXME: generalize this + struct hipChannelFormatDesc desc; + unsigned int width; + unsigned int height; + unsigned int depth; +}; + +typedef struct hipMipmappedArray *hipMipmappedArray_t; + +typedef const struct hipMipmappedArray *hipMipmappedArray_const_t; + +/** + * hip resource types + */ +enum hipResourceType +{ + hipResourceTypeArray = 0x00, + hipResourceTypeMipmappedArray = 0x01, + hipResourceTypeLinear = 0x02, + hipResourceTypePitch2D = 0x03 +}; + +/** + * hip texture resource view formats + */ +enum hipResourceViewFormat +{ + hipResViewFormatNone = 0x00, + hipResViewFormatUnsignedChar1 = 0x01, + hipResViewFormatUnsignedChar2 = 0x02, + hipResViewFormatUnsignedChar4 = 0x03, + hipResViewFormatSignedChar1 = 0x04, + hipResViewFormatSignedChar2 = 0x05, + hipResViewFormatSignedChar4 = 0x06, + hipResViewFormatUnsignedShort1 = 0x07, + hipResViewFormatUnsignedShort2 = 0x08, + hipResViewFormatUnsignedShort4 = 0x09, + hipResViewFormatSignedShort1 = 0x0a, + hipResViewFormatSignedShort2 = 0x0b, + hipResViewFormatSignedShort4 = 0x0c, + hipResViewFormatUnsignedInt1 = 0x0d, + hipResViewFormatUnsignedInt2 = 0x0e, + hipResViewFormatUnsignedInt4 = 0x0f, + hipResViewFormatSignedInt1 = 0x10, + hipResViewFormatSignedInt2 = 0x11, + hipResViewFormatSignedInt4 = 0x12, + hipResViewFormatHalf1 = 0x13, + hipResViewFormatHalf2 = 0x14, + hipResViewFormatHalf4 = 0x15, + hipResViewFormatFloat1 = 0x16, + hipResViewFormatFloat2 = 0x17, + hipResViewFormatFloat4 = 0x18, + hipResViewFormatUnsignedBlockCompressed1 = 0x19, + hipResViewFormatUnsignedBlockCompressed2 = 0x1a, + hipResViewFormatUnsignedBlockCompressed3 = 0x1b, + hipResViewFormatUnsignedBlockCompressed4 = 0x1c, + hipResViewFormatSignedBlockCompressed4 = 0x1d, + hipResViewFormatUnsignedBlockCompressed5 = 0x1e, + hipResViewFormatSignedBlockCompressed5 = 0x1f, + hipResViewFormatUnsignedBlockCompressed6H = 0x20, + hipResViewFormatSignedBlockCompressed6H = 0x21, + hipResViewFormatUnsignedBlockCompressed7 = 0x22 +}; + +/** + * HIP resource descriptor + */ +struct hipResourceDesc { + enum hipResourceType resType; + + union { + struct { + hipArray_t array; + } array; + struct { + hipMipmappedArray_t mipmap; + } mipmap; + struct { + void *devPtr; + struct hipChannelFormatDesc desc; + size_t sizeInBytes; + } linear; + struct { + void *devPtr; + struct hipChannelFormatDesc desc; + size_t width; + size_t height; + size_t pitchInBytes; + } pitch2D; + } res; +}; + +/** + * hip resource view descriptor + */ +struct hipResourceViewDesc +{ + enum hipResourceViewFormat format; + size_t width; + size_t height; + size_t depth; + unsigned int firstMipmapLevel; + unsigned int lastMipmapLevel; + unsigned int firstLayer; + unsigned int lastLayer; +}; + +/** + * Memory copy types + * + */ +typedef enum hipMemcpyKind { + hipMemcpyHostToHost = 0, ///< Host-to-Host Copy + hipMemcpyHostToDevice = 1, ///< Host-to-Device Copy + hipMemcpyDeviceToHost = 2, ///< Device-to-Host Copy + hipMemcpyDeviceToDevice =3, ///< Device-to-Device Copy + hipMemcpyDefault = 4 ///< Runtime will automatically determine copy-kind based on virtual addresses. +} hipMemcpyKind; + +struct hipPitchedPtr +{ + void *ptr; + size_t pitch; + size_t xsize; + size_t ysize; +}; + +struct hipExtent { + size_t width; // Width in elements when referring to array memory, in bytes when referring to linear memory + size_t height; + size_t depth; +}; + +struct hipPos { + size_t x; + size_t y; + size_t z; +}; + +struct hipMemcpy3DParms { + hipArray_t srcArray; + struct hipPos srcPos; + struct hipPitchedPtr srcPtr; + + hipArray_t dstArray; + struct hipPos dstPos; + struct hipPitchedPtr dstPtr; + + struct hipExtent extent; + enum hipMemcpyKind kind; +}; + +static __inline__ struct hipPitchedPtr make_hipPitchedPtr(void *d, size_t p, size_t xsz, size_t ysz) +{ + struct hipPitchedPtr s; + + s.ptr = d; + s.pitch = p; + s.xsize = xsz; + s.ysize = ysz; + + return s; +} + +static __inline__ struct hipPos make_hipPos(size_t x, size_t y, size_t z) +{ + struct hipPos p; + + p.x = x; + p.y = y; + p.z = z; + + return p; +} + +static __inline__ struct hipExtent make_hipExtent(size_t w, size_t h, size_t d) +{ + struct hipExtent e; + + e.width = w; + e.height = h; + e.depth = d; + + return e; +} #endif diff --git a/include/hip/hcc_detail/hip_runtime.h b/include/hip/hcc_detail/hip_runtime.h index 5536ded5e2..fecf79c496 100644 --- a/include/hip/hcc_detail/hip_runtime.h +++ b/include/hip/hcc_detail/hip_runtime.h @@ -81,12 +81,12 @@ namespace hip_impl extern int HIP_TRACE_API; #ifdef __cplusplus -//#include #include #endif #include #include #include +#include // TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define. #if defined (__KALMAR_ACCELERATOR__) && !defined (__HCC_ACCELERATOR__) diff --git a/include/hip/hcc_detail/hip_runtime_api.h b/include/hip/hcc_detail/hip_runtime_api.h index 2036aa5008..e28dbab82c 100644 --- a/include/hip/hcc_detail/hip_runtime_api.h +++ b/include/hip/hcc_detail/hip_runtime_api.h @@ -37,7 +37,8 @@ THE SOFTWARE. #include #include -#include +#include +#include #if defined (__HCC__) && (__hcc_workweek__ < 16155) #error("This version of HIP requires a newer version of HCC."); @@ -136,6 +137,11 @@ enum hipLimit_t #define hipDeviceMapHost 0x8 #define hipDeviceLmemResizeToMax 0x16 +#define hipArrayDefault 0x00 ///< Default HIP array allocation flag +#define hipArrayLayered 0x01 +#define hipArraySurfaceLoadStore 0x02 +#define hipArrayCubemap 0x04 +#define hipArrayTextureGather 0x08 /* * @brief hipJitOption @@ -200,27 +206,6 @@ typedef struct dim3 { } dim3; -/** - * Memory copy types - * - */ -typedef enum hipMemcpyKind { - hipMemcpyHostToHost = 0 ///< Host-to-Host Copy - ,hipMemcpyHostToDevice = 1 ///< Host-to-Device Copy - ,hipMemcpyDeviceToHost = 2 ///< Device-to-Host Copy - ,hipMemcpyDeviceToDevice =3 ///< Device-to-Device Copy - ,hipMemcpyDefault = 4, ///< Runtime will automatically determine copy-kind based on virtual addresses. -} hipMemcpyKind; - -typedef struct { - unsigned int width; - unsigned int height; - enum hipChannelFormatKind f; - void* data; //FIXME: generalize this -} hipArray; - - - // Doxygen end group GlobalDefs /** @} */ @@ -1287,6 +1272,19 @@ hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t s hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream); #endif +/** + * @brief Fills the memory area pointed to by dst with the constant value. + * + * @param[out] dst Pointer to device memory + * @param[in] pitch - data size in bytes + * @param[in] value - constant value to be set + * @param[in] width + * @param[in] height + * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree + */ + +hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t height); + /** * @brief Query memory info. * Return snapshot of free memory, and total allocatable memory on the device. @@ -1315,7 +1313,7 @@ hipError_t hipMemPtrGetInfo(void *ptr, size_t *size); */ #if __cplusplus hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, - size_t width, size_t height = 0, unsigned int flags = 0); + size_t width, size_t height = 0, unsigned int flags = hipArrayDefault); #else hipError_t hipMallocArray(hipArray** array, const struct hipChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags); @@ -1330,6 +1328,22 @@ hipError_t hipMallocArray(hipArray** array, const struct hipChannelFormatDesc* d */ hipError_t hipFreeArray(hipArray* array); +/** + * @brief Allocate an array on the device. + * + * @param[out] array Pointer to allocated array in device memory + * @param[in] desc Requested channel format + * @param[in] extent Requested array allocation width, height and depth + * @param[in] flags Requested properties of allocated array + * @return #hipSuccess, #hipErrorMemoryAllocation + * + * @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree + */ + +hipError_t hipMalloc3DArray(hipArray_t *array, + const struct hipChannelFormatDesc* desc, + struct hipExtent extent, + unsigned int flags); /** * @brief Copies data between host and device. * @@ -1402,6 +1416,7 @@ hipError_t hipMemcpyToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src, size_t count, hipMemcpyKind kind); +hipError_t hipMemcpy3D(const struct hipMemcpy3DParms *p); // doxygen end Memory /** @@ -2150,6 +2165,24 @@ hipError_t hipIpcCloseMemHandle(void *devPtr); #endif #ifdef __cplusplus + +hipError_t hipBindTexture(size_t* offset, + textureReference* tex, + const void* devPtr, + const hipChannelFormatDesc* desc, + size_t size = UINT_MAX); + +hipError_t ihipBindTextureImpl(int dim, + enum hipTextureReadMode readMode, + size_t *offset, + const void *devPtr, + const struct hipChannelFormatDesc& desc, + size_t size, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords, + hipTextureObject_t& textureObject); + /* * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture reference tex. * @@ -2164,15 +2197,15 @@ hipError_t hipIpcCloseMemHandle(void *devPtr); * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown **/ template -hipError_t hipBindTexture(size_t *offset, - struct texture &tex, - const void *devPtr, - const struct hipChannelFormatDesc *desc, - size_t size=UINT_MAX) +hipError_t hipBindTexture(size_t *offset, + struct texture& tex, + const void *devPtr, + const struct hipChannelFormatDesc& desc, + size_t size = UINT_MAX) { - tex._dataPtr = static_cast(devPtr); - - return hipSuccess; + return ihipBindTextureImpl(dim, readMode, offset, devPtr, desc, size, + tex.addressMode[0], tex.filterMode, tex.normalized, + tex.textureObject); } /* @@ -2188,20 +2221,115 @@ hipError_t hipBindTexture(size_t *offset, * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown **/ template -hipError_t hipBindTexture(size_t *offset, - struct texture &tex, - const void *devPtr, - size_t size=UINT_MAX) +hipError_t hipBindTexture(size_t *offset, + struct texture& tex, + const void *devPtr, + size_t size = UINT_MAX) +{ + return ihipBindTextureImpl(dim, readMode, offset, devPtr, tex.channelDesc, size, + tex.addressMode[0], tex.filterMode, tex.normalized, + tex.textureObject); +} + +// C API +hipError_t hipBindTexture2D(size_t* offset, + textureReference* tex, + const void* devPtr, + const hipChannelFormatDesc* desc, + size_t width, + size_t height, + size_t pitch); + +hipError_t ihipBindTexture2DImpl(int dim, + enum hipTextureReadMode readMode, + size_t *offset, + const void *devPtr, + const struct hipChannelFormatDesc& desc, + size_t width, + size_t height, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords, + hipTextureObject_t& textureObject); + +template +hipError_t hipBindTexture2D(size_t *offset, + struct texture& tex, + const void *devPtr, + size_t width, + size_t height, + size_t pitch) +{ + return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, tex.channelDesc, width, height, + tex.addressMode[0], tex.filterMode, tex.normalized, + tex.textureObject); +} + +template +hipError_t hipBindTexture2D(size_t *offset, + struct texture& tex, + const void *devPtr, + const struct hipChannelFormatDesc &desc, + size_t width, + size_t height, + size_t pitch) +{ + return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, desc, width, height, + tex.addressMode[0], tex.filterMode, tex.normalized, + tex.textureObject); +} + +//C API +hipError_t hipBindTextureToArray(textureReference* tex, + hipArray_const_t array, + const hipChannelFormatDesc* desc); + +hipError_t ihipBindTextureToArrayImpl(int dim, + enum hipTextureReadMode readMode, + hipArray_const_t array, + const struct hipChannelFormatDesc& desc, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords, + hipTextureObject_t& textureObject); + +template +hipError_t hipBindTextureToArray(struct texture& tex, + hipArray_const_t array) { - return hipBindTexture(offset, tex, devPtr, &tex.channelDesc, size); + return ihipBindTextureToArrayImpl(dim, readMode, array, tex.channelDesc, + tex.addressMode[0], tex.filterMode, tex.normalized, + tex.textureObject); } template -hipError_t hipBindTextureToArray(struct texture &tex, hipArray* array) { - tex.width = array->width; - tex.height = array->height; - tex._dataPtr = static_cast(array->data); - return hipSuccess; +hipError_t hipBindTextureToArray(struct texture& tex, + hipArray_const_t array, + const struct hipChannelFormatDesc& desc) +{ + return ihipBindTextureToArrayImpl(dim, readMode, array, desc, + tex.addressMode[0], tex.filterMode, tex.normalized, + tex.textureObject); +} + +//C API +hipError_t hipBindTextureToMipmappedArray(const textureReference* tex, + hipMipmappedArray_const_t mipmappedArray, + const hipChannelFormatDesc* desc); + +template +hipError_t hipBindTextureToMipmappedArray(const texture& tex, + hipMipmappedArray_const_t mipmappedArray) +{ + return hipSuccess; +} + +template +hipError_t hipBindTextureToMipmappedArray(const texture& tex, + hipMipmappedArray_const_t mipmappedArray, + const hipChannelFormatDesc& desc) +{ + return hipSuccess; } /* @@ -2211,15 +2339,30 @@ hipError_t hipBindTextureToArray(struct texture &tex, hipArray * * @return #hipSuccess **/ +hipError_t hipUnbindTexture(const textureReference* tex); + +extern hipError_t ihipUnbindTextureImpl(const hipTextureObject_t& textureObject); + template -hipError_t hipUnbindTexture(struct texture &tex) +hipError_t hipUnbindTexture(struct texture &tex) { - tex._dataPtr = NULL; - - return hipSuccess; + return ihipUnbindTextureImpl(tex.textureObject); } +hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array); +hipError_t hipGetTextureAlignmentOffset (size_t* offset, const textureReference* texref); +hipError_t hipGetTextureReference(const textureReference** texref, const void* symbol); + +hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, + const hipResourceDesc* pResDesc, + const hipTextureDesc* pTexDesc, + const hipResourceViewDesc* pResViewDesc); + +hipError_t hipDestroyTextureObject(hipTextureObject_t textureObject); +hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDesc, hipTextureObject_t textureObject); +hipError_t hipGetTextureObjectResourceViewDesc(hipResourceViewDesc* pResViewDesc, hipTextureObject_t textureObject); +hipError_t hipGetTextureObjectTextureDesc(hipTextureDesc* pTexDesc, hipTextureObject_t textureObject); // doxygen end Texture /** diff --git a/include/hip/hcc_detail/hip_texture.h b/include/hip/hcc_detail/hip_texture.h deleted file mode 100644 index c6f5a1cfb2..0000000000 --- a/include/hip/hcc_detail/hip_texture.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -//#pragma once - -#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_HIP_TEXTURE_H -#define HIP_INCLUDE_HIP_HCC_DETAIL_HIP_TEXTURE_H - -/** - * @file hcc_detail/hip_texture.h - * @brief HIP C++ Texture API for hcc compiler - */ - -#include -#include -#include -#include -//#include - -//---- -//Texture - TODO - likely need to move this to a separate file only included with kernel compilation. -#define hipTextureType1D 1 - -#if __cplusplus -template -struct texture : public textureReference { - - const T * _dataPtr; // pointer to underlying data. - - //texture() : filterMode(hipFilterModePoint), normalized(false), _dataPtr(NULL) {}; - unsigned int width; - unsigned int height; - -}; -#endif - - -#define tex1Dfetch(_tex, _addr) (_tex._dataPtr[_addr]) - -#define tex2D(_tex, _dx, _dy) \ - _tex._dataPtr[(unsigned int)_dx + (unsigned int)_dy*(_tex.width)] - -/** - * @addtogroup API HIP API - * @{ - * - * Defines the HIP API. See the individual sections for more information. - */ - -// These are C++ APIs - maybe belong in separate file. -/** - *------------------------------------------------------------------------------------------------- - *------------------------------------------------------------------------------------------------- - * @defgroup Texture Texture Reference Management - * @{ - * - * - * @warning The HIP texture API implements a small subset of full texture API. Known limitations include: - * - Only point sampling is supported. - * - Only C++ APIs are provided. - * - Many APIs and modes are not implemented. - * - * The HIP texture support is intended to allow use of texture cache on hardware where this is beneficial. - * - * The following CUDA APIs are not currently supported: - * - cudaBindTexture2D - * - cudaBindTextureToArray - * - cudaBindTextureToMipmappedArray - * - cudaGetChannelDesc - * - cudaGetTextureReference - * - */ - -// C API: -#if 0 -hipChannelFormatDesc hipBindTexture(size_t *offset, struct textureReference *tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX) -{ - tex->_dataPtr = devPtr; -} -#endif - - -// End doxygen API: -/** - * @} - */ - -#endif diff --git a/include/hip/hcc_detail/hip_texture_types.h b/include/hip/hcc_detail/hip_texture_types.h new file mode 100644 index 0000000000..27f8747653 --- /dev/null +++ b/include/hip/hcc_detail/hip_texture_types.h @@ -0,0 +1,83 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** + * @file hcc_detail/hip_texture_types.h + * @brief Defines the different newt vector types for HIP runtime. + */ + +#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_HIP_TEXTURE_TYPES_H +#define HIP_INCLUDE_HIP_HCC_DETAIL_HIP_TEXTURE_TYPES_H + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ +#include +//#include +#include +#include + +#if __cplusplus + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +template +struct texture : public textureReference +{ + texture(int norm = 0, + enum hipTextureFilterMode fMode = hipFilterModePoint, + enum hipTextureAddressMode aMode = hipAddressModeClamp) + { + normalized = norm; + filterMode = fMode; + addressMode[0] = aMode; + addressMode[1] = aMode; + addressMode[2] = aMode; + channelDesc = hipCreateChannelDesc(); + sRGB = 0; + } + + texture(int norm, + enum hipTextureFilterMode fMode, + enum hipTextureAddressMode aMode, + struct hipChannelFormatDesc desc) + { + normalized = norm; + filterMode = fMode; + addressMode[0] = aMode; + addressMode[1] = aMode; + addressMode[2] = aMode; + channelDesc = desc; + sRGB = 0; + } +}; + +#endif /* __cplusplus */ + +#endif /* !HIP_INCLUDE_HIP_HCC_DETAIL_HIP_TEXTURE_TYPES_H */ + diff --git a/include/hip/hcc_detail/texture_functions.h b/include/hip/hcc_detail/texture_functions.h new file mode 100644 index 0000000000..d08b429fca --- /dev/null +++ b/include/hip/hcc_detail/texture_functions.h @@ -0,0 +1,6771 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_TEXTURE_FUNCTIONS_H +#define HIP_INCLUDE_HIP_HCC_DETAIL_TEXTURE_FUNCTIONS_H + +#include +#include +#include + +union TData { + hc::short_vector::float4::vector_value_type f; + hc::short_vector::int4::vector_value_type i; + hc::short_vector::uint4::vector_value_type u; +}; + +#define __TEXTURE_FUNCTIONS_DECL__ static __inline__ __device__ +#define ADDRESS_SPACE_2 __attribute__((address_space(2))) +#define TEXTURE_PARAMETERS_INIT \ + unsigned int ADDRESS_SPACE_2 *i = (unsigned int ADDRESS_SPACE_2*)textureObject; \ + unsigned int ADDRESS_SPACE_2 *s = i + HIP_SAMPLER_OBJECT_OFFSET_DWORD; \ + TData texel; + +#define TEXTURE_SET_FLOAT \ + *retVal = texel.f.x; + +#define TEXTURE_SET_SIGNED \ + *retVal = texel.i.x; + +#define TEXTURE_SET_UNSIGNED \ + *retVal = texel.u.x; + +#define TEXTURE_SET_FLOAT_X \ + retVal->x = texel.f.x; + +#define TEXTURE_SET_SIGNED_X \ + retVal->x = texel.i.x; + +#define TEXTURE_SET_UNSIGNED_X \ + retVal->x = texel.u.x; + +#define TEXTURE_SET_FLOAT_XY \ + retVal->x = texel.f.x; \ + retVal->y = texel.f.y; + +#define TEXTURE_SET_SIGNED_XY \ + retVal->x = texel.i.x; \ + retVal->y = texel.i.y; + +#define TEXTURE_SET_UNSIGNED_XY \ + retVal->x = texel.u.x; \ + retVal->y = texel.u.y; + +#define TEXTURE_SET_FLOAT_XYZW \ + retVal->x = texel.f.x; \ + retVal->y = texel.f.y; \ + retVal->z = texel.f.z; \ + retVal->w = texel.f.w; + +#define TEXTURE_SET_SIGNED_XYZW \ + retVal->x = texel.i.x; \ + retVal->y = texel.i.y; \ + retVal->z = texel.i.z; \ + retVal->w = texel.i.w; + +#define TEXTURE_SET_UNSIGNED_XYZW \ + retVal->x = texel.u.x; \ + retVal->y = texel.u.y; \ + retVal->z = texel.u.z; \ + retVal->w = texel.u.w; + +#define TEXTURE_RETURN_CHAR \ + return texel.i.x; + +#define TEXTURE_RETURN_UCHAR \ + return texel.u.x; + +#define TEXTURE_RETURN_SHORT \ + return texel.i.x; + +#define TEXTURE_RETURN_USHORT \ + return texel.u.x; + +#define TEXTURE_RETURN_INT \ + return texel.i.x; + +#define TEXTURE_RETURN_UINT \ + return texel.u.x; + +#define TEXTURE_RETURN_FLOAT \ + return texel.f.x; + +#define TEXTURE_RETURN_SIGNED \ + return texel.i.x; + +#define TEXTURE_RETURN_UNSIGNED \ + return texel.u.x; + +#define TEXTURE_RETURN_CHAR_X \ + return char1(texel.i.x); + +#define TEXTURE_RETURN_UCHAR_X \ + return uchar1(texel.u.x); + +#define TEXTURE_RETURN_SHORT_X \ + return short1(texel.i.x); + +#define TEXTURE_RETURN_USHORT_X \ + return ushort1(texel.u.x); + +#define TEXTURE_RETURN_INT_X \ + return int1(texel.i.x); + +#define TEXTURE_RETURN_UINT_X \ + return uint1(texel.u.x); + +#define TEXTURE_RETURN_FLOAT_X \ + return float1(texel.f.x); + +#define TEXTURE_RETURN_CHAR_XY \ + return char2(texel.i.x, texel.i.y); + +#define TEXTURE_RETURN_UCHAR_XY \ + return uchar2(texel.u.x, texel.u.y); + +#define TEXTURE_RETURN_SHORT_XY \ + return short2(texel.i.x, texel.i.y); + +#define TEXTURE_RETURN_USHORT_XY \ + return ushort2(texel.u.x, texel.u.y); + +#define TEXTURE_RETURN_INT_XY \ + return int2(texel.i.x, texel.i.y); + +#define TEXTURE_RETURN_UINT_XY \ + return uint2(texel.u.x, texel.u.y); + +#define TEXTURE_RETURN_FLOAT_XY \ + return float2(texel.f.x, texel.f.y); + +#define TEXTURE_RETURN_CHAR_XYZW \ + return char4(texel.i.x, texel.i.y, texel.i.z, texel.i.w); + +#define TEXTURE_RETURN_UCHAR_XYZW \ + return uchar4(texel.u.x, texel.u.y, texel.u.z, texel.u.w); + +#define TEXTURE_RETURN_SHORT_XYZW \ + return short4(texel.i.x, texel.i.y, texel.i.z, texel.i.w); + +#define TEXTURE_RETURN_USHORT_XYZW \ + return ushort4(texel.u.x, texel.u.y, texel.u.z, texel.u.w); + +#define TEXTURE_RETURN_INT_XYZW \ + return int4(texel.i.x, texel.i.y, texel.i.z, texel.i.w); + +#define TEXTURE_RETURN_UINT_XYZW \ + return uint4(texel.u.x, texel.u.y, texel.u.z, texel.u.w); + +#define TEXTURE_RETURN_FLOAT_XYZW \ + return float4(texel.f.x, texel.f.y, texel.f.z, texel.f.w); + +extern "C" { +hc::short_vector::float4::vector_value_type +__ockl_image_sample_1D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + float c) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_1Da(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_2D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c) [[hc]]; + + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_2Da(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c) [[hc]]; + +float +__ockl_image_sample_2Dad(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c) [[hc]]; + +float +__ockl_image_sample_2Dd(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_3D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_grad_1D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + float c, + float dx, + float dy) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_grad_1Da(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c, + float dx, + float dy) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_grad_2D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c, + hc::short_vector::float2::vector_value_type dx, + hc::short_vector::float2::vector_value_type dy) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_grad_2Da(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c, + hc::short_vector::float2::vector_value_type dx, + hc::short_vector::float2::vector_value_type dy) [[hc]]; + +float +__ockl_image_sample_grad_2Dad(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c, + hc::short_vector::float2::vector_value_type dx, + hc::short_vector::float2::vector_value_type dy) [[hc]]; + +float +__ockl_image_sample_grad_2Dd(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c, + hc::short_vector::float2::vector_value_type dx, + hc::short_vector::float2::vector_value_type dy) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_grad_3D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c, + hc::short_vector::float4::vector_value_type dx, + hc::short_vector::float4::vector_value_type dy) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_lod_1D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + float c, + float l) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_lod_1Da(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c, + float l) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_lod_2D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c, + float l) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_lod_2Da(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c, + float l) [[hc]]; + +float +__ockl_image_sample_lod_2Dad(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c, + float l) [[hc]]; + +float +__ockl_image_sample_lod_2Dd(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float2::vector_value_type c, + float l) [[hc]]; + +hc::short_vector::float4::vector_value_type +__ockl_image_sample_lod_3D(unsigned int ADDRESS_SPACE_2 * i, + unsigned int ADDRESS_SPACE_2 * s, + hc::short_vector::float4::vector_value_type c, + float l) [[hc]]; +} + +//////////////////////////////////////////////////////////// +// Texture object APIs +//////////////////////////////////////////////////////////// + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(char *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(char1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(char2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(char4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(unsigned char *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(uchar1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(uchar2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(uchar4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(short *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(short1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(short2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(short4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(unsigned short *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(ushort1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(ushort2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(ushort4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(int *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(int1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(int2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(int4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(unsigned int *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(uint1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(uint2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(uint4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(float *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(float1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(float2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1Dfetch(float4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex1Dfetch(hipTextureObject_t textureObject, int x) +{ + T ret; + tex1Dfetch(&ret, textureObject, x); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex1D(char *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(char1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(char2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(char4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(unsigned char *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(uchar1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(uchar2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(uchar4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(short *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(short1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(short2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(short4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(unsigned short *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(ushort1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(ushort2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(ushort4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(int *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(int1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(int2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(int4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(unsigned int *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(uint1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(uint2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(uint4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(float *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(float1 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(float2 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1D(float4 *retVal, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_SET_FLOAT_XYZW; +} +template +__TEXTURE_FUNCTIONS_DECL__ T tex1D(hipTextureObject_t textureObject, int x) +{ + T ret; + tex1D(&ret, textureObject, x); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(char *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(char1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(char2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(char4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(unsigned char *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(uchar1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(uchar2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(uchar4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(short *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(short1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(short2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(short4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(unsigned short *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(ushort1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(ushort2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(ushort4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(int *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(int1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(int2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(int4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(unsigned int *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(uint1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(uint2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(uint4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(float *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(float1 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(float2 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLod(float4 *retVal, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex1DLod(hipTextureObject_t textureObject, float x, float level) +{ + T ret; + tex1DLod(&ret, textureObject, x, level); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(char *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(char1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(char2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(char4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(unsigned char *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(uchar1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(uchar2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(uchar4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(short *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(short1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(short2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(short4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(unsigned short *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(ushort1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(ushort2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(ushort4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(int *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(int1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(int2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(int4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(unsigned int *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(uint1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(uint2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(uint4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(float *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(float1 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(float2 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DGrad(float4 *retVal, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex1DGrad(hipTextureObject_t textureObject, float x, float dx, float dy) +{ + T ret; + tex1DLod(&ret, textureObject, x, dx, dy); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex2D(char *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(char1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(char2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(char4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(unsigned char *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(uchar1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(uchar2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(uchar4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(short *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(short1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(short2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(short4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(unsigned short *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(ushort1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(ushort2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(ushort4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(int *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(int1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(int2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(int4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(unsigned int *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(uint1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(uint2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(uint4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(float *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(float1 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(float2 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2D(float4 *retVal, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex2D(hipTextureObject_t textureObject, float x, float y) +{ + T ret; + tex2D(&ret, textureObject, x, y); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(char *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(char1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(char2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(char4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(unsigned char *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(uchar1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(uchar2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(uchar4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(short *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(short1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(short2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(short4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(unsigned short *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(ushort1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(ushort2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(ushort4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(int *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(int1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(int2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(int4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(unsigned int *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(uint1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(uint2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(uint4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(float *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(float1 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(float2 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLod(float4 *retVal, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex2DLod(hipTextureObject_t textureObject, float x, float y, float level) +{ + T ret; + tex2DLod(&ret, textureObject, x, y, level); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex3D(char *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(char1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(char2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(char4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(unsigned char *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(uchar1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(uchar2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(uchar4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(short *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(short1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(short2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(short4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(unsigned short *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(ushort1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(ushort2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(ushort4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(int *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(int1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(int2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(int4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(unsigned int *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(uint1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(uint2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(uint4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(float *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(float1 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(float2 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3D(float4 *retVal, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex3D(hipTextureObject_t textureObject, float x, float y, float z) +{ + T ret; + tex3D(&ret, textureObject, x, y, z); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(char *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(char1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(char2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(char4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(unsigned char *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(uchar1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(uchar2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(uchar4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(short *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(short1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(short2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(short4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(unsigned short *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(ushort1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(ushort2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(ushort4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(int *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(int1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(int2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(int4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(unsigned int *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(uint1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(uint2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(uint4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(float *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(float1 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(float2 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex3DLod(float4 *retVal, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex3DLod(hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + T ret; + tex3DLod(&ret, textureObject, x, y, z, level); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(char *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(char1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(char2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(char4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(unsigned char *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(uchar1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(uchar2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(uchar4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(short *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(short1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(short2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(short4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(unsigned short *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(ushort1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(ushort2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(ushort4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(int *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(int1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(int2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(int4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(unsigned int *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(uint1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(uint2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(uint4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(float *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(float1 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(float2 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_FLOAT_XY; +} +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayered(float4 *retVal, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex1DLayered(hipTextureObject_t textureObject, float x, int layer) +{ + T ret; + tex1DLayered(&ret, textureObject, x, layer); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(char *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(char1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(char2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(char4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(unsigned char *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(uchar1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(uchar2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(uchar4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(short *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(short1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(short2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(short4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(unsigned short *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(ushort1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(ushort2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(ushort4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(int *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(int1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(int2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(int4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(unsigned int *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(uint1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(uint2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(uint4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(float *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(float1 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(float2 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredLod(float4 *retVal, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex1DLayeredLod(hipTextureObject_t textureObject, float x, int layer, float level) +{ + T ret; + tex1DLayeredLod(&ret, textureObject, x, layer, level); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(char *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(char1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(char2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(char4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(unsigned char *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(uchar1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(uchar2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(uchar4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(short *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(short1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(short2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(short4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(unsigned short *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(ushort1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(ushort2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(ushort4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(int *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(int1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(int2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(int4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(unsigned int *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(uint1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(uint2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(uint4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(float *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(float1 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(float2 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex1DLayeredGrad(float4 *retVal, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex1DLayeredGrad(hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + T ret; + tex1DLayeredGrad(&ret, textureObject, x, layer, dx, dy); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(char *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(char1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(char2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(char4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(unsigned char *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(uchar1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(uchar2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(uchar4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(short *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(short1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(short2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(short4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(unsigned short *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(ushort1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(ushort2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(ushort4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(int *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(int1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(int2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(int4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(unsigned int *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(uint1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(uint2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(uint4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(float *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(float1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(float2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayered(float4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex2DLayered(hipTextureObject_t textureObject, float x, float y, int layer) +{ + T ret; + tex2DLayered(&ret, textureObject, x, y, layer); + return ret; +} + +//////////////////////////////////////////////////////////// +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(char *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(char1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(char2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(char4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(unsigned char *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(uchar1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(uchar2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(uchar4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(short *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(short1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(short2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(short4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(unsigned short *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(ushort1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(ushort2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(ushort4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(int *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(int1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(int2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(int4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_SIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(unsigned int *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(uint1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(uint2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(uint4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_UNSIGNED_XYZW; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(float *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(float1 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT_X; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(float2 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT_XY; +} + +__TEXTURE_FUNCTIONS_DECL__ void tex2DLayeredLod(float4 *retVal, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_SET_FLOAT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ T tex2DLayeredLod(hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + T ret; + tex2DLayeredLod(&ret, textureObject, x, y, layer, level); + return ret; +} + +//////////////////////////////////////////////////////////// +// Texture Reference APIs +//////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1D(texture texRef, hipTextureObject_t textureObject, int x) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR_X; +} +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} +#endif diff --git a/include/hip/hcc_detail/texture_types.h b/include/hip/hcc_detail/texture_types.h index 74680bbc76..731ed12308 100644 --- a/include/hip/hcc_detail/texture_types.h +++ b/include/hip/hcc_detail/texture_types.h @@ -26,20 +26,91 @@ THE SOFTWARE. #include -enum hipTextureReadMode +#define hipTextureType1D 0x01 +#define hipTextureType2D 0x02 +#define hipTextureType3D 0x03 +#define hipTextureTypeCubemap 0x0C +#define hipTextureType1DLayered 0xF1 +#define hipTextureType2DLayered 0xF2 +#define hipTextureTypeCubemapLayered 0xFC + +/** + * Should be same as HSA_IMAGE_OBJECT_SIZE_DWORD/HSA_SAMPLER_OBJECT_SIZE_DWORD + */ +#define HIP_IMAGE_OBJECT_SIZE_DWORD 12 +#define HIP_SAMPLER_OBJECT_SIZE_DWORD 8 +#define HIP_SAMPLER_OBJECT_OFFSET_DWORD HIP_IMAGE_OBJECT_SIZE_DWORD +#define HIP_TEXTURE_OBJECT_SIZE_DWORD (HIP_IMAGE_OBJECT_SIZE_DWORD + HIP_SAMPLER_OBJECT_SIZE_DWORD) + +/** + * An opaque value that represents a hip texture object + */ +typedef unsigned long long hipTextureObject_t; + +/** + * hip texture address modes + */ +enum hipTextureAddressMode { - hipReadModeElementType = 0 + hipAddressModeWrap = 0, + hipAddressModeClamp = 1, + hipAddressModeMirror = 2, + hipAddressModeBorder = 3 }; +/** + * hip texture filter modes + */ enum hipTextureFilterMode { - hipFilterModePoint = 0 + hipFilterModePoint = 0, + hipFilterModeLinear = 1 }; -struct textureReference { - enum hipTextureFilterMode filterMode; - unsigned normalized; - struct hipChannelFormatDesc channelDesc; +/** + * hip texture read modes + */ +enum hipTextureReadMode +{ + hipReadModeElementType = 0, + hipReadModeNormalizedFloat = 1 +}; + +/** + * hip texture reference + */ +struct textureReference +{ + int normalized; + enum hipTextureFilterMode filterMode; + enum hipTextureAddressMode addressMode[3]; //Texture address mode for up to 3 dimensions + struct hipChannelFormatDesc channelDesc; + int sRGB; // Perform sRGB->linear conversion during texture read + unsigned int maxAnisotropy; // Limit to the anisotropy ratio + enum hipTextureFilterMode mipmapFilterMode; + float mipmapLevelBias; + float minMipmapLevelClamp; + float maxMipmapLevelClamp; + + hipTextureObject_t textureObject; +}; + +/** + * hip texture descriptor + */ +struct hipTextureDesc +{ + enum hipTextureAddressMode addressMode[3]; //Texture address mode for up to 3 dimensions + enum hipTextureFilterMode filterMode; + enum hipTextureReadMode readMode; + int sRGB; // Perform sRGB->linear conversion during texture read + float borderColor[4]; + int normalizedCoords; + unsigned int maxAnisotropy; + enum hipTextureFilterMode mipmapFilterMode; + float mipmapLevelBias; + float minMipmapLevelClamp; + float maxMipmapLevelClamp; }; #endif diff --git a/include/hip/hip_texture.h b/include/hip/hip_texture_types.h similarity index 83% rename from include/hip/hip_texture.h rename to include/hip/hip_texture_types.h index a15c5a1016..44dc7a9e0f 100644 --- a/include/hip/hip_texture.h +++ b/include/hip/hip_texture_types.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2015-2017 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -20,13 +20,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef HIP_INCLUDE_HIP_HIP_TEXTURE_H -#define HIP_INCLUDE_HIP_HIP_TEXTURE_H + + +#ifndef HIP_INCLUDE_HIP_HIP_TEXTURE_TYPES_H +#define HIP_INCLUDE_HIP_HIP_TEXTURE_TYPES_H #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__) -#include +#include #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__) -#include +#include #else #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__"); #endif diff --git a/include/hip/nvcc_detail/hip_texture_types.h b/include/hip/nvcc_detail/hip_texture_types.h new file mode 100644 index 0000000000..751dd8e4d4 --- /dev/null +++ b/include/hip/nvcc_detail/hip_texture_types.h @@ -0,0 +1,6 @@ +#ifndef HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_TEXTURE_TYPES_H +#define HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_TEXTURE_TYPES_H + +#include + +#endif diff --git a/src/hip_memory.cpp b/src/hip_memory.cpp index 6728ae42d3..0e557a5621 100644 --- a/src/hip_memory.cpp +++ b/src/hip_memory.cpp @@ -27,10 +27,6 @@ THE SOFTWARE. #include "hip/hip_runtime.h" #include "hip_hcc_internal.h" #include "trace_helper.h" -#include "hip/hcc_detail/hip_texture.h" -#include - - // Internal HIP APIS: namespace hip_internal { @@ -377,10 +373,11 @@ hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, auto ctx = ihipGetTlsDefaultCtx(); *array = (hipArray*)malloc(sizeof(hipArray)); + array[0]->type = flags; array[0]->width = width; array[0]->height = height; - - array[0]->f = desc->f; + array[0]->depth = 1; + array[0]->desc = *desc; void ** ptr = &array[0]->data; @@ -418,6 +415,62 @@ hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, return ihipLogStatus(hip_status); } +hipError_t hipMalloc3DArray(hipArray_t *array, + const struct hipChannelFormatDesc* desc, + struct hipExtent extent, + unsigned int flags) +{ + HIP_INIT(); + HIP_SET_DEVICE(); + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + + *array = (hipArray*)malloc(sizeof(hipArray)); + array[0]->type = flags; + array[0]->width = extent.width; + array[0]->height = extent.height; + array[0]->depth = extent.depth; + array[0]->desc = *desc; + + void ** ptr = &array[0]->data; + + if (ctx) { + const unsigned am_flags = 0; + const size_t size = extent.width*extent.height*extent.depth; + + size_t allocSize = 0; + switch(desc->f) { + case hipChannelFormatKindSigned: + allocSize = size * sizeof(int); + break; + case hipChannelFormatKindUnsigned: + allocSize = size * sizeof(unsigned int); + break; + case hipChannelFormatKindFloat: + allocSize = size * sizeof(float); + break; + case hipChannelFormatKindNone: + allocSize = size * sizeof(size_t); + break; + default: + hip_status = hipErrorUnknown; + break; + } + *ptr = hip_internal::allocAndSharePtr("device_array", allocSize, ctx, false, am_flags, 0); + + if (size && (*ptr == NULL)) { + hip_status = hipErrorMemoryAllocation; + } + + } else { + hip_status = hipErrorMemoryAllocation; + } + + //return ihipLogStatus(hip_status); + return hip_status; +} + hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) { HIP_INIT_API(flagsPtr, hostPtr); @@ -857,7 +910,7 @@ hipError_t hipMemcpy2DToArray(hipArray* dst, size_t wOffset, size_t hOffset, con size_t byteSize; if(dst) { - switch(dst[0].f) { + switch(dst[0].desc.f) { case hipChannelFormatKindSigned: byteSize = sizeof(int); break; @@ -918,6 +971,56 @@ hipError_t hipMemcpyToArray(hipArray* dst, size_t wOffset, size_t hOffset, return ihipLogStatus(e); } +hipError_t hipMemcpy3D(const struct hipMemcpy3DParms *p) +{ + HIP_INIT_SPECIAL_API((TRACE_MCMD), p); + + hipStream_t stream = ihipSyncAndResolveStream(hipStreamNull); + + hc::completion_future marker; + + hipError_t e = hipSuccess; + + size_t byteSize; + if(p) { + switch(p->dstArray->desc.f) { + case hipChannelFormatKindSigned: + byteSize = sizeof(int); + break; + case hipChannelFormatKindUnsigned: + byteSize = sizeof(unsigned int); + break; + case hipChannelFormatKindFloat: + byteSize = sizeof(float); + break; + case hipChannelFormatKindNone: + byteSize = sizeof(size_t); + break; + default: + byteSize = 0; + break; + } + } else { + return ihipLogStatus(hipErrorUnknown); + } + + try { + for (int i = 0; i < p->extent.depth; i++) { + for(int j = 0; j < p->extent.height; j++) { + // TODO: p->srcPos or p->dstPos are not 0. + unsigned char* src = (unsigned char*)p->srcPtr.ptr + i*p->srcPtr.ysize*p->srcPtr.pitch + j*p->srcPtr.pitch; + unsigned char* dst = (unsigned char*)p->dstArray->data + i*p->dstArray->height*p->dstArray->width*byteSize + j*p->dstArray->width*byteSize; + stream->locked_copySync(dst, src, p->extent.width*byteSize, p->kind); + } + } + } + catch (ihipException ex) { + e = ex._code; + } + + return ihipLogStatus(e); +} + // TODO - make member function of stream? template void @@ -1006,7 +1109,7 @@ hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t s return ihipLogStatus(e); }; -hipError_t hipMemset(void* dst, int value, size_t sizeBytes ) +hipError_t hipMemset(void* dst, int value, size_t sizeBytes) { HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, value, sizeBytes); @@ -1058,6 +1161,58 @@ hipError_t hipMemset(void* dst, int value, size_t sizeBytes ) return ihipLogStatus(e); } +hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t height) +{ + HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, pitch, value, width, height); + + hipError_t e = hipSuccess; + + hipStream_t stream = hipStreamNull; + // TODO - call an ihip memset so HIP_TRACE is correct. + stream = ihipSyncAndResolveStream(stream); + + if (stream) { + auto crit = stream->lockopen_preKernelCommand(); + + hc::completion_future cf ; + + size_t sizeBytes = pitch * height; + if ((sizeBytes & 0x3) == 0) { + // use a faster dword-per-workitem copy: + try { + value = value & 0xff; + uint32_t value32 = (value << 24) | (value << 16) | (value << 8) | (value) ; + ihipMemsetKernel (stream, crit, static_cast (dst), value32, sizeBytes/sizeof(uint32_t), &cf); + } + catch (std::exception &ex) { + e = hipErrorInvalidValue; + } + } else { + // use a slow byte-per-workitem copy: + try { + ihipMemsetKernel (stream, crit, static_cast (dst), value, sizeBytes, &cf); + } + catch (std::exception &ex) { + e = hipErrorInvalidValue; + } + } + // TODO - is hipMemset supposed to be async? + cf.wait(); + + stream->lockclose_postKernelCommand("hipMemset", &crit->_av); + + if (HIP_LAUNCH_BLOCKING) { + tprintf (DB_SYNC, "'%s' LAUNCH_BLOCKING wait for memset in %s.\n", __func__, ToString(stream).c_str()); + cf.wait(); + tprintf (DB_SYNC, "'%s' LAUNCH_BLOCKING memset completed in %s.\n", __func__, ToString(stream).c_str()); + } + } else { + e = hipErrorInvalidValue; + } + + return ihipLogStatus(e); +} + hipError_t hipMemsetD8(hipDeviceptr_t dst, unsigned char value, size_t sizeBytes ) { HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, value, sizeBytes); @@ -1108,7 +1263,7 @@ hipError_t hipMemsetD8(hipDeviceptr_t dst, unsigned char value, size_t sizeByte return ihipLogStatus(e); } -hipError_t hipMemGetInfo (size_t *free, size_t *total) +hipError_t hipMemGetInfo(size_t *free, size_t *total) { HIP_INIT_API(free, total); diff --git a/src/hip_texture.cpp b/src/hip_texture.cpp new file mode 100644 index 0000000000..656c160f00 --- /dev/null +++ b/src/hip_texture.cpp @@ -0,0 +1,668 @@ + +#include + +#include + +#include "hsa/hsa.h" +#include "hsa/hsa_ext_amd.h" + +#include "hip/hip_runtime.h" +#include "hip_hcc_internal.h" +#include "trace_helper.h" + +#include "hip_texture.h" + +static std::map textureHash; + +void saveTextureInfo(const hipTexture* pTexture, + const hipResourceDesc* pResDesc, + const hipTextureDesc* pTexDesc, + const hipResourceViewDesc* pResViewDesc) +{ + if (pResDesc != nullptr) { + memcpy((void*)&(pTexture->resDesc), (void*)pResDesc, sizeof(hipResourceDesc)); + } + + if (pTexDesc != nullptr) { + memcpy((void*)&(pTexture->texDesc), (void*)pTexDesc, sizeof(hipTextureDesc)); + } + + if (pResViewDesc != nullptr) { + memcpy((void*)&(pTexture->resViewDesc), (void*)pResViewDesc, sizeof(hipResourceViewDesc)); + } +} + +void getChannelOrderAndType(const hipChannelFormatDesc& desc, + enum hipTextureReadMode readMode, + hsa_ext_image_channel_order_t& channelOrder, + hsa_ext_image_channel_type_t& channelType) +{ + if (desc.x != 0 && desc.y != 0 && desc.z != 0 && desc.w != 0) { + channelOrder = HSA_EXT_IMAGE_CHANNEL_ORDER_RGBA; + } else if (desc.x != 0 && desc.y != 0 && desc.z != 0 && desc.w == 0) { + channelOrder = HSA_EXT_IMAGE_CHANNEL_ORDER_RGB; + } else if (desc.x != 0 && desc.y != 0 && desc.z == 0 && desc.w == 0) { + channelOrder = HSA_EXT_IMAGE_CHANNEL_ORDER_RG; + } else if (desc.x != 0 && desc.y == 0 && desc.z == 0 && desc.w == 0) { + channelOrder = HSA_EXT_IMAGE_CHANNEL_ORDER_R; + } else { + } + + switch (desc.f) { + case hipChannelFormatKindUnsigned: + switch(desc.x) { + case 32: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; + break; + case 16: + channelType = readMode == hipReadModeNormalizedFloat ? HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT16 : + HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16; + break; + case 8: + channelType = readMode == hipReadModeNormalizedFloat ? HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT8 : + HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8; + break; + default: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; + } + break; + case hipChannelFormatKindSigned: + switch(desc.x) { + case 32: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32; + break; + case 16: + channelType = readMode == hipReadModeNormalizedFloat ? HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT16 : + HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16; + break; + case 8: + channelType = readMode == hipReadModeNormalizedFloat ? HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT8 : + HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8; + break; + default: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32; + } + break; + case hipChannelFormatKindFloat: + switch(desc.x) { + case 32: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT; + break; + case 16: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_HALF_FLOAT; + break; + case 8: + break; + default: + channelType = HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT; + } + break; + case hipChannelFormatKindNone: + default: + break; + } +} + +void fillSamplerDescriptor(hsa_ext_sampler_descriptor_t& samplerDescriptor, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords) +{ + if (normalizedCoords) { + samplerDescriptor.coordinate_mode = HSA_EXT_SAMPLER_COORDINATE_MODE_NORMALIZED; + } else { + samplerDescriptor.coordinate_mode = HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED; + } + + switch (filterMode) { + case hipFilterModePoint: + samplerDescriptor.filter_mode = HSA_EXT_SAMPLER_FILTER_MODE_NEAREST; + break; + case hipFilterModeLinear: + samplerDescriptor.filter_mode = HSA_EXT_SAMPLER_FILTER_MODE_LINEAR; + break; + } + + switch (addressMode) { + case hipAddressModeWrap: + samplerDescriptor.address_mode = HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT; + break; + case hipAddressModeClamp: + samplerDescriptor.address_mode = HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE; + break; + case hipAddressModeMirror: + samplerDescriptor.address_mode = HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT; + break; + case hipAddressModeBorder: + samplerDescriptor.address_mode = HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER; + break; + } +} + +bool getHipTextureObject(hipTextureObject_t* pTexObject, + hsa_ext_image_t& image, + hsa_ext_sampler_t sampler) +{ + unsigned int* texSRD; + hipMalloc((void **) &texSRD, HIP_TEXTURE_OBJECT_SIZE_DWORD * 4); + hipMemcpy(texSRD, (void *)image.handle, HIP_IMAGE_OBJECT_SIZE_DWORD * 4, hipMemcpyDeviceToDevice); + hipMemcpy(texSRD + HIP_SAMPLER_OBJECT_OFFSET_DWORD, (void *)sampler.handle, HIP_SAMPLER_OBJECT_SIZE_DWORD * 4, hipMemcpyDeviceToDevice); + *pTexObject = (hipTextureObject_t) texSRD; + +#ifdef DEBUG + unsigned int* srd = (unsigned int*) malloc(HIP_TEXTURE_OBJECT_SIZE_DWORD * 4); + hipMemcpy(srd, texSRD, HIP_TEXTURE_OBJECT_SIZE_DWORD * 4, hipMemcpyDeviceToHost); + printf("New SRD: \n"); + for (int i = 0; i < HIP_TEXTURE_OBJECT_SIZE_DWORD; i++) { + printf("SRD[%d]: %x\n", i, srd[i]); + } + printf("\n"); +#endif + return true; +} + +// Texture Object APIs +hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, + const hipResourceDesc* pResDesc, + const hipTextureDesc* pTexDesc, + const hipResourceViewDesc* pResViewDesc) +{ + HIP_INIT_API(pTexObject, pResDesc, pTexDesc, pResViewDesc); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hc::accelerator acc = ctx->getDevice()->_acc; + auto device = ctx->getWriteableDevice(); + + hsa_agent_t* agent =static_cast(acc.get_hsa_agent()); + + hipTexture* pTexture = (hipTexture*) malloc(sizeof(hipTexture)); + if (pTexture != nullptr) { + memset(pTexture, 0, sizeof(hipTexture)); + saveTextureInfo(pTexture, pResDesc, pTexDesc, pResViewDesc); + } + + hsa_ext_image_descriptor_t imageDescriptor; + hsa_ext_image_channel_order_t channelOrder; + hsa_ext_image_channel_type_t channelType; + void* devPtr = nullptr; + + switch (pResDesc->resType) { + case hipResourceTypeArray: + devPtr = pResDesc->res.array.array->data; + imageDescriptor.width = pResDesc->res.array.array->width; + imageDescriptor.height = pResDesc->res.array.array->height; + switch (pResDesc->res.array.array->type) { + case hipArrayLayered: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2DA; + imageDescriptor.depth = 0; + imageDescriptor.array_size = pResDesc->res.array.array->depth; + break; + case hipArrayCubemap: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_3D; + imageDescriptor.depth = pResDesc->res.array.array->depth; + imageDescriptor.array_size = 0; + break; + case hipArraySurfaceLoadStore: + case hipArrayTextureGather: + case hipArrayDefault: + default: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2D; + imageDescriptor.depth = 0; + imageDescriptor.array_size = 0; + break; + } + getChannelOrderAndType(pResDesc->res.array.array->desc, pTexDesc->readMode, channelOrder, channelType); + break; + case hipResourceTypeMipmappedArray: + devPtr = pResDesc->res.mipmap.mipmap->data; + imageDescriptor.width = pResDesc->res.mipmap.mipmap->width; + imageDescriptor.height = pResDesc->res.mipmap.mipmap->height; + imageDescriptor.depth = pResDesc->res.mipmap.mipmap->depth; + imageDescriptor.array_size = 0; + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2D; + getChannelOrderAndType(pResDesc->res.mipmap.mipmap->desc, pTexDesc->readMode, channelOrder, channelType); + break; + case hipResourceTypeLinear: + devPtr = pResDesc->res.linear.devPtr; + imageDescriptor.width = pResDesc->res.linear.sizeInBytes; + imageDescriptor.height = 1; + imageDescriptor.depth = 0; + imageDescriptor.array_size = 0; + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_1D; // ? HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR + getChannelOrderAndType(pResDesc->res.linear.desc, pTexDesc->readMode, channelOrder, channelType); + break; + case hipResourceTypePitch2D: + devPtr = pResDesc->res.pitch2D.devPtr; + imageDescriptor.width = pResDesc->res.pitch2D.width; + imageDescriptor.height = pResDesc->res.pitch2D.height; + imageDescriptor.depth = 0; + imageDescriptor.array_size = 0; + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2D; + getChannelOrderAndType(pResDesc->res.pitch2D.desc, pTexDesc->readMode, channelOrder, channelType); + break; + default: + break; + } + + imageDescriptor.format.channel_order = channelOrder; + imageDescriptor.format.channel_type = channelType; + + hsa_ext_sampler_descriptor_t samplerDescriptor; + fillSamplerDescriptor(samplerDescriptor, pTexDesc->addressMode[0], pTexDesc->filterMode, pTexDesc->normalizedCoords); + + hsa_access_permission_t permission = HSA_ACCESS_PERMISSION_RW; + if (HSA_STATUS_SUCCESS != hsa_ext_image_create(*agent, &imageDescriptor, devPtr, permission, &(pTexture->image)) || + HSA_STATUS_SUCCESS != hsa_ext_sampler_create(*agent, &samplerDescriptor, &(pTexture->sampler))) { + return ihipLogStatus(hipErrorRuntimeOther); + } + + getHipTextureObject(pTexObject, pTexture->image, pTexture->sampler); + + textureHash[*pTexObject] = pTexture; + } + + return ihipLogStatus(hip_status); +} + +hipError_t hipDestroyTextureObject(hipTextureObject_t textureObject) +{ + HIP_INIT_API(textureObject); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hc::accelerator acc = ctx->getDevice()->_acc; + auto device = ctx->getWriteableDevice(); + + hsa_agent_t* agent =static_cast(acc.get_hsa_agent()); + + hipTexture* pTexture = textureHash[textureObject]; + if (pTexture != nullptr) { + hsa_ext_image_destroy(*agent, pTexture->image); + hsa_ext_sampler_destroy(*agent, pTexture->sampler); + free(pTexture); + textureHash.erase(textureObject); + } + } + return ihipLogStatus(hip_status); +} + +hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDesc, hipTextureObject_t textureObject) +{ + HIP_INIT_API(pResDesc, textureObject); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hipTexture* pTexture = textureHash[textureObject]; + if (pTexture != nullptr && pResDesc != nullptr) { + memcpy((void*)pResDesc, (void*)&(pTexture->resDesc), sizeof(hipResourceDesc)); + } + } + return ihipLogStatus(hip_status); +} + +hipError_t hipGetTextureObjectResourceViewDesc(hipResourceViewDesc* pResViewDesc, hipTextureObject_t textureObject) +{ + HIP_INIT_API(pResViewDesc, textureObject); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hipTexture* pTexture = textureHash[textureObject]; + if (pTexture != nullptr && pResViewDesc != nullptr) { + memcpy((void*)pResViewDesc, (void*)&(pTexture->resViewDesc), sizeof(hipResourceViewDesc)); + } + } + return ihipLogStatus(hip_status); +} + +hipError_t hipGetTextureObjectTextureDesc(hipTextureDesc* pTexDesc, hipTextureObject_t textureObject) +{ + HIP_INIT_API(pTexDesc, textureObject); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hipTexture* pTexture = textureHash[textureObject]; + if (pTexture != nullptr && pTexDesc != nullptr) { + memcpy((void*)pTexDesc, (void*)&(pTexture->texDesc), sizeof(hipTextureDesc)); + } + } + return ihipLogStatus(hip_status); +} + +// Texture Reference APIs +hipError_t ihipBindTextureImpl(int dim, + enum hipTextureReadMode readMode, + size_t *offset, + const void *devPtr, + const struct hipChannelFormatDesc& desc, + size_t size, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords, + hipTextureObject_t& textureObject) +{ + HIP_INIT_API(); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hc::accelerator acc = ctx->getDevice()->_acc; + auto device = ctx->getWriteableDevice(); + + hsa_agent_t* agent =static_cast(acc.get_hsa_agent()); + + hipTexture* pTexture = (hipTexture*) malloc(sizeof(hipTexture)); + if (pTexture != nullptr) { + memset(pTexture, 0, sizeof(hipTexture)); + } + + hsa_ext_image_descriptor_t imageDescriptor; + + assert(dim == hipTextureType1D); + + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_1D; + imageDescriptor.width = size; + imageDescriptor.height = 1; + imageDescriptor.depth = 1; + imageDescriptor.array_size = 0; + + hsa_ext_image_channel_order_t channelOrder; + hsa_ext_image_channel_type_t channelType; + getChannelOrderAndType(desc, readMode, channelOrder, channelType); + imageDescriptor.format.channel_order = channelOrder; + imageDescriptor.format.channel_type = channelType; + + hsa_ext_sampler_descriptor_t samplerDescriptor; + fillSamplerDescriptor(samplerDescriptor, addressMode, filterMode, normalizedCoords); + + hsa_access_permission_t permission = HSA_ACCESS_PERMISSION_RW; + + if (HSA_STATUS_SUCCESS != hsa_ext_image_create(*agent, &imageDescriptor, devPtr, permission, &(pTexture->image)) || + HSA_STATUS_SUCCESS != hsa_ext_sampler_create(*agent, &samplerDescriptor, &(pTexture->sampler))) { + return ihipLogStatus(hipErrorRuntimeOther); + } + getHipTextureObject(&textureObject, pTexture->image, pTexture->sampler); + textureHash[textureObject] = pTexture; + } + + return ihipLogStatus(hip_status); +} + +hipError_t hipBindTexture(size_t* offset, + textureReference* tex, + const void* devPtr, + const hipChannelFormatDesc* desc, + size_t size) +{ + // TODO: hipReadModeElementType is default. + return ihipBindTextureImpl(hipTextureType1D, hipReadModeElementType, + offset, devPtr, *desc, size, + tex->addressMode[0], tex->filterMode, tex->normalized, + tex->textureObject); +} + +hipError_t ihipBindTexture2DImpl(int dim, + enum hipTextureReadMode readMode, + size_t *offset, + const void *devPtr, + const struct hipChannelFormatDesc& desc, + size_t width, + size_t height, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords, + hipTextureObject_t& textureObject) +{ + HIP_INIT_API(); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hc::accelerator acc = ctx->getDevice()->_acc; + auto device = ctx->getWriteableDevice(); + + hsa_agent_t* agent =static_cast(acc.get_hsa_agent()); + + hipTexture* pTexture = (hipTexture*) malloc(sizeof(hipTexture)); + if (pTexture != nullptr) { + memset(pTexture, 0, sizeof(hipTexture)); + } + + hsa_ext_image_descriptor_t imageDescriptor; + + assert(dim == hipTextureType2D); + + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2D; + imageDescriptor.width = width; + imageDescriptor.height = height; + imageDescriptor.depth = 1; + imageDescriptor.array_size = 0; + + hsa_ext_image_channel_order_t channelOrder; + hsa_ext_image_channel_type_t channelType; + getChannelOrderAndType(desc, readMode, channelOrder, channelType); + imageDescriptor.format.channel_order = channelOrder; + imageDescriptor.format.channel_type = channelType; + + hsa_ext_sampler_descriptor_t samplerDescriptor; + fillSamplerDescriptor(samplerDescriptor, addressMode, filterMode, normalizedCoords); + + hsa_access_permission_t permission = HSA_ACCESS_PERMISSION_RW; + + if (HSA_STATUS_SUCCESS != hsa_ext_image_create(*agent, &imageDescriptor, devPtr, permission, &(pTexture->image)) || + HSA_STATUS_SUCCESS != hsa_ext_sampler_create(*agent, &samplerDescriptor, &(pTexture->sampler))) { + return ihipLogStatus(hipErrorRuntimeOther); + } + getHipTextureObject(&textureObject, pTexture->image, pTexture->sampler); + textureHash[textureObject] = pTexture; + } + + return ihipLogStatus(hip_status); +} + +hipError_t hipBindTexture2D(size_t* offset, + textureReference* tex, + const void* devPtr, + const hipChannelFormatDesc* desc, + size_t width, + size_t height, + size_t pitch) +{ + // TODO: hipReadModeElementType is default. + return ihipBindTexture2DImpl(hipTextureType2D, hipReadModeElementType, + offset, devPtr, *desc, width, height, + tex->addressMode[0], tex->filterMode, tex->normalized, + tex->textureObject); +} + +hipError_t ihipBindTextureToArrayImpl(int dim, + enum hipTextureReadMode readMode, + hipArray_const_t array, + const struct hipChannelFormatDesc& desc, + enum hipTextureAddressMode addressMode, + enum hipTextureFilterMode filterMode, + int normalizedCoords, + hipTextureObject_t& textureObject) +{ + HIP_INIT_API(); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hc::accelerator acc = ctx->getDevice()->_acc; + auto device = ctx->getWriteableDevice(); + + hsa_agent_t* agent =static_cast(acc.get_hsa_agent()); + + hipTexture* pTexture = (hipTexture*) malloc(sizeof(hipTexture)); + if (pTexture != nullptr) { + memset(pTexture, 0, sizeof(hipTexture)); + } + + hsa_ext_image_descriptor_t imageDescriptor; + + imageDescriptor.width = array->width; + imageDescriptor.height = array->height; + imageDescriptor.depth = array->depth; + imageDescriptor.array_size = 0; + + switch (dim) { + case hipTextureType1D: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_1D; + imageDescriptor.height = 1; + imageDescriptor.depth = 1; + break; + case hipTextureType2D: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2D; + imageDescriptor.depth = 1; + break; + case hipTextureType3D: + case hipTextureTypeCubemap: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_3D; + break; + case hipTextureType1DLayered: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_1DA; + imageDescriptor.height = 1; + imageDescriptor.array_size = array->height; + break; + case hipTextureType2DLayered: + imageDescriptor.geometry = HSA_EXT_IMAGE_GEOMETRY_2DA; + imageDescriptor.depth = 1; + imageDescriptor.array_size = array->depth; + break; + case hipTextureTypeCubemapLayered: + default: + break; + } + + hsa_ext_image_channel_order_t channelOrder; + hsa_ext_image_channel_type_t channelType; + getChannelOrderAndType(desc, readMode, channelOrder, channelType); + imageDescriptor.format.channel_order = channelOrder; + imageDescriptor.format.channel_type = channelType; + + hsa_ext_sampler_descriptor_t samplerDescriptor; + fillSamplerDescriptor(samplerDescriptor, addressMode, filterMode, normalizedCoords); + + hsa_access_permission_t permission = HSA_ACCESS_PERMISSION_RW; + + if (HSA_STATUS_SUCCESS != hsa_ext_image_create(*agent, &imageDescriptor, array->data, permission, &(pTexture->image)) || + HSA_STATUS_SUCCESS != hsa_ext_sampler_create(*agent, &samplerDescriptor, &(pTexture->sampler))) { + return ihipLogStatus(hipErrorRuntimeOther); + } + getHipTextureObject(&textureObject, pTexture->image, pTexture->sampler); + textureHash[textureObject] = pTexture; + } + + return ihipLogStatus(hip_status); +} + +hipError_t hipBindTextureToArray(textureReference* tex, + hipArray_const_t array, + const hipChannelFormatDesc* desc) +{ + // TODO: hipReadModeElementType is default. + return ihipBindTextureToArrayImpl(hipTextureType2D, hipReadModeElementType, + array, *desc, + tex->addressMode[0], tex->filterMode, tex->normalized, + tex->textureObject); +} + +hipError_t hipBindTextureToMipmappedArray(textureReference* tex, + hipMipmappedArray_const_t mipmappedArray, + const hipChannelFormatDesc* desc) +{ + return hipSuccess; +} + +hipError_t ihipUnbindTextureImpl(const hipTextureObject_t& textureObject) +{ + HIP_INIT_API(); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + hc::accelerator acc = ctx->getDevice()->_acc; + auto device = ctx->getWriteableDevice(); + + hsa_agent_t* agent =static_cast(acc.get_hsa_agent()); + + hipTexture* pTexture = textureHash[textureObject]; + if (pTexture != nullptr) { + hsa_ext_image_destroy(*agent, pTexture->image); + hsa_ext_sampler_destroy(*agent, pTexture->sampler); + free(pTexture); + textureHash.erase(textureObject); + } + } + + return ihipLogStatus(hip_status); +} + +hipError_t hipUnbindTexture(const textureReference* tex) +{ + return ihipUnbindTextureImpl(tex->textureObject); +} + +hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array) +{ + HIP_INIT_API(desc, array); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + *desc = array->desc; + } + return ihipLogStatus(hip_status); +} + +hipError_t hipGetTextureAlignmentOffset(size_t* offset, const textureReference* tex) +{ + HIP_INIT_API(offset, tex); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + } + return ihipLogStatus(hip_status); +} + +hipError_t hipGetTextureReference(const textureReference** tex, const void* symbol) +{ + HIP_INIT_API(tex, symbol); + HIP_SET_DEVICE(); + + hipError_t hip_status = hipSuccess; + + auto ctx = ihipGetTlsDefaultCtx(); + if (ctx) { + } + return ihipLogStatus(hip_status); +} diff --git a/include/hip/nvcc_detail/hip_texture.h b/src/hip_texture.h similarity index 78% rename from include/hip/nvcc_detail/hip_texture.h rename to src/hip_texture.h index c669d62192..365a02e103 100644 --- a/include/hip/nvcc_detail/hip_texture.h +++ b/src/hip_texture.h @@ -20,9 +20,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_TEXTURE_H -#define HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_TEXTURE_H +#ifndef HIP_INCLUDE_HCC_DETAIL_HIP_TEXTURE_H +#define HIP_INCLUDE_HCC_DETAIL_HIP_TEXTURE_H -#include +#include + +struct hipTexture { + hipResourceDesc resDesc; + hipTextureDesc texDesc; + hipResourceViewDesc resViewDesc; + hsa_ext_image_t image; + hsa_ext_sampler_t sampler; +}; #endif diff --git a/tests/src/test_common.h b/tests/src/test_common.h index f585fb8bca..e3cc664d56 100644 --- a/tests/src/test_common.h +++ b/tests/src/test_common.h @@ -23,7 +23,7 @@ THE SOFTWARE. #include #include "hip/hip_runtime.h" -#include "hip/hip_texture.h" +#include "hip/hip_texture_types.h" #include "hip/hip_runtime_api.h" #define HC __attribute__((hc))