|
|
#pragma once |
|
|
|
|
|
#include "Context.h" |
|
|
|
|
|
|
|
|
#include "../../include/NvFlex.h" |
|
|
|
|
|
#include <d3d11.h> |
|
|
#include <d3d11_1.h> |
|
|
|
|
|
#if ENABLE_D3D12 |
|
|
#include <d3d12.h> |
|
|
#endif |
|
|
|
|
|
#include <external/nvapi/include/nvapi.h> |
|
|
|
|
|
#include <dxgi.h> |
|
|
#include <string> |
|
|
#include <vector> |
|
|
|
|
|
#define ENABLE_LIVE_DEVICE_OBJECTS_REPORTING 0 |
|
|
#define USE_NVAPI_DEVICE 1 |
|
|
|
|
|
struct FlexDeviceDesc |
|
|
{ |
|
|
FlexDeviceDesc() : mDeviceNumber(-1), mDevice(nullptr), mComputeCommandQueue(nullptr), mRenderCommandQueue(nullptr), useComputeQueue(false), enablePresent(false) {} |
|
|
virtual ~FlexDeviceDesc() {} |
|
|
unsigned int mDeviceNumber; |
|
|
void * mDevice; |
|
|
void * mComputeCommandQueue; |
|
|
void * mRenderCommandQueue; |
|
|
bool useComputeQueue; |
|
|
bool enablePresent; |
|
|
|
|
|
NvFlexErrorCallback mErrorFunc; |
|
|
}; |
|
|
|
|
|
namespace NvFlex |
|
|
{ |
|
|
|
|
|
struct Device : public NvFlexObject |
|
|
{ |
|
|
Device(); |
|
|
virtual ~Device(); |
|
|
|
|
|
virtual Context* createContext() = 0; |
|
|
|
|
|
virtual NvAPI_Status NvAPI_IsNvShaderExtnOpCodeSupported(NvU32 opCode, bool * pSupported) = 0; |
|
|
|
|
|
#if ENABLE_AMD_AGS |
|
|
virtual AGSReturnCode AGS_DriverExtensions_Init(AGSContext* agsContext, unsigned int agsApiSlot, unsigned int *extensionsSupported) = 0; |
|
|
virtual void AGS_DeInit(AGSContext* agsContext) = 0; |
|
|
#endif |
|
|
|
|
|
virtual DXGI_ADAPTER_DESC1 getDXGIAdapter(void* d3ddevice, int & deviceNumber) = 0; |
|
|
virtual DXGI_ADAPTER_DESC1 getDeviceNumber(const LUID adapterID, int & deviceNumber); |
|
|
virtual std::vector<IDXGIAdapter1 *> enumerateDXGIAdapters(); |
|
|
virtual void queryDeviceCapabilities(void* d3ddevice); |
|
|
|
|
|
virtual void reportLiveDeviceObjects() {} |
|
|
|
|
|
|
|
|
virtual void createWindow(); |
|
|
virtual void present() = 0; |
|
|
|
|
|
WNDCLASSEX mWindowDesc; |
|
|
RECT mWinRect; |
|
|
HWND m_hWnd; |
|
|
IDXGISwapChain* m_swapChain; |
|
|
|
|
|
|
|
|
IDXGIFactory1* m_pFactory; |
|
|
|
|
|
NvFlexUint mSMCount; |
|
|
std::string mDeviceName; |
|
|
|
|
|
GpuVendorId mGpuVendorId; |
|
|
bool mD3D12Device; |
|
|
Context* m_context; |
|
|
}; |
|
|
} |
|
|
|