nvapi.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright 2011-2020 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef BGFX_NVAPI_H_HEADER_GUARD
  6. #define BGFX_NVAPI_H_HEADER_GUARD
  7. struct ID3D11Device;
  8. struct ID3D11DeviceContext;
  9. struct ID3D11Buffer;
  10. struct ID3D12Device;
  11. struct ID3D12CommandList;
  12. namespace bgfx
  13. {
  14. struct NvPhysicalGpuHandle;
  15. struct NvAftermathContextHandle;
  16. struct NvAftermathDeviceStatus
  17. {
  18. enum Enum
  19. {
  20. Active,
  21. Timeout,
  22. OutOfMemory,
  23. PageFault,
  24. Unknown,
  25. NotInitialized
  26. };
  27. };
  28. typedef void (*PFN_NVAPI_MULTIDRAWINDIRECT)(ID3D11DeviceContext* _deviceCtx, uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride);
  29. ///
  30. struct NvApi
  31. {
  32. ///
  33. NvApi();
  34. ///
  35. void init();
  36. ///
  37. void shutdown();
  38. ///
  39. bool isInitialized() const { return NULL != m_nvGpu; }
  40. ///
  41. void getMemoryInfo(int64_t& _gpuMemoryUsed, int64_t& _gpuMemoryMax);
  42. ///
  43. bool loadAftermath();
  44. ///
  45. bool initAftermath(const ID3D11Device* _device, const ID3D11DeviceContext* _deviceCtx);
  46. ///
  47. bool initAftermath(const ID3D12Device* _device, const ID3D12CommandList* _commandList);
  48. ///
  49. NvAftermathDeviceStatus::Enum getDeviceStatus() const;
  50. ///
  51. void shutdownAftermath();
  52. ///
  53. void setMarker(const bx::StringView& _marker);
  54. ///
  55. void* m_nvApiDll;
  56. NvPhysicalGpuHandle* m_nvGpu;
  57. void* m_nvAftermathDll;
  58. NvAftermathContextHandle* m_aftermathHandle;
  59. PFN_NVAPI_MULTIDRAWINDIRECT nvApiD3D11MultiDrawInstancedIndirect;
  60. PFN_NVAPI_MULTIDRAWINDIRECT nvApiD3D11MultiDrawIndexedInstancedIndirect;
  61. };
  62. } // namespace bgfx
  63. #endif // BGFX_NVAPI_H_HEADER_GUARD