CUDA and Direct3D interoperability in WPF applications -


I try to understand WPF applications using CUDA calculations and Direct 3D 9 graphics. Therefore, I use the following approach:

  1. I am creating a WPF application using
  2. then I
  3. Make DLL, it sees a rotating triangle. / Li>
  4. Then I try to understand Direct 3D 9 Interpop according to section 3.2.11.2 of "NVIDIA CUDA C Programming Guide". But the cudaGraphicsD3D9RegisterResource function returns the error

    I declare the CUDA graphics processing variable in the classroom.

      once square CTriangleRenderer #pragma: public CRenderer {public: Create static HRESULT (IDirect3D9 * pD3D, IDirect3D9Ex * pD3DEx, Acdblyuenac Acdbludi, Uaianti Yuedaptr, Kraderr ** PP renderer); ~ CTriangleRenderer (); HRESULT render (); Protected: HRESULT Init (IDirect3D9 * pD3D, IDirect3D9Ex * pD3DEx, HwnHhwd, UINT UADApplatform); Private: CTRiangleRenderer (); IDirect3DVertexBuffer9 * m_pd3dVB; Structure cudaGraphicsResource * posts VB_CUDA; };   

    cudaGraphicsD3D9RegisterResource function call is a member of the class:

      HRESULT CTriangleRenderer :: Init (IDirect3D9 * pD3D, IDirect3D9Ex * pD3DEx , HWNH HWD, UINT UADApplication) {HRSULT HR = S_OK; D3XMTRIXA 16 Matwiew, Matrage; D3DXVECTOR3 vEyePt (0.0 F, 0.0F, -5.0F); D3DXVECTOR3 vLookatPt (0.0 F, 0.0F, 0.0F); D3DXVECTOR3 vUpVec (0.0 F, 1.0 F, 0.0F); // Call Base and Target IFC (Cenderer :: Init (PD3D, PD3DEX, HWND, UADaptor) to create the device); // VB CUSTOMVERTEX corner set [] = {{-1.0f, -1.0f, 0.0f, 0xffff0000,}, // x, y, z, color {1.0f, -1.0f, 0.0f, 0xff00ff00,} , {0.0f, 1.0f, 0.0f, 0xff00ffff,}}}; IFC (m_pd3dDevice- & gt; CreateVertexBuffer (sizeof (corner), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, & amp; m_pd3dVB, null)); CudaGraphicsD3D9 Registrar Resources (and Status VB_CUDA, M_PD3 DVB, cudaGraphicsRegisterFlagsNone); CutilCheckMsg ("cudaGraphicsD3D9 registrar processing failed"); CudaGraphicsResourceSetMapFlags (Conditions VB_CUDA, cudaGraphicsMapFlagsWriteDiscard); Zero * Pewerties; IFC (M_PD3 DVB-> Lock (0, Size (meridian), and Pyrattice, 0)); Mempi (pewarts, shiroviz, sizaf (corks)); M_pd3dVB-> Unlock (); // Set Camera D3DXMatrixLookAtLH (& Mattview, & amp; vEyePt, & amp; vLookatPt, & amp; vUpVec); IFC (M_PD3DDevice-> Set Transforms (D3 DTS_Us, and MattView)); D3DXMatrixPerspectiveFovLH (and MassProject, D3dxIPI / 4, 1.0F, 1.0F, 100.0F); IFC (M_PD3DDevice-> Settansform (D3 DTSOGGation, and MassProj)); // Set global state IFC (m_pd3dDevice-> SetterState (D3DRSCULMODE, D3DCULL_NON)); IFC (M_PD3DDevice-> Sectorender State (D3RS_Lighting, Fails); IFC (m_pd3dDevice-> Settream Source (0, M_PD3 DVB, 0, CUSTOMVERTEX)); IFC (m_pd3dDevice-> SetFVF (D3DFVF_CUSTOMVERTEX)); Cleanup: Returns HR; }   

    positionsVB_CUDA variable value before 0xcdcdcdcd cudaGraphicsD3D9RegisterResource and after the same value.

    Is my error? Example of Direct 3D 9 Interop from Cidda SDK works fine My configuration:

    • NVIDIA GTX 260 800 MB
    • NVIDIA GTX 460 2 GB
    • CUDA 4.0
    • Windows 7 64-bit
    • 8 GB RAM
    • Visual Studio 2010

      CUDA has specific requirements for VB types that can be binding (I do not think you can lock / unlock the CPU which is bound to CUDA). If you want to fix the lock / unlock: DirectX Turn on error logging and through the DirectX Control Panel DirectX debug DLLs (searches DirectX folder in the Startup menu (you must have DirectX SDK). This DirectX Will enable debug logs for that which are very useful and informative when checking for DirectX errors (This logs in the visual studio in the output window). You are trying to lock an unlockable VB (if you want it to be readable from the CPU, there are specific requirements for starting VB).

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -