43 lines
853 B
C++
43 lines
853 B
C++
#ifndef RT_DX11_GPU_HPP
|
|
#define RT_DX11_GPU_HPP
|
|
|
|
#include <wrl.h>
|
|
#include <d3d11.h>
|
|
#include <d3d11_1.h>
|
|
#include <dxgi1_3.h>
|
|
|
|
#include "runtime/threading.h"
|
|
#include "gfx/renderer_api.h"
|
|
|
|
#define RT_DX11_MAX_FRAMES_IN_FLIGHT 2
|
|
|
|
// Smart pointer for COM-Objects
|
|
template<typename T>
|
|
using ComPtr = Microsoft::WRL::ComPtr<T>;
|
|
|
|
struct rt_swap_chain {
|
|
ComPtr<IDXGISwapChain1> swap_chain;
|
|
ComPtr<ID3D11RenderTargetView> rtv;
|
|
};
|
|
|
|
|
|
struct rt_gpu {
|
|
ComPtr<ID3D11Device1> device;
|
|
ComPtr<ID3D11DeviceContext1> device_context;
|
|
ComPtr<IDXGIFactory2> dxgi_factory;
|
|
|
|
rt_swap_chain swap_chain;
|
|
|
|
rt_mutex *context_lock;
|
|
|
|
D3D_FEATURE_LEVEL feature_level;
|
|
D3D11_FEATURE_DATA_THREADING threading_support;
|
|
};
|
|
|
|
#ifndef DONT_DEFINE_GPU_GLOBAL
|
|
extern rt_gpu g_gpu;
|
|
#endif
|
|
|
|
DXGI_FORMAT rtConvertPixelFormat(rt_pixel_format format);
|
|
|
|
#endif |