public static void DecompileAllShadersOfType(string Type) { string inputDir = Path.Combine(Program.ShaderDumpDirectory, Type); if (!Directory.Exists(inputDir)) { Program.LogLine($"Unable to find input directory \"{inputDir}\", aborting..."); return; } string[] vsFiles = Directory.GetFiles(inputDir, "*.vs.bin"); string[] psFiles = Directory.GetFiles(inputDir, "*.ps.bin"); string[] csFiles = Directory.GetFiles(inputDir, "*.cs.bin"); List <string> allFiles = new List <string>(); allFiles.AddRange(vsFiles); allFiles.AddRange(psFiles); allFiles.AddRange(csFiles); Program.LogLine( $"DecompileAllShadersOfType({Type}): " + $"{vsFiles.Length} vertex shaders, {psFiles.Length} pixel shaders, {csFiles.Length} compute shaders."); System.Threading.Tasks.Parallel.For(0, allFiles.Count, i => { ShaderDecompiler.DecompileShader(allFiles[i], allFiles[i].Replace(".bin", ".hlsl"), allFiles[i].Replace(".bin", ".txt")); }); Program.LogLine($"DecompileAllShadersOfType({Type}): Done."); }
public static ShaderBytecode RecompileShader3DMigoto(string OriginalFile, string HlslType) { // Create a copy of the file since it will be trashed string copyPath = OriginalFile.Replace(".bin", ".hlsl"); ShaderDecompiler.DecompileShader(OriginalFile, copyPath, OriginalFile.Replace(".bin", ".txt")); return(CompileShaderOfType(copyPath, HlslType, null)); }