ProfileCapabilities.cpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //-----------------------------------------------------------------------------
  2. // ProfileCapabilities.cpp
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. #include "stdafx.h"
  8. #include "ProfileCapabilities.h"
  9. using namespace System;
  10. using namespace System::Collections::Generic;
  11. using namespace XnaGraphicsProfileChecker;
  12. #define STANDARD_TEXTURE_FORMATS \
  13. SurfaceFormat::Color, \
  14. SurfaceFormat::Bgr565, \
  15. SurfaceFormat::Bgra5551, \
  16. SurfaceFormat::Bgra4444
  17. #define COMPRESSED_TEXTURE_FORMATS \
  18. SurfaceFormat::Dxt1, \
  19. SurfaceFormat::Dxt3, \
  20. SurfaceFormat::Dxt5
  21. #define SIGNED_TEXTURE_FORMATS \
  22. SurfaceFormat::NormalizedByte2, \
  23. SurfaceFormat::NormalizedByte4
  24. #define HIDEF_TEXTURE_FORMATS \
  25. SurfaceFormat::Rgba1010102, \
  26. SurfaceFormat::Rg32, \
  27. SurfaceFormat::Rgba64, \
  28. SurfaceFormat::Alpha8
  29. #define STANDARD_FLOAT_TEXTURE_FORMATS \
  30. SurfaceFormat::Single, \
  31. SurfaceFormat::Vector2, \
  32. SurfaceFormat::Vector4, \
  33. SurfaceFormat::HalfSingle, \
  34. SurfaceFormat::HalfVector2, \
  35. SurfaceFormat::HalfVector4
  36. #define FLOAT_TEXTURE_FORMATS \
  37. STANDARD_FLOAT_TEXTURE_FORMATS, \
  38. SurfaceFormat::HdrBlendable
  39. #define STANDARD_DEPTH_FORMATS \
  40. DepthFormat::Depth16, \
  41. DepthFormat::Depth24, \
  42. DepthFormat::Depth24Stencil8
  43. #define STANDARD_VERTEX_FORMATS \
  44. VertexElementFormat::Color, \
  45. VertexElementFormat::Single, \
  46. VertexElementFormat::Vector2, \
  47. VertexElementFormat::Vector3, \
  48. VertexElementFormat::Vector4, \
  49. VertexElementFormat::Byte4, \
  50. VertexElementFormat::Short2, \
  51. VertexElementFormat::Short4, \
  52. VertexElementFormat::NormalizedShort2, \
  53. VertexElementFormat::NormalizedShort4
  54. #define HIDEF_VERTEX_FORMATS \
  55. VertexElementFormat::HalfVector2, \
  56. VertexElementFormat::HalfVector4
  57. // Helper for filling in lists of enum values.
  58. template<typename T>
  59. ReadOnlyCollection<T>^ MakeList(... array<T>^ values)
  60. {
  61. return gcnew ReadOnlyCollection<T>(gcnew List<T>(values));
  62. }
  63. ProfileCapabilities::ProfileCapabilities(GraphicsProfile graphicsProfile)
  64. {
  65. switch (graphicsProfile)
  66. {
  67. case GraphicsProfile::Reach:
  68. // Fill in the Reach profile requirements.
  69. VertexShaderVersion = 0x200;
  70. PixelShaderVersion = 0x200;
  71. SeparateAlphaBlend = false;
  72. DestBlendSrcAlphaSat = false;
  73. MaxPrimitiveCount = 65535;
  74. IndexElementSize32 = false;
  75. MaxVertexStreams = 16;
  76. MaxStreamStride = 255;
  77. MaxTextureSize = 2048;
  78. MaxCubeSize = 512;
  79. MaxVolumeExtent = 0;
  80. MaxTextureAspectRatio = 2048;
  81. MaxVertexSamplers = 0;
  82. MaxRenderTargets = 1;
  83. NonPow2Unconditional = false;
  84. NonPow2Cube = false;
  85. NonPow2Volume = false;
  86. ValidTextureFormats = MakeList(STANDARD_TEXTURE_FORMATS, COMPRESSED_TEXTURE_FORMATS, SIGNED_TEXTURE_FORMATS);
  87. ValidCubeFormats = MakeList(STANDARD_TEXTURE_FORMATS, COMPRESSED_TEXTURE_FORMATS);
  88. ValidVolumeFormats = MakeList<SurfaceFormat>();
  89. ValidVertexTextureFormats = MakeList<SurfaceFormat>();
  90. InvalidFilterFormats = MakeList<SurfaceFormat>();
  91. InvalidBlendFormats = MakeList<SurfaceFormat>();
  92. ValidVertexFormats = MakeList(STANDARD_VERTEX_FORMATS);
  93. break;
  94. case GraphicsProfile::HiDef:
  95. // Fill in the HiDef profile requirements.
  96. VertexShaderVersion = 0x300;
  97. PixelShaderVersion = 0x300;
  98. SeparateAlphaBlend = true;
  99. DestBlendSrcAlphaSat = true;
  100. MaxPrimitiveCount = 1048575;
  101. IndexElementSize32 = true;
  102. MaxVertexStreams = 16;
  103. MaxStreamStride = 255;
  104. MaxTextureSize = 4096;
  105. MaxCubeSize = 4096;
  106. MaxVolumeExtent = 256;
  107. MaxTextureAspectRatio = 2048;
  108. MaxVertexSamplers = 4;
  109. MaxRenderTargets = 4;
  110. NonPow2Unconditional = true;
  111. NonPow2Cube = true;
  112. NonPow2Volume = true;
  113. ValidTextureFormats = MakeList(STANDARD_TEXTURE_FORMATS, COMPRESSED_TEXTURE_FORMATS, SIGNED_TEXTURE_FORMATS, HIDEF_TEXTURE_FORMATS, FLOAT_TEXTURE_FORMATS);
  114. ValidCubeFormats = MakeList(STANDARD_TEXTURE_FORMATS, COMPRESSED_TEXTURE_FORMATS, HIDEF_TEXTURE_FORMATS, FLOAT_TEXTURE_FORMATS);
  115. ValidVolumeFormats = MakeList(STANDARD_TEXTURE_FORMATS, HIDEF_TEXTURE_FORMATS, FLOAT_TEXTURE_FORMATS);
  116. ValidVertexTextureFormats = MakeList(FLOAT_TEXTURE_FORMATS);
  117. InvalidFilterFormats = MakeList(FLOAT_TEXTURE_FORMATS);
  118. InvalidBlendFormats = MakeList(STANDARD_FLOAT_TEXTURE_FORMATS);
  119. ValidVertexFormats = MakeList(STANDARD_VERTEX_FORMATS, HIDEF_VERTEX_FORMATS);
  120. break;
  121. default:
  122. throw gcnew ArgumentOutOfRangeException("graphicsProfile");
  123. }
  124. }