Some directx cleaning.

This commit is contained in:
jmsgrogan 2023-01-06 13:03:51 +00:00
parent 850bd6906f
commit 55ed0e9299
19 changed files with 900 additions and 487 deletions

View file

@ -0,0 +1,61 @@
#pragma once
#include <wrl.h>
#include <dwrite.h>
#include <d2d1_3.h>
#include <d3d11on12.h>
struct ID3D12Device;
struct IDXGIFactory7;
struct IDXGIAdapter1;
struct ID3D12CommandQueue;
struct ID3D11DeviceContext;
struct ID3D11On12Device;
struct IDWriteFactory;
struct ID2D1Factory3;
struct ID2D1Device2;
struct ID2D1DeviceContext2;
class Win32DxInterface
{
public:
IDXGIFactory7* getDxgiFactory() const;
ID3D12Device* getD3dDevice() const;
ID3D12CommandQueue* getCommandQueue() const;
ID3D11On12Device* get11On12Device() const;
ID3D11DeviceContext* getD3d11DeviceContext() const;
ID2D1Factory3* getD2dFactory() const;
ID2D1DeviceContext2* getD2dContext() const;
IDWriteFactory* getDirectWriteFactory() const;
void initialize();
bool isValid() const;
private:
bool createD3dFactory();
bool createD3dDevice(IDXGIAdapter1* ppAdapter);
bool createCommandQueue();
void getHardwareAdapter(IDXGIAdapter1** ppAdapter);
bool initializeD2d();
bool initializeD11on12();
bool initializeDirectWrite();
bool mIsValid{ false };
Microsoft::WRL::ComPtr<IDXGIFactory7> mDxgiFactory;
Microsoft::WRL::ComPtr<ID3D12Device> mD3dDevice;
Microsoft::WRL::ComPtr<ID3D12CommandQueue> mCommandQueue;
// 2D Rendering - e.g. text
Microsoft::WRL::ComPtr<ID3D11DeviceContext> mD3d11DeviceContext;
Microsoft::WRL::ComPtr<ID3D11On12Device> mD3d11On12Device;
Microsoft::WRL::ComPtr<ID2D1Factory3> mD2dFactory;
Microsoft::WRL::ComPtr<ID2D1Device2> mD2dDevice;
Microsoft::WRL::ComPtr<ID2D1DeviceContext2> mD2dDeviceContext;
Microsoft::WRL::ComPtr<IDWriteFactory> mDWriteFactory;
};