Beispiel #1
0
 public FluentContext(ICakeContext cakeContext, TaskDelegate task, SetupDelegate setup, TeardownDelegate teardown, TaskSetupDelegate taskSetup, TaskTeardownDelegate taskTeardown)
 {
     CakeContext  = cakeContext;
     Task         = task;
     Setup        = setup;
     Teardown     = teardown;
     TaskSetup    = taskSetup;
     TaskTeardown = taskTeardown;
 }
Beispiel #2
0
 public Benchmark(string _Name, string _UnlinkedDir, string _LinkedDir, SetupDelegate _setup = null, bool _shouldRun = false)
 {
     Name            = _Name;
     UnlinkedDir     = _UnlinkedDir;
     LinkedDir       = _LinkedDir;
     unlinkedDirInfo = new DirectoryInfo(UnlinkedDir);
     linkedDirInfo   = new DirectoryInfo(LinkedDir);
     ShouldRun       = _shouldRun;
     Setup           = _setup;
 }
Beispiel #3
0
 public Benchmark(string _Name, string _UnlinkedDir, string _LinkedDir, SetupDelegate _setup = null, bool _default = true)
 {
     Name            = _Name;
     UnlinkedDir     = _UnlinkedDir;
     LinkedDir       = _LinkedDir;
     unlinkedDirInfo = new DirectoryInfo(UnlinkedDir);
     linkedDirInfo   = new DirectoryInfo(LinkedDir);
     doRun           = false;
     runByDefault    = _default;
     Setup           = _setup;
 }
        protected void Connect(IConnection conn)
        {
            m_channel = conn.CreateModel();
            if (Transactional)
            {
                m_channel.TxSelect();
            }
            SetupDelegate setupHandler = Setup;

            if (setupHandler != null)
            {
                Setup(m_channel);
            }
        }
        protected void Connect(IConnection conn)
        {
            lock (m_receiverLock) {
                // Don't rebuild the channel if it is already valid. It is quite possible
                // that a reconnection race caused the reconnect logic to be called multiple times.
                if (m_channel != null && m_channel.CloseReason == null)
                {
                    return;
                }

                m_channel = conn.CreateModel();
                SetupDelegate setupHandler = Setup;
                if (setupHandler != null)
                {
                    Setup(m_channel);
                }
                Consume();

                return;
            }
        }
Beispiel #6
0
        public static ConfigurationBuilder CreateConfigurationBuilder(this ICakeContext context, TaskDelegate task, SetupDelegate setup, TeardownDelegate teardown, TaskSetupDelegate taskSetup, TaskTeardownDelegate taskTeardown)
        {
            IFluentContext fluentContext = new FluentContext(context, task, setup, teardown, taskSetup, taskTeardown);

            return(new ConfigurationBuilder(fluentContext));
        }
