Resource sharing between directx9 and directx11
-
יום שני 02 אפריל 2012 05:55
hi
I am using dX11 to create a texture and then share it with a dX9 device.
I am using this code.
//directx-11 creating the shared resource..
HANDLE SharedHandle = NULL;
D3D11_TEXTURE2D_DESC desc;
desc.Width = 512;
desc.Height = 512;
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT ;
desc.Usage = D3D11_USAGE_DEFAULT ;
desc.BindFlags = D3D11_BIND_RENDER_TARGET;
desc.CPUAccessFlags = 0;
desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
desc.SampleDesc.Count = 1;
desc.ArraySize = 1;
desc.SampleDesc.Quality = 0 ;
HRESULT hr = dev11->CreateTexture2D(&desc, NULL, &pTextureToShare);
//getting the resource handle
IDXGIResource* pTempResource(NULL);
hr = pTextureToShare->QueryInterface( __uuidof(IDXGIResource), (void**)&pTempResource );
hr = pTempResource->GetSharedHandle(&SharedHandle);
//directx-9 using the shared resource..
hr = dev9->CreateTexture(512
, 512
, 1
, D3DUSAGE_RENDERTARGET
, D3DFMT_A16B16G16R16F
,D3DPOOL_DEFAULT
,&pSharedTexture9
,&SharedHandle);how i am getting this error in dev9->CreateTexture(...)
Direct3D9: (ERROR) :Opened and created resources don't match, unable to open the shared resource.
please help me.
thanks.
כל התגובות
-
יום שני 02 אפריל 2012 06:08בעלים
Hi crazy_crab, please find an appropriate DirectX forum for your question, this forum is not for DirectX questions:
http://www.bing.com/search?q=directx+forum
http://www.danielmoth.com/Blog/
- הוצע כתשובה על-ידי Zhu, Weirong יום שני 02 אפריל 2012 16:02
- סומן כתשובה על-ידי DanielMothMicrosoft Employee, Owner יום שישי 06 אפריל 2012 07:46