DX11可追加缓冲区

时间:2018-10-29 16:41:35

标签: c# directx-11 sharpdx compute-shader

我已经使用SharpDX编码了光线跟踪算法,并且使用RWStructuredBuffer作为输出缓冲区都可以很好地工作。 现在,我想使用可附加的结构化缓冲区,而不是读写缓冲区。但是我无法在网上找到有用的指南。我已经更改了uavDescriptor中的“ append”标志,但我认为有一些遗漏!

BufferDescription bufferDescription = new BufferDescription() {
            BindFlags = BindFlags.UnorderedAccess | BindFlags.ShaderResource,
            Usage = ResourceUsage.Default,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.BufferStructured,
            StructureByteStride = Utilities.SizeOf<T>(),
            SizeInBytes = Utilities.SizeOf<T>() * count
        };
        buffer = new Buffer(Device, bufferDescription);

UnorderedAccessViewDescription uavDescription = new UnorderedAccessViewDescription() {
            Buffer = new UnorderedAccessViewDescription.BufferResource() { FirstElement = 0, Flags = UnorderedAccessViewBufferFlags.Append, ElementCount = count },
            Format = SharpDX.DXGI.Format.Unknown,
            Dimension = UnorderedAccessViewDimension.Buffer
        };

0 个答案:

没有答案