Moved stuff around + start of graphics device support (dx12)
This commit is contained in:
@@ -141,86 +141,91 @@
|
||||
<ClInclude Include="src\Core\HAL\Event\WindowEvent.h"/>
|
||||
<ClInclude Include="src\Core\Networking\SocketPlatformImpl.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Win32.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12compatibility.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12sdklayers.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12shader.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\D3D12TokenizedProgramFormat.hpp"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12video.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dcommon.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_barriers.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_check_feature_support.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_core.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_default.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_pipeline_state_stream.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_property_format_table.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_render_pass.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_resource_helpers.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_root_signature.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_state_object.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\DirectML.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxcore.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxcore_interface.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxgicommon.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxgiformat.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\dxguids\dxguids.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\basetsd.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\oaidl.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\ocidl.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\rpc.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\rpcndr.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\unknwn.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\unknwnbase.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\winapifamily.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\wrl\client.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\wrl\implements.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\winadapter.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\wrladapter.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\DX12Includes.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\DX12Utils.h"/>
|
||||
<ClInclude Include="src\Graphics\GraphicsDevice.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Display.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32Window.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\Keyboard.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\KeyboardMapping.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\Mouse.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\SystemEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\WindowEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\Juliet.cpp"/>
|
||||
<ClCompile Include="src\Core\Logging\LogManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp"/>
|
||||
<ClCompile Include="src\Engine\Engine.cpp"/>
|
||||
<ClCompile Include="src\Graphics\Graphics.cpp"/>
|
||||
<ClCompile Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_property_format_table.cpp"/>
|
||||
<ClCompile Include="src\Graphics\RHI\DX12\D3D12\dxguids\dxguids.cpp"/>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp" />
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Display.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32Window.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\Keyboard.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\KeyboardMapping.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\Mouse.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\SystemEvent.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\WindowEvent.cpp" />
|
||||
<ClCompile Include="src\Core\Juliet.cpp" />
|
||||
<ClCompile Include="src\Core\Logging\LogManager.cpp" />
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp" />
|
||||
<ClCompile Include="src\Engine\Engine.cpp" />
|
||||
<ClCompile Include="src\Graphics\DX12\DX12GraphicsDevice.cpp" />
|
||||
<ClCompile Include="src\Graphics\Graphics.cpp">
|
||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SupportJustMyCode>true</SupportJustMyCode>
|
||||
<AssemblerOutput>NoListing</AssemblerOutput>
|
||||
<AssemblerListingLocation>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</AssemblerListingLocation>
|
||||
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
|
||||
<BrowseInformationFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</BrowseInformationFile>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ConformanceMode>Default</ConformanceMode>
|
||||
<DiagnosticsFormat>Column</DiagnosticsFormat>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<EnableASAN>false</EnableASAN>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
<ModuleDependenciesFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</ModuleDependenciesFile>
|
||||
<OmitDefaultLibName>false</OmitDefaultLibName>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<ObjectFileName>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</ObjectFileName>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\Juliet.pch</PrecompiledHeaderOutputFile>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
|
||||
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<SourceDependenciesFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</SourceDependenciesFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<SmallerTypeCheck>false</SmallerTypeCheck>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<TrackerLogDirectory>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\Juliet.tlog\</TrackerLogDirectory>
|
||||
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<XMLDocumentationFileName>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</XMLDocumentationFileName>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<IntelJCCErratum>false</IntelJCCErratum>
|
||||
<BuildStlModules>false</BuildStlModules>
|
||||
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;JULIET_WIN32;_UNICODE;UNICODE;</PreprocessorDefinitions>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<LibCompiled>true</LibCompiled>
|
||||
<ClangClMode>true</ClangClMode>
|
||||
<MSCVersion>Default</MSCVersion>
|
||||
<AdditionalOptions>--target=amd64-pc-windows-msvc </AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="include\Core\Thread\Mutex.h"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12compatibility.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12sdklayers.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12video.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3dcommon.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\dxgicommon.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\dxgiformat.idl"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="include\Graphics\RHI\"/>
|
||||
<Content Include="include\Core\Thread\Mutex.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -12,9 +12,10 @@ namespace Juliet
|
||||
enum class LogCategory : uint8
|
||||
{
|
||||
Core = 0,
|
||||
Networking = 1,
|
||||
Engine = 2,
|
||||
Editor = 3,
|
||||
Game = 4,
|
||||
Graphics = 1,
|
||||
Networking = 2,
|
||||
Engine = 3,
|
||||
Editor = 4,
|
||||
Game = 5,
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#include <Graphics/GraphicsConfig.h>
|
||||
|
||||
// Graphics Interface
|
||||
namespace Juliet::Graphics
|
||||
namespace Juliet
|
||||
{
|
||||
// Add functions to create windows, device, attach to the window etc...
|
||||
} // namespace Juliet::Graphics
|
||||
struct GraphicsDevice;
|
||||
|
||||
extern GraphicsDevice* CreateGraphicsDevice(GraphicsConfig config);
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class RendererType
|
||||
{
|
||||
DX12 = 0
|
||||
};
|
||||
enum class RendererType : uint8
|
||||
{
|
||||
Any = 0,
|
||||
DX12 = 1,
|
||||
};
|
||||
|
||||
struct GraphicsConfig
|
||||
{
|
||||
RendererType Renderer = RendererType::DX12;
|
||||
};
|
||||
}
|
||||
struct GraphicsConfig
|
||||
{
|
||||
RendererType PreferredRenderer = RendererType::DX12;
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Juliet
|
||||
{
|
||||
DisplayDevice* CurrentDisplayDevice = nullptr;
|
||||
|
||||
// TODO : IfDef new factories that are not compatible
|
||||
constexpr DisplayDeviceFactory* Factories[] = { &Win32DisplayDeviceFactory, nullptr };
|
||||
} // namespace
|
||||
|
||||
|
||||
28
Juliet/src/Graphics/DX12/DX12GraphicsDevice.cpp
Normal file
28
Juliet/src/Graphics/DX12/DX12GraphicsDevice.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Graphics/GraphicsDevice.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// TODO : Use DLL instead of static link
|
||||
namespace
|
||||
{
|
||||
bool CheckDriver()
|
||||
{
|
||||
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
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Graphics/RHI/DX12/DX12Includes.h>
|
||||
|
||||
namespace Juliet::RHI::DX12
|
||||
{
|
||||
inline void AssertOnFailure(HRESULT hr)
|
||||
@@ -1,8 +1,60 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Graphics/Graphics.h>
|
||||
#include <Graphics/GraphicsDevice.h>
|
||||
|
||||
namespace Juliet::Graphics
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
GraphicsDevice* CurrentGraphicsDevice = nullptr;
|
||||
|
||||
} // namespace Juliet::Graphics
|
||||
// TODO : IfDef new factories that are not compatible
|
||||
// Low chance of porting on something else than windows though. May be linux but will use vulkan that works on windows
|
||||
constexpr GraphicsDeviceFactory* Factories[] = { &DX12DeviceFactory };
|
||||
|
||||
GraphicsDeviceFactory* ChooseFactory(GraphicsConfig config)
|
||||
{
|
||||
// First try to check the preferred renderer from the config if any.
|
||||
if (config.PreferredRenderer != RendererType::Any)
|
||||
{
|
||||
for (GraphicsDeviceFactory* factory : Factories)
|
||||
{
|
||||
// If the config has a preferred renderer, immediately pick it up.
|
||||
if (factory->Type == config.PreferredRenderer)
|
||||
{
|
||||
if (factory->CheckDriver())
|
||||
{
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If not preferred renderer was set, use the first one that works in the list
|
||||
for (GraphicsDeviceFactory* factory : Factories)
|
||||
{
|
||||
// TODO : Make sure it's supported by querying it first. If supported -> Lets go
|
||||
if (factory->CheckDriver())
|
||||
{
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
||||
Log(LogLevel::Error, LogCategory::Graphics, "CreateGraphicsDevice::ChooseFactory: No valid driver found");
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
GraphicsDevice* CreateGraphicsDevice(GraphicsConfig config)
|
||||
{
|
||||
GraphicsDeviceFactory* chosenFactory = ChooseFactory(config);
|
||||
if (chosenFactory)
|
||||
{
|
||||
GraphicsDevice* newDevice = chosenFactory->CreateGraphicsDevice();
|
||||
newDevice->Name = chosenFactory->Name;
|
||||
return newDevice;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace Juliet
|
||||
|
||||
20
Juliet/src/Graphics/GraphicsDevice.h
Normal file
20
Juliet/src/Graphics/GraphicsDevice.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <Graphics/GraphicsConfig.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct GraphicsDevice
|
||||
{
|
||||
const char* Name = "Unknown";
|
||||
};
|
||||
|
||||
struct GraphicsDeviceFactory
|
||||
{
|
||||
const char* Name = "Unknown";
|
||||
RendererType Type = RendererType::Any;
|
||||
bool (*CheckDriver)(void);
|
||||
GraphicsDevice* (*CreateGraphicsDevice)(void);
|
||||
};
|
||||
|
||||
extern GraphicsDeviceFactory DX12DeviceFactory;
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
// TODO : Replace with message box from framework + call main and not winmain + subsystem
|
||||
#include <Graphics/Graphics.h>
|
||||
#include <Windows.h>
|
||||
|
||||
namespace Juliet
|
||||
@@ -22,7 +23,8 @@ namespace Juliet
|
||||
MainWindow = CreatePlatformWindow("Juliet Editor", 1280, 720);
|
||||
|
||||
GraphicsConfig config;
|
||||
// InitializeGraphics(config);
|
||||
GraphicsDevice* device = CreateGraphicsDevice(config);
|
||||
Assert(!device && "Currently not implemented so device should be null");
|
||||
|
||||
Running = MainWindow != nullptr;
|
||||
}
|
||||
@@ -31,7 +33,7 @@ namespace Juliet
|
||||
{
|
||||
Log(LogLevel::Message, LogCategory::Editor, "Shutdown Editor Application...");
|
||||
|
||||
if (MainWindow )
|
||||
if (MainWindow)
|
||||
{
|
||||
DestroyPlatformWindow(MainWindow);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user