Exemple #1
0
        private static byte[] GetDataSafe(this Buffer buffer, CommandList commandList = null)
        {
            var data = buffer.GetSerializationData();

            if (data != null)
            {
                return(data.Content);
            }

            if (commandList == null)
            {
                throw new InvalidOperationException("Could not find underlying CPU buffer data and no command list was given to extract them from GPU");
            }

            return(buffer.GetData <byte>(commandList));
        }