protected virtual void Dispose(bool disposing)
 {
     if (disposing && datareader != null)
     {
         datareader.Dispose();
         datareader = null;
     }
 }
 public DxbcSource(ShaderDataReader datareader, int sourceId) : base(datareader, sourceId)
 {
     this.offset = datareader.ReadInt32();
     if (offset > 0)
     {
         sourcebytes = datareader.ReadBytes(offset);
     }
     editorRefId = datareader.ReadBytes(16);
 }
 public ZDataBlock(ShaderDataReader datareader, int blockId) : base(datareader)
 {
     this.blockId = blockId;
     h0           = datareader.ReadInt32();
     h1           = datareader.ReadInt32();
     h2           = datareader.ReadInt32();
     if (h0 > 0)
     {
         dataload = datareader.ReadBytes(h0 * 4);
     }
 }
 public VulkanSource(ShaderDataReader datareader, int sourceId) : base(datareader, sourceId)
 {
     this.offset = datareader.ReadInt32();
     if (offset > 0)
     {
         this.arg0    = datareader.ReadInt32();
         this.offset2 = datareader.ReadInt32();
         sourcebytes  = datareader.ReadBytes(offset - 8);
     }
     editorRefId = datareader.ReadBytes(16);
 }
 public GlslSource(ShaderDataReader datareader, int sourceId) : base(datareader, sourceId)
 {
     offset = datareader.ReadInt32();
     if (offset > 0)
     {
         arg0        = datareader.ReadInt32();
         offset2     = datareader.ReadInt32();
         sourcebytes = datareader.ReadBytes(offset2 - 1); // -1 because the sourcebytes are null-term
         datareader.BaseStream.Position += 1;
     }
     editorRefId = datareader.ReadBytes(16);
 }
        public DxilSource(ShaderDataReader datareader, int sourceId) : base(datareader, sourceId)
        {
            offset = datareader.ReadInt32();
            if (offset > 0)
            {
                arg0 = datareader.ReadInt16();
                arg1 = (int)datareader.ReadUInt16();
                uint dxilDelim = datareader.ReadUInt16();
                if (dxilDelim != 0xFFFE)
                {
                    throw new ShaderParserException($"Unexpected DXIL source id {dxilDelim:x08}");
                }

                headerBytes = (int)datareader.ReadUInt16() * 4; // size is given as a 4-byte count
                sourcebytes = datareader.ReadBytes(offset - 8); // size of source equals offset-8
            }
            editorRefId = datareader.ReadBytes(16);
        }
 /// <summary>
 /// Reads the given <see cref="Stream"/>.
 /// </summary>
 /// <param name="filenamepath">The filename <see cref="string"/>.</param>
 /// <param name="input">The input <see cref="Stream"/> to read from.</param>
 public void Read(string filenamepath, Stream input)
 {
     datareader        = new ShaderDataReader(input);
     this.filenamepath = filenamepath;
     ParseFile();
 }
 protected GpuSource(ShaderDataReader datareader, int sourceId) : base(datareader)
 {
     this.sourceId = sourceId;
 }