Beispiel #7
0
    ///
    public static bool LoadPlugin(bool force_opencl)
    {
        bool use_nvidia = SystemInfo.graphicsDeviceName.Contains("NVIDIA") ||
                          SystemInfo.graphicsDeviceName.Contains("GeForce");

        function_ptrs = new IntPtr[function_names.Length];
    #if (UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX)
        if (use_nvidia && !force_opencl)
        {
        #if (UNITY_EDITOR)
            handle = dlopen("Assets/Rove/ImportedPlugins/x86_64/libRoveGLCUDA.so", 2);
        #else
            handle = dlopen(Application.dataPath + "/Rove/Data/libRoveGLCUDA.so", 2);
        #endif
            if (handle == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get library.");
                string error = Marshal.PtrToStringAuto(dlerror());
                Debug.LogError(error);
                return(false);
            }
        }
        else
        {
        #if (UNITY_EDITOR)
            handle = dlopen("Assets/Rove/ImportedPlugins/x86_64/libRoveGLCL.so", 2);
        #else
            handle = dlopen(Application.dataPath + "/Rove/Data/libRoveGLCL.so", 2);
        #endif
            if (handle == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get library.");
                string error = Marshal.PtrToStringAuto(dlerror());
                Debug.LogError(error);
                return(false);
            }
        }
        for (uint fi = 1; fi < function_names.Length; ++fi)
        {
            function_ptrs[fi] = dlsym(handle, function_names[fi]);
            if (function_ptrs[fi] == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get function pointer: " +
                               function_names[fi]);
                string error = Marshal.PtrToStringAuto(dlerror());
                Debug.LogError(error);
                return(false);
            }
        }
    #elif (UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX)
        if (use_nvidia && !force_opencl)
        {
        #if (UNITY_EDITOR)
            handle = dlopen("Assets/Rove/ImportedPlugins/x86_64/RoveGLCUDA.bundle", 2);
        #else
            handle = dlopen(Application.dataPath + "/Rove/Data/RoveGLCUDA.bundle", 2);
        #endif
            if (handle == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get library.");
                string error = Marshal.PtrToStringAuto(dlerror());
                Debug.LogError(error);
                return(false);
            }
        }
        else
        {
        #if (UNITY_EDITOR)
            handle = dlopen("Assets/Rove/ImportedPlugins/x86_64/RoveGLCL.bundle", 2);
        #else
            handle = dlopen(Application.dataPath + "/Rove/Data/RoveGLCL.bundle", 2);
        #endif
            if (handle == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get library.");
                string error = Marshal.PtrToStringAuto(dlerror());
                Debug.LogError(error);
                return(false);
            }
        }
        for (uint fi = 1; fi < function_names.Length; ++fi)
        {
            function_ptrs[fi] = dlsym(handle, function_names[fi]);
            if (function_ptrs[fi] == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get function pointer: " +
                               function_names[fi]);
                string error = Marshal.PtrToStringAuto(dlerror());
                Debug.LogError(error);
                return(false);
            }
        }
    #elif (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        if (use_nvidia && !force_opencl)
        {
        #if (ROVE_FORCE_GL)
          #if (UNITY_EDITOR)
            handle = LoadLibrary("Assets/Rove/ImportedPlugins/x86_64/RoveGLCUDA.dll");
          #else
            handle = LoadLibrary(Application.dataPath + "/Rove/Data/RoveGLCUDA.dll");
          #endif
        #else
          #if (UNITY_EDITOR)
            handle = LoadLibrary("Assets/Rove/ImportedPlugins/x86_64/RoveD3D11CUDA.dll");
          #else
            handle = LoadLibrary(Application.dataPath + "/Rove/Data/RoveD3D11CUDA.dll");
          #endif
        #endif
            if (handle == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get library.");
                Debug.LogError("Error code: " + GetLastError() + ".");
                return(false);
            }
        }
        else
        {
        #if (ROVE_FORCE_GL)
          #if (UNITY_EDITOR)
            handle = LoadLibrary("Assets/Rove/ImportedPlugins/x86_64/RoveGLCL.dll");
          #else
            handle = LoadLibrary(Application.dataPath + "/Rove/Data/RoveGLCL.dll");
          #endif
        #else
          #if (UNITY_EDITOR)
            handle = LoadLibrary("Assets/Rove/ImportedPlugins/x86_64/RoveD3D11CL.dll");
          #else
            handle = LoadLibrary(Application.dataPath + "/Rove/Data/RoveD3D11CL.dll");
          #endif
        #endif
            if (handle == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get library.");
                Debug.LogError("Error code: " + GetLastError() + ".");
                return(false);
            }
        }
      #if (ROVE_FORCE_GL)
        for (uint fi = 1; fi < function_names.Length; ++fi)
        {
      #else
        for (uint fi = 0; fi < function_names.Length; ++fi)
        {
      #endif
            function_ptrs[fi] = GetProcAddress(handle, function_names[fi]);
            if (function_ptrs[fi] == IntPtr.Zero)
            {
                Debug.LogError("Rove: Failed to get function pointer: " +
                               function_names[fi]);
                Debug.LogError("Error code: " + GetLastError() + ".");
                return(false);
            }
        }
#endif
        uint i = 0;
    #if ((!ROVE_FORCE_GL) && (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN))
        SetD3D11Device = (SetD3D11DeviceDelegate)
                         Marshal.GetDelegateForFunctionPointer(function_ptrs[i++],
                                                               typeof(SetD3D11DeviceDelegate));
    #else
        ++i;
    #endif
        GetLock = (GetLockDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(GetLockDelegate));
        Setup = (SetupDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(SetupDelegate));
        Shutdown = (ShutdownDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(ShutdownDelegate));
        Resize = (ResizeDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(ResizeDelegate));
        StartUpdate = (StartUpdateDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(StartUpdateDelegate));
        FinishUpdate = (FinishUpdateDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(FinishUpdateDelegate));
        ResetRenderAtStart =
            (ResetRenderAtStartDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(ResetRenderAtStartDelegate));
        ResetRenderAtEnd =
            (ResetRenderAtEndDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(ResetRenderAtEndDelegate));
        GetThreadCount =
            (GetThreadCountDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(GetThreadCountDelegate));
        GetComputeAPI =
            (GetComputeAPIDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(GetComputeAPIDelegate));
        GetDeviceCount =
            (GetDeviceCountDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(GetDeviceCountDelegate));
        GetDeviceName =
            (GetDeviceNameDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(GetDeviceNameDelegate));
        ImportMesh = (ImportMeshDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(ImportMeshDelegate));
        FreeMesh = (FreeMeshDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(FreeMeshDelegate));
        DefineSubMesh = (DefineSubMeshDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(DefineSubMeshDelegate));
        ChangeSubMeshMaterial =
            (ChangeSubMeshMaterialDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(ChangeSubMeshMaterialDelegate));
        SetMeshTransform =
            (SetMeshTransformDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMeshTransformDelegate));
        AddMaterial = (AddMaterialDelegate)Marshal.GetDelegateForFunctionPointer(
            function_ptrs[i++], typeof(AddMaterialDelegate));
        SetMaterialMapFlags =
            (SetMaterialMapFlagsDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialMapFlagsDelegate));
        SetMaterialDoubleSided =
            (SetMaterialDoubleSidedDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialDoubleSidedDelegate));
        SetMaterialAlbedo =
            (SetMaterialAlbedoDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialAlbedoDelegate));
        SetMaterialMetallic =
            (SetMaterialMetallicDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialMetallicDelegate));
        SetMaterialSmoothness =
            (SetMaterialSmoothnessDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialSmoothnessDelegate));
        SetMaterialGlass =
            (SetMaterialGlassDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialGlassDelegate));
        SetMaterialEmission =
            (SetMaterialEmissionDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialEmissionDelegate));
        SetMaterialAlbedoBounds =
            (SetMaterialAlbedoBoundsDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialAlbedoBoundsDelegate));
        SetMaterialNormalBounds =
            (SetMaterialNormalBoundsDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialNormalBoundsDelegate));
        SetMaterialMetallicBounds =
            (SetMaterialMetallicBoundsDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialMetallicBoundsDelegate));
        SetMaterialEmissionBounds =
            (SetMaterialEmissionBoundsDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaterialEmissionBoundsDelegate));
        SetAlbedoAtlas =
            (SetAlbedoAtlasDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetAlbedoAtlasDelegate));
        SetNormalAtlas =
            (SetNormalAtlasDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetNormalAtlasDelegate));
        SetMetallicAtlas =
            (SetMetallicAtlasDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMetallicAtlasDelegate));
        SetEmissionAtlas =
            (SetEmissionAtlasDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetEmissionAtlasDelegate));
        SetFieldOfView =
            (SetFieldOfViewDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetFieldOfViewDelegate));
        SetMaxBounces =
            (SetMaxBouncesDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetMaxBouncesDelegate));
        SetSamplesPerFrame =
            (SetSamplesPerFrameDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetSamplesPerFrameDelegate));
        SetImageProperties =
            (SetImagePropertiesDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetImagePropertiesDelegate));
        SetCameraApertureSize =
            (SetCameraApertureSizeDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetCameraApertureSizeDelegate));
        SetCameraFocalDepth =
            (SetCameraFocalDepthDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetCameraFocalDepthDelegate));
        SetCameraTransform =
            (SetCameraTransformDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetCameraTransformDelegate));
        SetEnvironmentType =
            (SetEnvironmentTypeDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetEnvironmentTypeDelegate));
        SetSunDirection =
            (SetSunDirectionDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetSunDirectionDelegate));
        SetSkyIntensity =
            (SetSkyIntensityDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetSkyIntensityDelegate));
        SetSunIntensity =
            (SetSunIntensityDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetSunIntensityDelegate));
        SetSunColor =
            (SetSunColorDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetSunColorDelegate));
        SetEnvironmentMap =
            (SetEnvironmentMapDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetEnvironmentMapDelegate));
        SetEnvironmentProperties =
            (SetEnvironmentPropertiesDelegate)Marshal.GetDelegateForFunctionPointer(
                function_ptrs[i++], typeof(SetEnvironmentPropertiesDelegate));
        return(true);
    }
 /// <summary>
 /// Adds a new setupTask to onUpdate
 /// </summary>
 /// <param name="setupTask"></param>
 public void AddSetupTask(SetupDelegate setupTask)
 {
     OnSetup += setupTask;
 }
Beispiel #9
0
 public XnaToFnaMapping(string target, string[] sources, SetupDelegate setup = null)
 {
     Target  = target;
     Sources = sources;
     Setup   = setup;
 }