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

How to clear a structured buffer?

Last post 26/10/2009 20:22 by BarnacleJunior. 2 replies.
  • 26/10/2009 5:43

    How to clear a structured buffer?

    There is ClearUnorderedAccessView[Float|Uint] for clearing resources, but I don't see a convenient way to clear structured buffers.  I have a struct with 8 floats (in the shader) and a StructureByteStride of 32.  I tried making a UAV with format R32G32B32A32_FLOAT that would span twice the number of elements, so I could Clear it, but D3D returned E_INVALIDARG.

    Must I write a Clear compute shader for every structured buffer type and run Dispatch on it?

    Thanks,
    .sean

  • 26/10/2009 17:44 In reply to

    Re: How to clear a structured buffer?

    If you create a structured UAV, does it work then? I think at that point you'll be setting 32-bit values across the structured buffer, and that it will only look at the first element of the Values structure, but I'm not 100% certain.
  • 26/10/2009 20:22 In reply to

    Re: How to clear a structured buffer?

    ClearUnorderedAccessViewFloat on a structured UAV returns this error:

    D3D11: ERROR: ID3D11DeviceContext::ClearUnorderedAccessView: pUAV must be an UnorderedAccessView with a FLOAT, UNORM, or SNORM format. [ RESOURCE_MANIPULATION ERROR #2097406: CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT ]


    Attempting to bind a formatted UAV to a structured buffer returns this:

    D3D11: ERROR: ID3D11Device::CreateUnorderedAccessView: The Format (0x2, R32G32B32A32_FLOAT) is invalid, when creating a View of a Structured Buffer; it must be DXGI_FORMAT_UNKNOWN. [ STATE_CREATION ERROR #2097344: CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT ]


    .sean

Page 1 of 1 (3 items) Previous Next