using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

namespace EVE.EVEGpgpu
{
    public sealed class EVEGpuSupport
    {
        private static readonly EVEGpuSupport instance = new EVEGpuSupport();

        public static EVEGpuSupport Instance
        {
            get { return instance; }
        }

        public EVENavierStokes NavierStokes = EVENavierStokes.Instance;

        private ContentManager m_cManager;
        public ContentManager cManager
        {
            get { return m_cManager; }
        }
    
        private GraphicsDevice m_currentProcessor;
        public GraphicsDevice currentProcessor
        {
            get { return m_currentProcessor; }
        }

        private List<EVEGpTask> taskList = new List<EVEGpTask>();

        public void computeTask()
        {
            foreach (EVEGpTask Task in taskList)
                Task.Perform();
        }

        public void addTask(EVEGpTask newTask)
        {
            taskList.Add(newTask);
        }

        public void deleteTask(EVEGpTask delTask)
        {
            taskList.Remove(delTask);
        }

        public void deleteAllTasks()
        {
            foreach (EVEGpTask Task in taskList)
                taskList.Remove(Task);
        }

        public void initialize(GraphicsDevice gD, ContentManager cM)
        {
            m_currentProcessor = gD;
            m_cManager = cM;
            RTManager.Instance.Initialize(gD);

            //
            // Init tasks block
            //

            EVEGpTask_Blur.Instance.Initialize();
        } 
    }
}
