Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GraphicsDeviceFeatures.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 //
4 // Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 
24 using System;
25 using System.Collections.Generic;
26 
27 namespace SiliconStudio.Paradox.Graphics
28 {
29  /// <summary>
30  /// Features supported by a <see cref="GraphicsDevice"/>.
31  /// </summary>
32  /// <remarks>
33  /// This class gives also features for a particular format, using the operator this[dxgiFormat] on this structure.
34  /// </remarks>
35  public partial struct GraphicsDeviceFeatures
36  {
37  private readonly FeaturesPerFormat[] mapFeaturesPerFormat;
38 
39  /// <summary>
40  /// Features level of the current device.
41  /// </summary>
43 
44  /// <summary>
45  /// Boolean indicating if this device supports compute shaders, unordered access on structured buffers and raw structured buffers.
46  /// </summary>
47  public readonly bool HasComputeShaders;
48 
49  /// <summary>
50  /// Boolean indicating if this device supports shaders double precision calculations.
51  /// </summary>
52  public readonly bool HasDoublePrecision;
53 
54  /// <summary>
55  /// Boolean indicating if this device supports concurrent resources in multithreading scenarios.
56  /// </summary>
58 
59  /// <summary>
60  /// Boolean indicating if this device supports command lists in multithreading scenarios.
61  /// </summary>
62  public readonly bool HasDriverCommandLists;
63 
64  /// <summary>
65  /// Is the device being profiled.
66  /// </summary>
67  public readonly bool IsProfiled;
68 
69  /// <summary>
70  /// Gets the <see cref="FeaturesPerFormat" /> for the specified <see cref="SharpDX.DXGI.Format" />.
71  /// </summary>
72  /// <param name="dxgiFormat">The dxgi format.</param>
73  /// <returns>Features for the specific format.</returns>
74  public FeaturesPerFormat this[PixelFormat dxgiFormat]
75  {
76  get { return this.mapFeaturesPerFormat[(int)dxgiFormat]; }
77  }
78 
79  /// <summary>
80  /// The features exposed for a particular format.
81  /// </summary>
82  public struct FeaturesPerFormat
83  {
84  //internal FeaturesPerFormat(PixelFormat format, MSAALevel maximumMSAALevel, ComputeShaderFormatSupport computeShaderFormatSupport, FormatSupport formatSupport)
85  internal FeaturesPerFormat(PixelFormat format, MSAALevel maximumMSAALevel, FormatSupport formatSupport)
86  {
87  Format = format;
88  this.MSAALevelMax = maximumMSAALevel;
89  //ComputeShaderFormatSupport = computeShaderFormatSupport;
90  FormatSupport = formatSupport;
91  }
92 
93  /// <summary>
94  /// The <see cref="SharpDX.DXGI.Format"/>.
95  /// </summary>
96  public readonly PixelFormat Format;
97 
98  /// <summary>
99  /// Gets the maximum MSAA sample count for a particular <see cref="PixelFormat"/>.
100  /// </summary>
101  public readonly MSAALevel MSAALevelMax;
102 
103  /// <summary>
104  /// Gets the unordered resource support options for a compute shader resource.
105  /// </summary>
106  //public readonly ComputeShaderFormatSupport ComputeShaderFormatSupport;
107 
108  /// <summary>
109  /// Support of a given format on the installed video device.
110  /// </summary>
111  public readonly FormatSupport FormatSupport;
112 
113  public override string ToString()
114  {
115  //return string.Format("Format: {0}, MSAALevelMax: {1}, ComputeShaderFormatSupport: {2}, FormatSupport: {3}", Format, this.MSAALevelMax, ComputeShaderFormatSupport, FormatSupport);
116  return string.Format("Format: {0}, MSAALevelMax: {1}, FormatSupport: {2}", Format, this.MSAALevelMax, FormatSupport);
117  }
118  }
119 
120  public override string ToString()
121  {
122  return string.Format("Level: {0}, HasComputeShaders: {1}, HasDoublePrecision: {2}, HasMultiThreadingConcurrentResources: {3}, HasDriverCommandLists: {4}", Profile, HasComputeShaders, HasDoublePrecision, HasMultiThreadingConcurrentResources, this.HasDriverCommandLists);
123  }
124  }
125 }
readonly bool HasDriverCommandLists
Boolean indicating if this device supports command lists in multithreading scenarios.
readonly FormatSupport FormatSupport
Gets the unordered resource support options for a compute shader resource.
readonly bool HasDoublePrecision
Boolean indicating if this device supports shaders double precision calculations. ...
MSAALevel
Multisample count level.
Definition: MSAALevel.cs:29
readonly bool IsProfiled
Is the device being profiled.
readonly MSAALevel MSAALevelMax
Gets the maximum MSAA sample count for a particular PixelFormat.
readonly bool HasMultiThreadingConcurrentResources
Boolean indicating if this device supports concurrent resources in multithreading scenarios...
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
Definition: DirectXTexP.h:175
GraphicsProfile
Identifies the set of supported devices for the demo based on device capabilities.
PixelFormat
Defines various types of pixel formats.
Definition: PixelFormat.cs:32
readonly bool HasComputeShaders
Boolean indicating if this device supports compute shaders, unordered access on structured buffers an...
GraphicsProfile Profile
Features level of the current device.