XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

CopySubresourceRegion between structured buffers

Last post 9/12/2009 2:10 PM by Seth H. 2 replies.
  • 9/9/2009 2:24 AM

    CopySubresourceRegion between structured buffers

    I'm trying to copy part of one structured buffer into part of another structured buffer.  The buffers are described by different structure types.

    D3D11_BOX srcbox = {sizeof(FLOAT), 0, 0, sizeof(FLOAT) + sizeof(UINT), 1, 1};
    g_pd3dDC->CopySubresourceRegion(drawing.buf2, 0, 2 * sizeof(FLOAT), 0, 0, drawing.buf1, 0, &srcbox);

    To get around this I had to hammer out some compute shader code which checks if the thread ID is 0, etc... it isn't pretty.  It's either that, or create another compute shader which ONLY copies one thing, which I think would be inefficient, but maybe I'm wrong.

    Is this another bizarre HW limitation or am I just doing it wrong?

    Thanks,
    Seth
  • 9/12/2009 5:09 AM In reply to

    Re: CopySubresourceRegion between structured buffers

    I sure hope I'm wrong on this one, but it looks like it isn't possible to use UpdateSubresource on a portion of one struct in a structured buffer, either.  It only seems to succeed if the width of the D3D11_BOX is a multiple of the struct size.
  • 9/12/2009 2:10 PM In reply to

    Re: CopySubresourceRegion between structured buffers

    Reading through the CUDA 2.3 programming guide, I am finding all sorts of awkward requirements for high performance.  I can now see why D3D11 has some of these weird restrictions.

    For instance, the guide mentions splitting up structures bigger than 16 bytes, which basically defeats the purpose of structures.  My brain hurts after reading all about memory coalescing and half-warps.

    I think it would be useful to have a segment in the D3D11 documentation describing the best usage of structured buffers in terms of size of structs, reading/writing on CPU, etc.
Page 1 of 1 (3 items) Previous Next