public GlslProgram Decompile(IGalMemory Memory, long Position, GalShaderType ShaderType) { Header = new ShaderHeader(Memory, Position); HeaderB = null; Blocks = ShaderDecoder.Decode(Memory, Position); BlocksB = null; Decl = new GlslDecl(Blocks, ShaderType); return(Decompile()); }
public GlslProgram Decompile(byte[] Binary, GalShaderType ShaderType) { Header = new ShaderHeader(Binary); HeaderB = null; Blocks = ShaderDecoder.Decode(Binary); BlocksB = null; Decl = new GlslDecl(Blocks, ShaderType, Header); return(Decompile()); }
public GlslProgram Decompile( byte[] BinaryA, byte[] BinaryB, GalShaderType ShaderType) { Header = new ShaderHeader(BinaryA); HeaderB = new ShaderHeader(BinaryB); Blocks = ShaderDecoder.Decode(BinaryA); BlocksB = ShaderDecoder.Decode(BinaryB); GlslDecl DeclVpA = new GlslDecl(Blocks, ShaderType, Header); GlslDecl DeclVpB = new GlslDecl(BlocksB, ShaderType, HeaderB); Decl = GlslDecl.Merge(DeclVpA, DeclVpB); return(Decompile()); }
public GlslProgram Decompile( IGalMemory Memory, long VpAPosition, long VpBPosition, GalShaderType ShaderType) { Header = new ShaderHeader(Memory, VpAPosition); HeaderB = new ShaderHeader(Memory, VpBPosition); Blocks = ShaderDecoder.Decode(Memory, VpAPosition); BlocksB = ShaderDecoder.Decode(Memory, VpBPosition); GlslDecl DeclVpA = new GlslDecl(Blocks, ShaderType); GlslDecl DeclVpB = new GlslDecl(BlocksB, ShaderType); Decl = GlslDecl.Merge(DeclVpA, DeclVpB); return(Decompile()); }
public GlslDecl(ShaderIrBlock[] Blocks, GalShaderType ShaderType, ShaderHeader Header) : this(ShaderType) { StagePrefix = StagePrefixes[(int)ShaderType] + "_"; if (ShaderType == GalShaderType.Fragment) { int Index = 0; for (int Attachment = 0; Attachment < 8; Attachment++) { for (int Component = 0; Component < 4; Component++) { if (Header.OmapTargets[Attachment].ComponentEnabled(Component)) { m_Gprs.TryAdd(Index, new ShaderDeclInfo(GetGprName(Index), Index)); Index++; } } } if (Header.OmapDepth) { Index = Header.DepthRegister; m_Gprs.TryAdd(Index, new ShaderDeclInfo(GetGprName(Index), Index)); } } foreach (ShaderIrBlock Block in Blocks) { ShaderIrNode[] Nodes = Block.GetNodes(); foreach (ShaderIrNode Node in Nodes) { Traverse(Nodes, null, Node); } } }
public GlslDecl(ShaderIrBlock[] blocks, GalShaderType shaderType, ShaderHeader header) : this(shaderType) { _stagePrefix = _stagePrefixes[(int)shaderType] + "_"; if (shaderType == GalShaderType.Fragment) { int index = 0; for (int attachment = 0; attachment < 8; attachment++) { for (int component = 0; component < 4; component++) { if (header.OmapTargets[attachment].ComponentEnabled(component)) { m_Gprs.TryAdd(index, new ShaderDeclInfo(GetGprName(index), index)); index++; } } } if (header.OmapDepth) { index = header.DepthRegister; m_Gprs.TryAdd(index, new ShaderDeclInfo(GetGprName(index), index)); } } foreach (ShaderIrBlock block in blocks) { ShaderIrNode[] nodes = block.GetNodes(); foreach (ShaderIrNode node in nodes) { Traverse(nodes, null, node); } } }