I have a concurrency::array (C++ AMP) of colors on device holding colors for each pixel.
I would like to feed this array to Direct3D so it would be used as a buffer to display in a window without having to copy the data to the host.
I also tried using concurrency::direct3d::make_array, which associates an ID3D11Buffer with an accelerator_view, but I don't know how to then take this array and feed it to the Direct3D as the source of an image displayed in a window.
Alternatively, I could convert this data into a texture.
So the basic question is: Given a chunk of color information for each pixel located on a device, how to feed them to Direct3D to be used as a screen buffer of sorts? (This chunk just happens to be computed by C++ AMP.)
Texture
So, as we discussed in comments, you can work with 2D textures:
Device, then accelerator
Then, to proceed with DirectX 11, you must have
ID3D11DeviceandID3D11DeviceContext. It is better to createID3D11DeviceandID3D11DeviceContextby hand, and then createaccelerator_viewobject based on your device. Example code from Julia2D sample:Accelerator, then device
Alternatively, you can get pointers to
ID3D11DeviceandID3D11DeviceContextfrom your existingaccelerator_viewobject:you use
concurrency::direct3d::get_device()function:on returned
IUnknownobject, you callIUnknown::QueryInterfaceto cast it toID3D11Devicethen you get
ID3D11DeviceContextcallingID3D11Device::GetImmediateContext:Finally, rendering
With
ID3D11DeviceandID3D11DeviceContextyou can proceed to rendering (example with DirectXTK):Also, I've found this two samples involved C++Amp/DirectX interop, that can be useful for you: one, two.
Hope, it helps.