ProfileChecker.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //-----------------------------------------------------------------------------
  2. // ProfileChecker.h
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. #pragma once
  8. namespace XnaGraphicsProfileChecker
  9. {
  10. using namespace System;
  11. using namespace System::Collections::Generic;
  12. using namespace System::Collections::ObjectModel;
  13. using namespace Microsoft::Xna::Framework::Graphics;
  14. ref class ProfileCapabilities;
  15. // Checks whether the current graphics hardware meets XNA Framework profile requirements.
  16. ref class ProfileChecker
  17. {
  18. public:
  19. ProfileChecker(GraphicsProfile profile);
  20. // Does the current hardware support all the necessary features?
  21. property bool IsSupported
  22. {
  23. bool get() { return (errors->Count == 0); }
  24. };
  25. // If not, which features are missing?
  26. property ReadOnlyCollection<String^>^ Errors
  27. {
  28. ReadOnlyCollection<String^>^ get() { return gcnew ReadOnlyCollection<String^>(errors); }
  29. };
  30. private:
  31. List<String^>^ errors;
  32. void CheckProfileSupport(GraphicsProfile graphicsProfile, IDirect3D9* pD3D);
  33. void CheckTextureFormat(ProfileCapabilities^ profileCapabilities, IDirect3D9* pD3D, D3DRESOURCETYPE resourceType, SurfaceFormat format);
  34. void CheckVertexTextureFormat(ProfileCapabilities^ profileCapabilities, IDirect3D9* pD3D, SurfaceFormat format);
  35. void CheckRenderTargetFormat(ProfileCapabilities^ profileCapabilities, IDirect3D9* pD3D, SurfaceFormat format);
  36. static D3DFORMAT ConvertXnaFormatToDx(SurfaceFormat format);
  37. static String^ FormatResourceType(D3DRESOURCETYPE resourceType);
  38. static String^ FormatShaderVersion(unsigned shaderVersion);
  39. };
  40. }