Files
Juliet/Juliet/src/Graphics/D3D12/DX12GraphicsDevice.cpp
Patedam 836d0fa185 Fixing issues with DirectX and includes.
Removed d3dx12 as its not usable with the CINTERFACE define.
2025-01-11 20:03:31 -05:00

59 lines
1.9 KiB
C++

#include <pch.h>
#include <Graphics/D3D12/DX12Includes.h>
#include <Graphics/GraphicsDevice.h>
namespace Juliet
{
// TODO : Use LoadLibrary and not link to the lib. Allows failing earlier if Dx12 is not installed for some reason
// + Will load the dll when needed
// This will prevent us from using IID_ variables as they are defined in dxguid.lib
namespace
{
bool CheckDriver()
{
HRESULT result;
// ID3D12Device *device;
IDXGIFactory4* factory4;
IDXGIFactory6* factory6;
IDXGIAdapter1* adapter;
ID3D12Object* test;
// Can create DXGI factory ?
IDXGIFactory1* factory1 = nullptr;
result = CreateDXGIFactory1(IID_IDXGIFactory1, reinterpret_cast<void**>(&factory1));
if (FAILED(result))
{
Log(LogLevel::Warning, LogCategory::Graphics, "DX12: Cannot create DXGIFactory1");
return false;
}
// Can query the 1.4 factory ?
result = IDXGIFactory1_QueryInterface(factory1, IID_IDXGIFactory4, reinterpret_cast<void**>(&factory4));
if (FAILED(result))
{
IDXGIFactory1_Release(factory1);
Log(LogLevel::Warning, LogCategory::Graphics, "DX12: Failed to query DXGI1.4.");
return false;
}
IDXGIFactory4_Release(factory4);
IDXGIFactory1_Release(factory1);
return false;
}
GraphicsDevice* CreateGraphicsDevice()
{
return nullptr;
}
} // namespace
// clang-format off
GraphicsDeviceFactory DX12DeviceFactory = {
.Name="DirectX12",
.Type=RendererType::DX12,
.CheckDriver = CheckDriver,
.CreateGraphicsDevice = CreateGraphicsDevice };
// clang-format on
} // namespace Juliet