# cuTexObjectCreate return  CUDA\_ERROR\_INVALID\_VALUE

**URL:** <https://forums.developer.nvidia.com/t/cutexobjectcreate-return-cuda-error-invalid-value/32291>\
**Category:** CUDA Programming and Performance\
**Created:** [February 17, 2014, 11:27am UTC](https://forums.developer.nvidia.com/t/cutexobjectcreate-return-cuda-error-invalid-value/32291 "2014-02-17T11:27:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OutMan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@OutMan](https://forums.developer.nvidia.com/u/OutMan)\
**Post date:** [February 17, 2014, 11:27am UTC](https://forums.developer.nvidia.com/t/cutexobjectcreate-return-cuda-error-invalid-value/32291/1 "2014-02-17T11:27:12Z")

</div>

```auto
CUresult cr = CUDA_SUCCESS;

	CUDA_ARRAY3D_DESCRIPTOR desc3D;
	desc3D.Format = CU_AD_FORMAT_SIGNED_INT16;
	desc3D.Width = m_amVolHeader.width;
	desc3D.Height = m_amVolHeader.height;
	desc3D.Depth = m_amVolHeader.depth;
	desc3D.NumChannels = 1;
	desc3D.Flags = 0;

	cr = cuArray3DCreate( &m_cuArray, &desc3D );

	CUDA_MEMCPY3D mem3D;
	memset( &mem3D, 0, sizeof(CUDA_MEMCPY3D) );
	mem3D.dstMemoryType	= CU_MEMORYTYPE_ARRAY;
	mem3D.dstArray = m_cuArray;
	mem3D.dstXInBytes	= desc3D.Width * sizeof( int16_t );
	mem3D.dstY = desc3D.Height;
	mem3D.dstZ = desc3D.Depth;
	mem3D.srcMemoryType	= CU_MEMORYTYPE_HOST;
	mem3D.srcHost = m_amVolData;
	mem3D.srcPitch = desc3D.Width * desc3D.Depth * sizeof( int16_t );
	mem3D.srcHeight = desc3D.Height;
 	mem3D.srcXInBytes	= desc3D.Width * sizeof( int16_t );
 	mem3D.srcY = desc3D.Height;
 	mem3D.srcZ = desc3D.Depth;
	cr = cuMemcpy3D( &mem3D );

	CUDA_RESOURCE_DESC descRes;
	descRes.resType	= CU_RESOURCE_TYPE_ARRAY;
	descRes.res.array.hArray = m_cuArray;
	descRes.flags = 0;

	CUDA_TEXTURE_DESC descTex;
	descTex.addressMode[0] = CU_TR_ADDRESS_MODE_CLAMP;
	descTex.addressMode[1] = CU_TR_ADDRESS_MODE_CLAMP;
	descTex.addressMode[2] = CU_TR_ADDRESS_MODE_CLAMP;
	descTex.filterMode = CU_TR_FILTER_MODE_LINEAR;
	descTex.flags = CU_TRSF_READ_AS_INTEGER | CU_TRSF_NORMALIZED_COORDINATES;
	descTex.maxAnisotropy = 1;
	descTex.mipmapFilterMode	= CU_TR_FILTER_MODE_LINEAR;
	descTex.mipmapLevelBias = 0;
	descTex.minMipmapLevelClamp	= 0;
	descTex.maxMipmapLevelClamp	= 0;

	CUDA_RESOURCE_VIEW_DESC	descView;
	descView.format = CU_RES_VIEW_FORMAT_SINT_1X16;
	descView.width = desc3D.Width;
	descView.height = desc3D.Height;
	descView.depth = desc3D.Depth;
	descView.firstMipmapLevel	= 0;
	descView.lastMipmapLevel	= 0;
	descView.firstLayer = 0;
	descView.lastLayer = 0;

	cr = cuTexObjectCreate( &m_cuTex, &descRes, &descTex, &descView );

```

tip tip please

---

<div class="post-metadata">

**Author:** ![OutMan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@OutMan](https://forums.developer.nvidia.com/u/OutMan)\
**Post date:** [February 18, 2014, 7:02am UTC](https://forums.developer.nvidia.com/t/cutexobjectcreate-return-cuda-error-invalid-value/32291/2 "2014-02-18T07:02:32Z")

</div>

ok i correct it with unbelievable reason  
in DESC there is a param called ‘reserved’ which should be set to 0

---

<div class="post-metadata">

**Author:** ![OutMan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@OutMan](https://forums.developer.nvidia.com/u/OutMan)\
**Post date:** [February 18, 2014, 7:02am UTC](https://forums.developer.nvidia.com/t/cutexobjectcreate-return-cuda-error-invalid-value/32291/3 "2014-02-18T07:02:38Z")

</div>

ok i correct it with unbelievable reason  
in DESC there is a param called ‘reserved’ which should be set to 0

---

<div class="post-metadata">

**Author:** ![OutMan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@OutMan](https://forums.developer.nvidia.com/u/OutMan)\
**Post date:** [February 18, 2014, 7:05am UTC](https://forums.developer.nvidia.com/t/cutexobjectcreate-return-cuda-error-invalid-value/32291/4 "2014-02-18T07:05:03Z")

</div>

i also found this website is not well support by leibao explorer
