Texture
So, as we discussed in comments, you can work with 2D textures:
concurrency::graphics::texture<float_4, 2> tex(1920, 1200);
Device, then accelerator
Then, to proceed with DirectX 11, you must have ID3D11Device
and ID3D11DeviceContext
. It is better to create ID3D11Device
and ID3D11DeviceContext
by hand, and then create accelerator_view
object based on your device. Example code from Julia2D sample:
accelerator_view av=concurrency::direct3d::create_accelerator_view(g_pd3dDevice);
texture<unorm4, 2> tex = make_texture<unorm4, 2>(av, pTexture);
Accelerator, then device
Alternatively, you can get pointers to ID3D11Device
and ID3D11DeviceContext
from your existingaccelerator_view
object:
you use
concurrency::direct3d::get_device()
function:IUnknown* unknown = concurrency::direct3d::get_device(accelerator);
on returned
IUnknown
object, you callIUnknown::QueryInterface
to cast it toID3D11Device
ID3D11Device* device = 0; unknown->QueryInterface(__uuidof(ID3D11Device), &device));
then you get
ID3D11DeviceContext
callingID3D11Device::GetImmediateContext
:ID3D11DeviceContext* context = 0; device->GetImmediateContext(context);
Finally, rendering
With ID3D11Device
and ID3D11DeviceContext
you can proceed to rendering (example with DirectXTK):
SpriteBatch* spriteBatch(new SpriteBatch(context));
spriteBatch->Begin();
spriteBatch->Draw(texture, XMFLOAT2(x, y));
spriteBatch->End();
Also, I've found this two samples involved C++Amp/DirectX interop, that can be useful for you: one, two.
Hope, it helps.