[C++ AMP] Texture significant dimension RRS feed

  • Question

  • Hello,

    1) Why is a 2D texture's most significant dimension height when C++ AMP is row major? Is this different from DirectCompute?

    2) Is there any way to create a texture from an array view section? I have a large image in memory that is too big to fit into video memory so I am hoping to avoid creating and copying temp tile arrays onto textures.

    Nice work on the API so far!

    Monday, June 11, 2012 11:19 AM


  • Hi Bruce,

    Thanks for trying C++ AMP.

    For the first question, the dimesnionality of C++ AMP texture is the same as C++ AMP array.  In case of 2D,  the most significant dimension is height (# of rows), the least significant dimension is width (# of columns). So it's indeed "row major".  However, unlike array, texture’s subscript operator and function call operators do not return a reference, but return a value. That is, there is no pointer/reference to the interior of a texture. In this sense, the implementation underlying has its freedom on data layout. Microsoft's implementation is using D3D11 texture underlying. In case of 2D, the most significant dimesnion matches ID3D11Texture2D's height, and the least significant dimension matches ID3D11Texture2D's width.

    For the second question, you can get a pointer to the array_view section, then use the texture copy API to copy the data into texture. However, the copy API assumes the pointer points to continous data. Only array_view<T, 1> can guarantee this.  Thus this solution only applies to rank-1 array_view.



    Monday, June 11, 2012 5:19 PM