Beispiel #1
0
        private void UpdateBuffer(EvaluationContext context)
        {
            int  stride      = Stride.GetValue(context);
            int  sizeInBytes = stride * Count.GetValue(context);
            bool createSrv   = CreateSrv.GetValue(context);
            bool createUav   = CreateUav.GetValue(context);
            var  bufferFlags = BufferFlags.GetValue(context);

            if (sizeInBytes <= 0)
            {
                return;
            }

            if (BufferWithViews.Value == null)
            {
                BufferWithViews.Value = new BufferWithViews();
            }

            ResourceManager.Instance().SetupStructuredBuffer(sizeInBytes, stride, ref BufferWithViews.Value.Buffer);

            if (createSrv)
            {
                ResourceManager.Instance().CreateStructuredBufferSrv(BufferWithViews.Value.Buffer, ref BufferWithViews.Value.Srv);
            }

            if (createUav)
            {
                ResourceManager.Instance().CreateStructuredBufferUav(BufferWithViews.Value.Buffer, bufferFlags, ref BufferWithViews.Value.Uav);
            }
        }
        private void UpdateBuffer(EvaluationContext context)
        {
            int stride      = Stride.GetValue(context);
            int sizeInBytes = stride * Count.GetValue(context);

            if (sizeInBytes <= 0)
            {
                return;
            }

            ResourceManager.Instance().SetupStructuredBuffer(sizeInBytes, stride, ref Buffer.Value);
        }
        private void UpdateBuffer(EvaluationContext context)
        {
            int stride      = Stride.GetValue(context);
            int sizeInBytes = stride * Count.GetValue(context);

            if (sizeInBytes <= 0)
            {
                return;
            }

            var bufferDesc = new BufferDescription
            {
                Usage               = ResourceUsage.Default,
                BindFlags           = BindFlags.UnorderedAccess | BindFlags.ShaderResource,
                SizeInBytes         = sizeInBytes,
                OptionFlags         = ResourceOptionFlags.DrawIndirectArguments,
                StructureByteStride = stride
            };

            ResourceManager.Instance().SetupBuffer(bufferDesc, ref Buffer.Value);
        }