Exemplo n.º 1
0
        public static void OnAfter()
        {
            BeforePreprocessShaders.s_Handled = false;

            MDebug.Log("Shader", $"AfterPreprocessShaders");

            for (int iPreprocessShaders = 0; iPreprocessShaders < s_PreprocessShaders.Count; iPreprocessShaders++)
            {
                IMPreprocessShaders iterPreprocessShaders = s_PreprocessShaders[iPreprocessShaders];
                try
                {
                    iterPreprocessShaders.OnAfter();
                }
                catch (Exception e)
                {
                    MDebug.LogError("Shader", $"处理Shader({iterPreprocessShaders.GetType().FullName}).OnAfter失败\n{e.ToString()}");
                }
            }
        }
        public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList <ShaderCompilerData> data)
        {
            if (s_Handled)
            {
                return;
            }
            s_Handled = true;

            MDebug.Log("Shader", $"BeforePreprocessShaders");

            PreprocessShadersUtility.s_PreprocessShaders.Sort(IMPreprocessShadersComparison);
            for (int iPreprocessShaders = 0; iPreprocessShaders < PreprocessShadersUtility.s_PreprocessShaders.Count; iPreprocessShaders++)
            {
                IMPreprocessShaders iterPreprocessShaders = PreprocessShadersUtility.s_PreprocessShaders[iPreprocessShaders];
                try
                {
                    iterPreprocessShaders.OnBefore();
                }
                catch (Exception e)
                {
                    MDebug.LogError("Shader", $"处理Shader({iterPreprocessShaders.GetType().FullName}).OnBefore失败\n{e.ToString()}");
                }
            }
        }