Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
OpenGLShaderBytecodeData.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using SiliconStudio.Core.Serialization;
5 
6 namespace SiliconStudio.Paradox.Graphics
7 {
8  internal struct OpenGLShaderBytecodeData
9  {
10  public bool IsBinary;
11 
12  public string Profile;
13  public string EntryPoint;
14  public string Source;
15 
16  public int BinaryFormat;
17  public byte[] Binary;
18 
19  public void Serialize(SerializationStream stream, ArchiveMode mode)
20  {
21  // Check version number (should be 0 for now, for future use)
22  if (mode == ArchiveMode.Serialize)
23  {
24  stream.Write(0);
25  }
26  else if (mode == ArchiveMode.Deserialize)
27  {
28  if (stream.ReadInt32() != 0)
29  throw new InvalidOperationException("Unexpected version number.");
30  }
31 
32  // Serialize content
33  stream.Serialize(ref IsBinary);
34  if (IsBinary)
35  {
36  stream.Serialize(ref BinaryFormat);
37  stream.Serialize(ref Binary, mode);
38  }
39  else
40  {
41  stream.Serialize(ref Profile);
42  stream.Serialize(ref EntryPoint);
43  stream.Serialize(ref Source);
44  }
45  }
46  }
47 }
Base class for implementation of SerializationStream.
Only valid for a property / field that has an array type of a some value type. The content of the arr...
ArchiveMode
Enumerates the different mode of serialization (either serialization or deserialization).
Definition: ArchiveMode.cs:8