public StripShaderCompilerData(UnityEditor.Rendering.ShaderCompilerData shaderCompilerData, bool isStripped = false) { if (shaderKeywordSet == null) { shaderKeywordSet = new List <StripShaderKeyword>(); } UnityEngine.Rendering.ShaderKeyword[] keywordSet = shaderCompilerData.shaderKeywordSet.GetShaderKeywords(); for (int i = 0; i < keywordSet.Length; i++) { StripShaderKeyword shaderKeyword = new StripShaderKeyword(keywordSet[i]); shaderKeywordSet.Add(shaderKeyword); } Array array = Enum.GetValues(typeof(UnityEngine.Rendering.BuiltinShaderDefine)); foreach (UnityEngine.Rendering.BuiltinShaderDefine v in array) { if (shaderCompilerData.platformKeywordSet.IsEnabled(v)) { StripBuiltinShaderDefine newdefine = StripTypeConvert.ConvertUnityTypeToStripType(v); platformKeywordSet = platformKeywordSet | newdefine; } } shaderRequirements = shaderCompilerData.shaderRequirements; graphicsTier = shaderCompilerData.graphicsTier; shaderCompilerPlatform = shaderCompilerData.shaderCompilerPlatform; this.isStripped = isStripped; }
public static UnityEngine.Rendering.BuiltinShaderDefine[] ConvertStripTypeToUnityTypes(StripBuiltinShaderDefine inType) { List <UnityEngine.Rendering.BuiltinShaderDefine> list = new List <UnityEngine.Rendering.BuiltinShaderDefine>(); Array array = Enum.GetValues(typeof(StripBuiltinShaderDefine)); foreach (int v in array) { if (((int)inType & v) == v) { list.Add((UnityEngine.Rendering.BuiltinShaderDefine)Mathf.Log(v, 2)); } } return(list.ToArray()); }