BsD3D11Device.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsD3D11Prerequisites.h"
  5. namespace bs { namespace ct
  6. {
  7. /** @addtogroup D3D11
  8. * @{
  9. */
  10. /** Available DX11 error levels. */
  11. enum BS_D3D11_ERROR_LEVEL
  12. {
  13. D3D11ERR_NO_EXCEPTION,
  14. D3D11ERR_CORRUPTION,
  15. D3D11ERR_ERROR,
  16. D3D11ERR_WARNING,
  17. D3D11ERR_INFO
  18. };
  19. /** Wrapper around DirectX 11 device object. */
  20. class D3D11Device
  21. {
  22. public:
  23. /** Constructs the object with a previously created DX11 device. */
  24. D3D11Device(ID3D11Device* device);
  25. ~D3D11Device();
  26. /** Shuts down the device any releases any internal resources. */
  27. void shutdown();
  28. /** Returns DX11 immediate context object. */
  29. ID3D11DeviceContext* getImmediateContext() const { return mImmediateContext; }
  30. /** Returns DX11 class linkage object. */
  31. ID3D11ClassLinkage* getClassLinkage() const { return mClassLinkage; }
  32. /** Returns internal DX11 device. */
  33. ID3D11Device* getD3D11Device() const { return mD3D11Device; }
  34. /** Resets error state & error messages. */
  35. void clearErrors();
  36. /**
  37. * Query if error occurred at any point since last clearErrors() call. Use getErrorDescription to get a string
  38. * describing the error.
  39. */
  40. bool hasError() const;
  41. /** Returns a string describing an error if one occurred. */
  42. String getErrorDescription(bool clearErrors = true);
  43. /**
  44. * Sets the level for which we want to receive errors for. Errors will be reported for the provided level and any
  45. * higher priority level.
  46. */
  47. void setExceptionsErrorLevel(const BS_D3D11_ERROR_LEVEL exceptionsErrorLevel);
  48. private:
  49. D3D11Device();
  50. ID3D11Device* mD3D11Device;
  51. ID3D11DeviceContext* mImmediateContext;
  52. ID3D11InfoQueue* mInfoQueue;
  53. ID3D11ClassLinkage* mClassLinkage;
  54. };
  55. /** @} */
  56. }}