public static ShaderProgramInfo Create(MaliOcReport vertReport, MaliOcReport fragReport) { ShaderProgramInfo info = new ShaderProgramInfo(); info.positionVertPerf = ShaderProgramPerfInfo.Create(vertReport, "Position"); info.varyingVertPerf = ShaderProgramPerfInfo.Create(vertReport, "Varying"); info.fragPerf = ShaderProgramPerfInfo.Create(fragReport, 0); return(info); }
public static AnalyzedShaderInfo Create(Shader shader, CompiledShaderParser compiledShaderParser) { AnalyzedShaderInfo info = new AnalyzedShaderInfo(); info.shaderName = shader.name; var programs = compiledShaderParser.GetShaderPrograms(); var passInfos = compiledShaderParser.GetPassInfos(); string dir = Path.Combine(COMPILED_FILE_PATH, shader.name); // create compile files EditorUtility.DisplayProgressBar("Analyzing", "Analyze ShaderProgram", 0.0f); try { CreateCompiledFiles(dir, compiledShaderParser); for (int i = 0; i < programs.Count; ++i) { EditorUtility.DisplayProgressBar("Analyzing", "Analyze ShaderProgram", i / (float)programs.Count); var vertJson = MaliocPluginUtility.CallMaliShaderOfflineCompiler(dir + "/" + i + ".vert", true); var fragJson = MaliocPluginUtility.CallMaliShaderOfflineCompiler(dir + "/" + i + ".frag", true); var vertResult = MaliOcReport.CreateFromJson(vertJson); var fragResult = MaliOcReport.CreateFromJson(fragJson); var shaderProgramInfo = ShaderProgramInfo.Create(vertResult, fragResult); var key = new ShaderKeywordInfo(); key.globalKeyword = programs[i].globalKeyword; key.localKeyword = programs[i].localKeyword; key.passIndex = programs[i].passInfoIdx; info.AddProgramInfo(key, shaderProgramInfo); } }catch (System.ComponentModel.Win32Exception e) { EditorUtility.ClearProgressBar(); EditorUtility.DisplayDialog("malioc not found", "please install ARM Mobile studio. or make to malioc path correct.", "OK"); return(null); } EditorUtility.ClearProgressBar(); for (int i = 0; i < passInfos.Count; ++i) { info.AddPassInfo(passInfos[i].name, passInfos[i].tags); } InitDirectory(DB_FILE_PATH); info.SaveToFile(Path.Combine(DB_FILE_PATH, shader.name.Replace('/', '_') + ".json")); return(info); }
public void AddProgramInfo(ShaderKeywordInfo info, ShaderProgramInfo programInfo) { if (keywordInfos == null) { keywordInfos = new List <ShaderKeywordInfo>(); } if (programInfos == null) { programInfos = new List <ShaderProgramInfo>(); } if (performanceInfoByKeyword == null) { performanceInfoByKeyword = new Dictionary <ShaderKeywordInfo, ShaderProgramInfo>(); } keywordInfos.Add(info); programInfos.Add(programInfo); performanceInfoByKeyword.Add(info, programInfo); }