4 using System.Collections.Generic;
5 using System.Diagnostics;
8 using System.Runtime.InteropServices;
10 using SiliconStudio.Core.LZ4;
12 #if SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME
13 using Windows.Security.Cryptography;
14 using Windows.Security.Cryptography.Core;
15 using Windows.System.Profile;
16 using Windows.Security.ExchangeActiveSyncProvisioning;
19 namespace SiliconStudio.
Paradox.Graphics.Regression
23 public const string ParadoxServerIp =
"PARADOX_SERVER_IP";
25 public const string ParadoxServerPort =
"PARADOX_SERVER_PORT";
27 public const string ParadoxBuildNumber =
"PARADOX_BUILD_NUMBER";
29 public const string ParadoxTestName =
"PARADOX_TEST_NAME";
31 public const string ParadoxBranchName =
"PARADOX_BRANCH_NAME";
48 result.BuildNumber = -1;
50 #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
51 result.Platform =
"Windows";
52 result.Serial = Environment.MachineName;
53 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
54 result.DeviceName =
"Direct3D";
55 #elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
56 result.DeviceName =
"OpenGLES";
57 #elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
58 result.DeviceName =
"OpenGL";
60 #elif SILICONSTUDIO_PLATFORM_ANDROID
61 result.Platform =
"Android";
62 result.DeviceName = Android.OS.Build.Manufacturer +
" " + Android.OS.Build.Model;
63 result.Serial = Android.OS.Build.Serial ??
"Unknown";
64 #elif SILICONSTUDIO_PLATFORM_IOS
65 result.Platform =
"iOS";
66 result.DeviceName = iOSDeviceType.Version.ToString();
67 result.Serial = MonoTouch.UIKit.UIDevice.CurrentDevice.Name;
68 #elif SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME
69 #if SILICONSTUDIO_PLATFORM_WINDOWS_PHONE
70 result.Platform =
"WindowsPhone";
71 #elif SILICONSTUDIO_PLATFORM_WINDOWS_STORE
72 result.Platform =
"WindowsStore";
74 var deviceInfo =
new EasClientDeviceInformation();
75 result.DeviceName = deviceInfo.SystemManufacturer +
" " + deviceInfo.SystemProductName;
78 result.Serial = deviceInfo.Id.ToString();
82 var token = HardwareIdentification.GetPackageSpecificToken(null);
83 var hardwareId = token.Id;
85 var hasher = HashAlgorithmProvider.OpenAlgorithm(
"MD5");
86 var hashed = hasher.HashData(hardwareId);
88 result.Serial = CryptographicBuffer.EncodeToHexString(hashed);
97 return GetPlatformName(GetPlatform());
104 case TestPlatform.WindowsDx:
105 return "Windows_Direct3D11";
106 case TestPlatform.WindowsOgl:
107 return "Windows_OpenGL";
108 case TestPlatform.WindowsOgles:
109 return "Windows_OpenGLES";
110 case TestPlatform.Android:
112 case TestPlatform.Ios:
114 case TestPlatform.WindowsPhone:
115 return "Windows_Phone";
116 case TestPlatform.WindowsStore:
117 return "Windows_Store";
119 throw new ArgumentOutOfRangeException();
125 #if SILICONSTUDIO_PLATFORM_ANDROID
126 return TestPlatform.Android;
127 #elif SILICONSTUDIO_PLATFORM_IOS
128 return TestPlatform.Ios;
129 #elif SILICONSTUDIO_PLATFORM_WINDOWS_PHONE
130 return TestPlatform.WindowsPhone;
131 #elif SILICONSTUDIO_PLATFORM_WINDOWS_STORE
132 return TestPlatform.WindowsStore;
133 #elif SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
134 return TestPlatform.WindowsDx;
135 #elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
136 return TestPlatform.WindowsOgles;
137 #elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
138 return TestPlatform.WindowsOgl;
159 public void Read(BinaryReader reader)
161 Platform = reader.ReadString();
162 BuildNumber = reader.ReadInt32();
163 Serial = reader.ReadString();
164 DeviceName = reader.ReadString();
165 BranchName = reader.ReadString();
169 public void Write(BinaryWriter writer)
171 writer.Write(Platform);
172 writer.Write(BuildNumber);
173 writer.Write(Serial);
174 writer.Write(DeviceName);
175 writer.Write(BranchName);
176 writer.Write((int)
Flags);
193 public unsafe
void Read(BinaryReader reader)
195 TestName = reader.ReadString();
196 CurrentVersion = reader.ReadString();
197 Frame = reader.ReadString();
200 var width = reader.ReadInt32();
201 var height = reader.ReadInt32();
203 var textureSize = reader.ReadInt32();
206 var imageData =
new byte[textureSize];
210 lz4Stream.Read(imageData, copiedSize, textureSize - copiedSize);
213 var pinnedImageData = GCHandle.Alloc(imageData, GCHandleType.Pinned);
216 Dimension = TextureDimension.Texture2D,
224 Image = Image.New(description, pinnedImageData.AddrOfPinnedObject(), 0, pinnedImageData,
false);
227 public void Write(BinaryWriter writer)
229 writer.Write(TestName);
230 writer.Write(CurrentVersion);
234 var pixels = Image.PixelBuffer[0].GetPixels<byte>();
236 writer.Write(Image.PixelBuffer[0].Width);
237 writer.Write(Image.PixelBuffer[0].Height);
239 writer.Write(pixels.Length);
241 var sw =
new Stopwatch();
245 var lz4Stream =
new LZ4Stream(writer.BaseStream, CompressionMode.Compress,
false, pixels.Length);
246 lz4Stream.Write(pixels, 0, pixels.Length);
248 writer.BaseStream.Flush();
250 #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
251 Console.WriteLine(
"Total calculation time: {0}", sw.Elapsed);
253 TestGameBase.TestGameLogger.Info(
"Total calculation time: {0}", sw.Elapsed);
void Write(BinaryWriter writer)
unsafe void Read(BinaryReader reader)
Provides method to instantiate an image 1D/2D/3D supporting TextureArray and mipmaps on the CPU or to...
Flags
Enumeration of the new Assimp's flags.
void Read(BinaryReader reader)
ImageComparisonFlags Flags
Block compression stream. Allows to use LZ4 for stream compression.
PixelBufferArray PixelBuffer
Provides access to all pixel buffers.
Compression
Compression method enumeration
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
void Write(BinaryWriter writer)
PixelFormat
Defines various types of pixel formats.