Ejemplo n.º 1
0
 public EffectCompilerChain(EffectCompilerBase compiler)
 {
     if (compiler == null)
     {
         throw new ArgumentNullException("compiler");
     }
     this.compiler = compiler;
 }
Ejemplo n.º 2
0
        internal static IEffectCompiler CreateEffectCompiler(EffectSystem effectSystem, Guid? packageId, EffectCompilationMode effectCompilationMode, bool recordEffectRequested, TaskSchedulerSelector taskSchedulerSelector = null)
        {
            EffectCompilerBase compiler = null;

#if SILICONSTUDIO_XENKO_EFFECT_COMPILER
            if ((effectCompilationMode & EffectCompilationMode.Local) != 0)
            {
                // Local allowed and available, let's use that
                compiler = new EffectCompiler
                {
                    SourceDirectories = { EffectCompilerBase.DefaultSourceShaderFolder },
                };
            }
#endif

            // Nothing to do remotely
            bool needRemoteCompiler = (compiler == null && (effectCompilationMode & EffectCompilationMode.Remote) != 0);
            if (needRemoteCompiler || recordEffectRequested)
            {
                // Create the object that handles the connection
                var shaderCompilerTarget = new RemoteEffectCompilerClient(packageId);

                if (recordEffectRequested)
                {
                    // Let's notify effect compiler server for each new effect requested
                    effectSystem.EffectUsed += shaderCompilerTarget.NotifyEffectUsed;
                }

                // Use remote only if nothing else was found before (i.e. a local compiler)
                if (needRemoteCompiler)
                {
                    // Create a remote compiler
                    compiler = new RemoteEffectCompiler(shaderCompilerTarget);
                }
            }

            // Local not possible or allowed, and remote not allowed either => switch back to null compiler
            if (compiler == null)
            {
                compiler = new NullEffectCompiler();
            }

            return new EffectCompilerCache(compiler, taskSchedulerSelector);
        }
 public EffectCompilerCache(EffectCompilerBase compiler, TaskSchedulerSelector taskSchedulerSelector = null) : base(compiler)
 {
     CompileEffectAsynchronously = true;
     this.taskSchedulerSelector  = taskSchedulerSelector;
 }
Ejemplo n.º 4
0
 public EffectCompilerCache(EffectCompilerBase compiler, TaskSchedulerSelector taskSchedulerSelector = null) : base(compiler)
 {
     CompileEffectAsynchronously = true;
     this.taskSchedulerSelector = taskSchedulerSelector;
 }
Ejemplo n.º 5
0
 public EffectCompilerChain(EffectCompilerBase compiler)
 {
     if (compiler == null) throw new ArgumentNullException("compiler");
     this.compiler = compiler;
 }