public ShaderKeywordObject GetConfigOfShader(Shader shader) { if (Config == null || Config.Length == 0) { return(null); } for (int i = 0; i < Config.Length; i++) { ShaderKeywordObject c = Config[i]; if (c.Shader == shader) { return(c); } } return(null); }
/// <summary> /// 执行剔除 /// </summary> /// <returns>如果需要放弃本次处理,返回true</returns> private bool DoExclude(ShaderKeywordObject configObj, ShaderSnippetData snippet, IList <ShaderCompilerData> data) { if (configObj == null) { return(false); } if (configObj.ExcludePassTypes != null) { for (int i = 0; i < configObj.ExcludePassTypes.Length; i++) { if (snippet.passType == configObj.ExcludePassTypes[i]) { return(true); } } } if (configObj.ExcludeKeywords != null) { for (int kwIndex = 0; kwIndex < configObj.ExcludeKeywords.Length; kwIndex++) { for (int dataIndex = data.Count - 1; dataIndex >= 0; --dataIndex) { //如果没有定义这个关键字就过 if (!data[dataIndex].shaderKeywordSet.IsEnabled(new ShaderKeyword(configObj.ExcludeKeywords[kwIndex]))) { continue; } //否则将这一条data移除 data.RemoveAt(dataIndex); } } } return(false); }