1 Reply Latest reply on Apr 3, 2011 5:59 PM by Gunter

    CAL <-> Direct3D9 Interop

    Gunter

      Hi,

      I wanted to have my GPU kernel write directly into the backbuffer of my Direct3D9 device. However, calD3D9MapSurface() needs a "shareHandle". I don't know where I should get this handle from. The backbuffer/frontbuffer flip chain is created implicitly, so I can only get the pointer to the surface.

      Any help?

      Thx

        • CAL <-> Direct3D9 Interop
          Gunter

          So here is my current answer to this.

          I couldn't find a way to make the backbuffer accessible. Instead, I created a render target of the same dimensions as the screen, made it available to CAL as shown in the Programming Guide, executed my kernel, copied it to the backbuffer, and flipped it to the screen using Present().

          Certainly not the most efficient way, but there are a number of restrictions hard to come by.

          In order to share a D3D9 surface with a CAL-kernel, it apparently needs to have the format D3DFMT_A32B32G32R32F. The CAL-kernel uses this resource then as if it was CAL_FORMAT_FLOAT32_4.

          Pixel values need to be in the range 0.0 ... 1.0. They are converted to 8-bit unsigned ints automatically during the copy orperation via StretchRect().

          If somebody knows a better way please post.