コード例 #1
0
        /// <summary>
        /// Function to perform initialization of the shader view resource.
        /// </summary>
        protected override void OnInitialize()
        {
            Gorgon.Log.Print("Creating buffer unordered access view for {0}.", LoggingLevel.Verbose, Resource.Name);
            var desc = new D3D.UnorderedAccessViewDescription
            {
                Dimension = D3D.UnorderedAccessViewDimension.Buffer,
                Buffer    =
                {
                    FirstElement = ElementStart,
                    ElementCount = ElementCount,
                    Flags        = IsRaw ? D3D.UnorderedAccessViewBufferFlags.Raw : D3D.UnorderedAccessViewBufferFlags.None
                },
                Format = (Format)Format
            };

            D3DView = new D3D.UnorderedAccessView(Resource.Graphics.D3DDevice, Resource.D3DResource, desc)
            {
                DebugName = "Gorgon Unordered Access View for " + Resource.Name
            };
        }
コード例 #2
0
        private void BuildBuffers()
        {
            D3D11.BufferDescription buf_desc = new D3D11.BufferDescription();
            buf_desc.BindFlags           = D3D11.BindFlags.ShaderResource | D3D11.BindFlags.UnorderedAccess;
            buf_desc.Usage               = D3D11.ResourceUsage.Default;
            buf_desc.StructureByteStride = WaveSolution.Stride;
            buf_desc.SizeInBytes         = WaveSolution.Stride * VertexCount;
            buf_desc.OptionFlags         = D3D11.ResourceOptionFlags.BufferStructured;
            buf_desc.CpuAccessFlags      = D3D11.CpuAccessFlags.Write | D3D11.CpuAccessFlags.Read;

            _inputBuf1 = new D3D11.Buffer(Device, buf_desc);
            _inputBuf2 = new D3D11.Buffer(Device, buf_desc);

            D3D11.ShaderResourceViewDescription vdesc = new D3D11.ShaderResourceViewDescription();
            vdesc.Dimension           = D3D.ShaderResourceViewDimension.Buffer;
            vdesc.Format              = DXGI.Format.Unknown;
            vdesc.Buffer.FirstElement = 0;
            vdesc.Buffer.ElementCount = VertexCount;


            _inputBuf1View = new D3D11.ShaderResourceView(Device, _inputBuf1, vdesc);
            _inputBuf2View = new D3D11.ShaderResourceView(Device, _inputBuf2, vdesc);



            D3D11.UnorderedAccessViewDescription uavdesc = new D3D11.UnorderedAccessViewDescription();
            uavdesc.Format              = DXGI.Format.Unknown;
            uavdesc.Dimension           = D3D11.UnorderedAccessViewDimension.Buffer;
            uavdesc.Buffer.FirstElement = 0;
            uavdesc.Buffer.ElementCount = VertexCount;

            _inputBuf1UAV = new D3D11.UnorderedAccessView(Device, _inputBuf1, uavdesc);
            _inputBuf2UAV = new D3D11.UnorderedAccessView(Device, _inputBuf2, uavdesc);


            return;
        }