4 Replies Latest reply on Dec 13, 2008 5:36 PM by gaurav.garg

    D3D9 interoperability extension

    lpw

      Hi,

      What is the status of the D3D9 interoperability extension? As mentioned in another thread, I'm hoping to use this extension to run occlusion queries on CAL kernels.

      I tried the calD3D9Associate function, but this results in epic Fail. Calling the function promptly reboots my computer. A short program that reproduces the problem is included below.

      I am using DXUT to create the device, perhaps that's the problem? If so, could someone post the parameters I should use to create the device manually? A short working program would be great.

      Perhaps the problem is that I'm using a Radeon HD 3870 X2, which is exposed as two CAL devices yet a single D3D9 adapter? Still, a system reboot seems rather drastic.

      My system:

      - Radeon HD 3870 X2

      - XP Pro (32 bit)

      - CAL 1.2.0 beta

      - DirectX 9c (February 2007)

      - Tried Catalyst 8.6, 8.8, and 8.9 with same results

      The code:

      #include "DXUT/Core/DXUT.h"
      #include <cal_ext.h>
      #include <cal_ext_d3d9.h>


      HRESULT WINAPI OnD3D9DeviceCreated(IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext);

      LPDIRECT3DDEVICE9 g_pd3dDevice = 0;


      int main()
      {
      //
      // CAL setup
      //
      if (calInit() != CAL_RESULT_OK) {
      fprintf(stderr, "Failed to initialize CAL\n");
      exit(1);
      }
      if (calExtSupported(CAL_EXT_D3D9) != CAL_RESULT_OK) {
      fprintf(stderr, "CAL_EXT_D3D9 not supported\n");
      exit(1);
      }
      CALdevice dev = 0;
      if (calDeviceOpen(&dev, 0) != CAL_RESULT_OK) {
      fprintf(stderr, "Failed to open CAL device 0\n");
      exit(1);
      }

      //
      // DX setup
      //
      DXUTSetCallbackD3D9DeviceCreated(OnD3D9DeviceCreated);
      if (FAILED(DXUTInit(true, true, 0, true))) {
      fprintf(stderr, "Failed to initialize DXUT\n");
      exit(1);
      }
      if (FAILED(DXUTCreateWindow(L"Bogus D3D Window"))) {
      fprintf(stderr, "Failed to create window\n");
      exit(1);
      }
      if (FAILED(DXUTCreateDevice())) {
      fprintf(stderr, "Failed to create device\n");
      exit(1);
      }
      if (!g_pd3dDevice) {
      fprintf(stderr, "No d3d9 device\n");
      exit(1);
      }

      //
      // Associate
      //
      PFNCALD3D9ASSOCIATE pfnCalD3D9Associate = 0;
      if (calExtGetProc((CALextproc*)&pfnCalD3D9Associate, CAL_EXT_D3D9, "calD3D9Associate") != CAL_RESULT_OK) {
      fprintf(stderr, "Failed to obtain pointer to calD3D9Associate\n");
      exit(1);
      }
      if (!pfnCalD3D9Associate) {
      fprintf(stderr, "No calD3D9Associate\n");
      exit(1);
      }
      printf("calD3D9Associate lives at 0x%p\n", pfnCalD3D9Associate); // OK
      if (pfnCalD3D9Associate(dev, g_pd3dDevice) != CAL_RESULT_OK) {
      fprintf(stderr, "Failed to associate devices\n");
      exit(1);
      }
      printf("I'm alive\n"); // never get here
      }


      HRESULT WINAPI OnD3D9DeviceCreated(IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
      {
      g_pd3dDevice = pd3dDevice;
      return S_OK;
      }

        • D3D9 interoperability extension
          lpw

          The functions calD3D9MapTexture and calD3D9MapSurface fail with CAL_RESULT_ERROR.  Again, I suspect that this might be because I'm using an X2 card which D3D sees as a single adapter.  Can anyone confirm this?  Can anyone confirm that this extension works on a single-core card?

          Could we have an example or explanation of how to properly use this extension before the next release of the SDK?  Seems like a long time to wait for something that should be working already.

          EDIT: I realize now that the resource mapping functions fail because the devices are not associated (calD3D9Associate still reboots the machine, so I thought I would try without it).  Still, I'd like to know whether this extension should work on an X2 card or a single-core card only.

            • D3D9 interoperability extension
              AM2901

              I have the same Problem.

              "calD3D9Associate" returns the Error CAL_RESULT_ERROR, but my System doesn't crash.

              My Config:

              - Radeon HD 4850 1GB

              - XP Pro (32 bit)

              - CAL 1.2.1 beta

              - DirectX 9c (August 2008)

              - Catalyst 8.9

               

              The D3DDevice is a normal Window with 1 Backbuffer. Normal D3D rendering works fine. I don't use DXUT.

              I'm trying to write a Kernel who directly writes to the Backbuffer of the Window and using "m_D3DDevice->Present (...)" to display it's contents.

              Has anyone done that ?