Example #1
0
            private int ReadCount(string src, DeviceContextProxy context, UnorderedAccessView uav)
            {
                context.CopyStructureCount(particleCountStaging, 0, uav);
                var db = context.MapSubresource(particleCountStaging, MapMode.Read, MapFlags.None);
                var CurrentParticleCount = 0;

                CurrentParticleCount = UnsafeHelper.Read <int>(db.DataPointer);
#if OUTPUTDEBUGGING
                Debug.WriteLine("{0}: {1}", src, CurrentParticleCount);
#endif
                context.UnmapSubresource(particleCountStaging, 0);
                return(CurrentParticleCount);
            }
        private int ReadCount(string src, DeviceContextProxy context, UnorderedAccessView uav)
        {
            context.CopyStructureCount(particleCountStaging, 0, uav);
            DataStream ds;
            var        db = context.MapSubresource(particleCountStaging, MapMode.Read, MapFlags.None, out ds);
            int        CurrentParticleCount = ds.ReadInt();

#if OUTPUTDEBUGGING
            Debug.WriteLine("{0}: {1}", src, CurrentParticleCount);
#endif
            context.UnmapSubresource(particleCountStaging, 0);
            return(CurrentParticleCount);
        }
            private int ReadCount(string src, DeviceContextProxy context, UnorderedAccessView uav)
            {
                context.CopyStructureCount(particleCountStaging, 0, uav);
                var db = context.MapSubresource(particleCountStaging, MapMode.Read, MapFlags.None);
                var currentParticleCount = UnsafeHelper.Read <int>(db.DataPointer);

#if OUTPUTDEBUGGING
                if (logger.IsEnabled(LogLevel.Debug))
                {
                    logger.LogDebug("{}: {}", src, currentParticleCount);
                }
#endif
                context.UnmapSubresource(particleCountStaging, 0);
                return(currentParticleCount);
            }
 /// <summary>
 /// Copies the count.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="destBuffer">The dest buffer.</param>
 /// <param name="offset">The offset.</param>
 public void CopyCount(DeviceContextProxy device, SDX11.Buffer destBuffer, int offset)
 {
     device.CopyStructureCount(destBuffer, offset, UAV);
 }