private ShaderCodeData ReadShaderCode(BfshaFileLoader loader, ShaderFormat format) { ShaderCodeData codeData = null; if (CompressionType == 1) { codeData = loader.Load <ShaderCodeDataCompressed>(); } else if (format == ShaderFormat.Source) { codeData = loader.Load <ShaderCodeDataSource>(); } else { codeData = loader.Load <ShaderCodeDataBinary>(); } return(codeData); }
void IResData.Load(BfshaFileLoader loader) { long sourceProgramOffset = loader.ReadInt64(); long padding = loader.ReadInt64(); long binaryProgramOffset = loader.ReadInt64(); long parentOffset = loader.ReadInt64(); loader.Seek(32); if (sourceProgramOffset != 0) { SourceProgram = loader.Load <ShaderProgram>(sourceProgramOffset); SourceProgram.ParentShaderVariation = this; } if (binaryProgramOffset != 0) { BinaryProgram = loader.Load <ShaderProgram>(binaryProgramOffset); BinaryProgram.ParentShaderVariation = this; } }
void IResData.Load(BfshaFileLoader loader) { ShaderInfoData = loader.LoadSection <ShaderInfoData>(); uint memorySize = loader.ReadUInt32(); loader.ReadUInt32(); //padding //Stores a bunch of 0s MemoryData = loader.LoadCustom(() => loader.ReadBytes((int)memorySize)); loader.ReadUInt64(); //offset to parent shader variation ShaderReflection = loader.Load <ShaderReflection>(); loader.Seek(32); //reserved }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(BfshaFileLoader loader) { VertexShaderCode = loader.Load <ShaderReflectionData>(); Tess0ShaderCode = loader.Load <ShaderReflectionData>(); Tess1ShaderCode = loader.Load <ShaderReflectionData>(); GeometryShaderCode = loader.Load <ShaderReflectionData>(); PixelShaderCode = loader.Load <ShaderReflectionData>(); ComputeShaderCode = loader.Load <ShaderReflectionData>(); if (VertexShaderCode != null) { VertexShaderCode.ShaderType = ShaderType.VERTEX; } if (Tess0ShaderCode != null) { Tess0ShaderCode.ShaderType = ShaderType.TESS0; } if (Tess1ShaderCode != null) { Tess1ShaderCode.ShaderType = ShaderType.TESS1; } if (GeometryShaderCode != null) { GeometryShaderCode.ShaderType = ShaderType.GEOMETRY; } if (PixelShaderCode != null) { PixelShaderCode.ShaderType = ShaderType.PIXEL; } if (ComputeShaderCode != null) { ComputeShaderCode.ShaderType = ShaderType.COMPUTE; } }