From 67528aaee1356d21987b6e919ab2287cbfff9a85 Mon Sep 17 00:00:00 2001 From: Patedam Date: Sat, 1 Mar 2025 11:01:42 -0500 Subject: [PATCH] - Various clang reformat - Added shader compiler app (doing nothing) - Various Project files changes --- Game/Game.vcxproj | 6 +- Juliet.sln | 9 + Juliet/Juliet.vcxproj | 180 +++++++++--------- Juliet/include/Core/Logging/LogManager.h | 2 +- Juliet/include/Core/Math/Shape.h | 2 +- Juliet/include/Core/Thread/Thread.h | 2 +- Juliet/include/Graphics/RenderPass.h | 10 +- .../Core/HAL/Display/Win32/Win32Window.cpp | 6 +- Juliet/src/Core/HAL/Filesystem/Filesystem.cpp | 2 +- .../Core/HAL/Filesystem/Filesystem_Platform.h | 2 +- .../Core/HAL/Filesystem/Filesystem_Private.h | 2 +- .../Core/HotReload/Win32/Win32HotReload.cpp | 6 +- Juliet/src/Graphics/D3D12/D3D12Shader.cpp | 16 ++ Juliet/src/Graphics/D3D12/D3D12Shader.h | 6 + Juliet/src/Graphics/D3D12/D3D12Texture.h | 6 +- Juliet/src/Graphics/D3D12/DX12CommandList.h | 2 +- Juliet/src/Graphics/D3D12/DX12Includes.h | 6 + JulietApp/JulietApp.vcxproj | 122 ++++++------ JulietApp/main.cpp | 4 +- 19 files changed, 218 insertions(+), 173 deletions(-) create mode 100644 Juliet/src/Graphics/D3D12/D3D12Shader.cpp create mode 100644 Juliet/src/Graphics/D3D12/D3D12Shader.h diff --git a/Game/Game.vcxproj b/Game/Game.vcxproj index dc46a10..ce519ae 100644 --- a/Game/Game.vcxproj +++ b/Game/Game.vcxproj @@ -72,7 +72,7 @@ true Juliet.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) - $(SolutionDir)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\lib\$(Platform)\$(Configuration)\ $(OutDir)$(TargetName)_$(Random).pdb @@ -94,12 +94,12 @@ true true true - $(SolutionDir)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\lib\$(Platform)\$(Configuration)\ Juliet.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) - + diff --git a/Juliet.sln b/Juliet.sln index 7f6d579..b5756bb 100644 --- a/Juliet.sln +++ b/Juliet.sln @@ -15,6 +15,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Game", "Game\Game.vcxproj", {1BBC0B92-E4D8-4838-974B-439C5C501E82} = {1BBC0B92-E4D8-4838-974B-439C5C501E82} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JulietShaderCompiler", "JulietShaderCompiler\JulietShaderCompiler.vcxproj", "{26880364-45F4-4817-BFD3-0ACC0958757D}" + ProjectSection(ProjectDependencies) = postProject + {1BBC0B92-E4D8-4838-974B-439C5C501E82} = {1BBC0B92-E4D8-4838-974B-439C5C501E82} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -33,6 +38,10 @@ Global {B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Debug|x64.Build.0 = Debug|x64 {B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Release|x64.ActiveCfg = Release|x64 {B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Release|x64.Build.0 = Release|x64 + {26880364-45F4-4817-BFD3-0ACC0958757D}.Debug|x64.ActiveCfg = Debug|x64 + {26880364-45F4-4817-BFD3-0ACC0958757D}.Debug|x64.Build.0 = Debug|x64 + {26880364-45F4-4817-BFD3-0ACC0958757D}.Release|x64.ActiveCfg = Release|x64 + {26880364-45F4-4817-BFD3-0ACC0958757D}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Juliet/Juliet.vcxproj b/Juliet/Juliet.vcxproj index fc6b95e..e9444ce 100644 --- a/Juliet/Juliet.vcxproj +++ b/Juliet/Juliet.vcxproj @@ -71,6 +71,7 @@ true ws2_32.lib;dxgi.lib;dxguid.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + $(SolutionDir)\lib\$(Platform)\$(Configuration)\$(TargetName).lib @@ -99,6 +100,7 @@ true true ws2_32.lib;d3d12.lib;dxgi.lib;dxguid.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + $(SolutionDir)\lib\$(Platform)\$(Configuration)\$(TargetName).lib @@ -113,94 +115,96 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MultiThreadedDebugDll Disabled @@ -261,8 +265,8 @@ - - + + diff --git a/Juliet/include/Core/Logging/LogManager.h b/Juliet/include/Core/Logging/LogManager.h index 2655932..b7d6999 100644 --- a/Juliet/include/Core/Logging/LogManager.h +++ b/Juliet/include/Core/Logging/LogManager.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include // TODO : Juliet strings #include diff --git a/Juliet/include/Core/Math/Shape.h b/Juliet/include/Core/Math/Shape.h index 05cfe9f..39044b9 100644 --- a/Juliet/include/Core/Math/Shape.h +++ b/Juliet/include/Core/Math/Shape.h @@ -9,4 +9,4 @@ namespace Juliet int32 Width; int32 Height; }; -} \ No newline at end of file +} // namespace Juliet diff --git a/Juliet/include/Core/Thread/Thread.h b/Juliet/include/Core/Thread/Thread.h index 9950085..091052b 100644 --- a/Juliet/include/Core/Thread/Thread.h +++ b/Juliet/include/Core/Thread/Thread.h @@ -14,4 +14,4 @@ namespace Juliet { } } -} +} // namespace Juliet diff --git a/Juliet/include/Graphics/RenderPass.h b/Juliet/include/Graphics/RenderPass.h index 358e6f7..b5abb46 100644 --- a/Juliet/include/Graphics/RenderPass.h +++ b/Juliet/include/Graphics/RenderPass.h @@ -23,18 +23,18 @@ namespace Juliet struct ColorTargetInfo { Texture* TargetTexture; - uint32 MipLevel; + uint32 MipLevel; union { uint32 DepthPlane; uint32 LayerIndex; }; - bool CycleTexture; // Whether the texture should be cycled if already bound (and load operation != LOAD) + bool CycleTexture; // Whether the texture should be cycled if already bound (and load operation != LOAD) Texture* ResolveTexture; - uint32 ResolveMipLevel; - uint32 ResolveLayerIndex; - bool CycleResolveTexture; + uint32 ResolveMipLevel; + uint32 ResolveLayerIndex; + bool CycleResolveTexture; FColor ClearColor; LoadOperation LoadOperation; diff --git a/Juliet/src/Core/HAL/Display/Win32/Win32Window.cpp b/Juliet/src/Core/HAL/Display/Win32/Win32Window.cpp index 2712249..61b51cf 100644 --- a/Juliet/src/Core/HAL/Display/Win32/Win32Window.cpp +++ b/Juliet/src/Core/HAL/Display/Win32/Win32Window.cpp @@ -9,7 +9,7 @@ namespace Juliet::Win32 { namespace { - constexpr auto WindowClassName = L"JulietWindowClass"; + constexpr auto WindowClassName = L"JulietWindowClass"; constexpr LPCWSTR WindowClassPtr = WindowClassName; bool SetupWindowState(NonNullPtr self, NonNullPtr window, HWND handle) @@ -46,7 +46,7 @@ namespace Juliet::Win32 HINSTANCE instance = GetModuleHandle(nullptr); // TODO : Put outside, we should not create a new class for each new window - WNDCLASSEX WindowClass = {}; + WNDCLASSEX WindowClass = {}; WindowClass.cbSize = sizeof(WNDCLASSEX); WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; WindowClass.lpfnWndProc = Win32MainWindowCallback; @@ -65,7 +65,7 @@ namespace Juliet::Win32 int x = CW_USEDEFAULT, y = CW_USEDEFAULT; const int w = window->Width, h = window->Height; HWND handle = CreateWindowEx(styleEx, WindowClassPtr, L"JULIET TODO PASS TITLE", style, x, y, w, h, nullptr, - nullptr, instance, nullptr); + nullptr, instance, nullptr); PumpEvents(self); diff --git a/Juliet/src/Core/HAL/Filesystem/Filesystem.cpp b/Juliet/src/Core/HAL/Filesystem/Filesystem.cpp index c1c07cf..08b2d67 100644 --- a/Juliet/src/Core/HAL/Filesystem/Filesystem.cpp +++ b/Juliet/src/Core/HAL/Filesystem/Filesystem.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include namespace Juliet diff --git a/Juliet/src/Core/HAL/Filesystem/Filesystem_Platform.h b/Juliet/src/Core/HAL/Filesystem/Filesystem_Platform.h index 7f2fd12..2a2bcf0 100644 --- a/Juliet/src/Core/HAL/Filesystem/Filesystem_Platform.h +++ b/Juliet/src/Core/HAL/Filesystem/Filesystem_Platform.h @@ -3,4 +3,4 @@ namespace Juliet::Platform { extern char* GetBasePath(); -} \ No newline at end of file +} diff --git a/Juliet/src/Core/HAL/Filesystem/Filesystem_Private.h b/Juliet/src/Core/HAL/Filesystem/Filesystem_Private.h index 8a599bd..c138b01 100644 --- a/Juliet/src/Core/HAL/Filesystem/Filesystem_Private.h +++ b/Juliet/src/Core/HAL/Filesystem/Filesystem_Private.h @@ -4,4 +4,4 @@ namespace Juliet { extern void InitFilesystem(); extern void ShutdownFilesystem(); -} \ No newline at end of file +} // namespace Juliet diff --git a/Juliet/src/Core/HotReload/Win32/Win32HotReload.cpp b/Juliet/src/Core/HotReload/Win32/Win32HotReload.cpp index 8b3ff3b..5c24a2d 100644 --- a/Juliet/src/Core/HotReload/Win32/Win32HotReload.cpp +++ b/Juliet/src/Core/HotReload/Win32/Win32HotReload.cpp @@ -23,8 +23,8 @@ namespace Juliet return lastWriteTime; } - constexpr size_t kMaxAttempts = 256; - constexpr size_t kMaxDLLID = 256; + constexpr size_t kMaxAttempts = 256; + constexpr size_t kMaxDLLID = 256; constexpr size_t kTempDLLBufferSizeForID = 6; // ID numbers + \0 } // namespace @@ -52,7 +52,7 @@ namespace Juliet size_t basePathLength = strlen(basePath); const size_t tempDllMaxBufferSize = basePathLength + code.TransientDLLName.Size + kTempDLLBufferSizeForID; - auto tempDllPath = static_cast(Calloc(tempDllMaxBufferSize, sizeof(char))); + auto tempDllPath = static_cast(Calloc(tempDllMaxBufferSize, sizeof(char))); for (uint32 attempt = 0; attempt < kMaxAttempts; ++attempt) { // int to char diff --git a/Juliet/src/Graphics/D3D12/D3D12Shader.cpp b/Juliet/src/Graphics/D3D12/D3D12Shader.cpp new file mode 100644 index 0000000..836c9db --- /dev/null +++ b/Juliet/src/Graphics/D3D12/D3D12Shader.cpp @@ -0,0 +1,16 @@ +#include + +#include + +namespace Juliet::D3D12 +{ + namespace + { + void CompileShader(const char* shaderFile) {} + } // namespace + + void LoadShader(const char* shaderFile) + { + CompileShader(shaderFile); + } +} // namespace Juliet::D3D12 diff --git a/Juliet/src/Graphics/D3D12/D3D12Shader.h b/Juliet/src/Graphics/D3D12/D3D12Shader.h new file mode 100644 index 0000000..278479e --- /dev/null +++ b/Juliet/src/Graphics/D3D12/D3D12Shader.h @@ -0,0 +1,6 @@ +#pragma once + +namespace Juliet::D3D12 +{ + extern void LoadShader(const char* shaderFile); +} diff --git a/Juliet/src/Graphics/D3D12/D3D12Texture.h b/Juliet/src/Graphics/D3D12/D3D12Texture.h index eca7cd6..83e6602 100644 --- a/Juliet/src/Graphics/D3D12/D3D12Texture.h +++ b/Juliet/src/Graphics/D3D12/D3D12Texture.h @@ -70,9 +70,9 @@ namespace Juliet::D3D12 D3D12_RESOURCE_STATES newTextureUsage); extern D3D12TextureSubresource* FetchTextureSubresource(NonNullPtr container, uint32 layer, uint32 level); - extern void TextureSubresourceBarrier(NonNullPtr commandList, - D3D12_RESOURCE_STATES sourceState, D3D12_RESOURCE_STATES destinationState, - NonNullPtr textureSubresource); + extern void TextureSubresourceBarrier(NonNullPtr commandList, + D3D12_RESOURCE_STATES sourceState, D3D12_RESOURCE_STATES destinationState, + NonNullPtr textureSubresource); // Texture usage transition extern void TextureSubresourceTransitionFromDefaultUsage(NonNullPtr commandList, diff --git a/Juliet/src/Graphics/D3D12/DX12CommandList.h b/Juliet/src/Graphics/D3D12/DX12CommandList.h index e07b7d0..e3acce1 100644 --- a/Juliet/src/Graphics/D3D12/DX12CommandList.h +++ b/Juliet/src/Graphics/D3D12/DX12CommandList.h @@ -46,7 +46,7 @@ namespace Juliet::D3D12 uint32 PresentDataCount; D3D12Fence* InFlightFence; - bool AutoReleaseFence; + bool AutoReleaseFence; D3D12GraphicsCommandListData GraphicsCommandList; D3D12GraphicsCommandListData ComputeCommandList; diff --git a/Juliet/src/Graphics/D3D12/DX12Includes.h b/Juliet/src/Graphics/D3D12/DX12Includes.h index e895801..7a86458 100644 --- a/Juliet/src/Graphics/D3D12/DX12Includes.h +++ b/Juliet/src/Graphics/D3D12/DX12Includes.h @@ -17,6 +17,12 @@ #include #include "d3d12.h" +#include +// TODO: Should not use this when shipping +// Prebake the shaders and embed .dxil files +// When not shipping, thats ok to compile them +// #include + #ifdef _DEBUG #include #endif diff --git a/JulietApp/JulietApp.vcxproj b/JulietApp/JulietApp.vcxproj index 3e3db5d..b24df86 100644 --- a/JulietApp/JulietApp.vcxproj +++ b/JulietApp/JulietApp.vcxproj @@ -11,69 +11,73 @@ + + {b7b12dcc-1a69-4371-a9fe-d6e7671497b0} + Game + {1bbc0b92-e4d8-4838-974b-439c5c501e82} Juliet - + - - MultiThreadedDebugDll - Disabled - true - NoListing - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ - false - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ - Default - Default - Column - false - false - false - NotSet - Fast - Default - false - stdcpp20 - Default - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ - false - Neither - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ - Cdecl - NotUsing - stdafx.h - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\JulietApp.pch - false - false - false - false - false - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ - true - true - false - Default - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\JulietApp.tlog\ - true - false - Level3 - W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ - ProgramDatabase - false - false - true - _DEBUG;JULIET_WIN32;_UNICODE;UNICODE; - false - true - true - Default - --target=amd64-pc-windows-msvc - + + MultiThreadedDebugDll + Disabled + true + NoListing + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ + false + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ + Default + Default + Column + false + false + false + NotSet + Fast + Default + false + stdcpp20 + Default + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ + false + Neither + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ + Cdecl + NotUsing + stdafx.h + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\JulietApp.pch + false + false + false + false + false + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ + true + true + false + Default + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\JulietApp.tlog\ + true + false + Level3 + W:\Classified\Juliet\Intermediate\JulietApp\x64\Debug\ + ProgramDatabase + false + false + true + _DEBUG;JULIET_WIN32;_UNICODE;UNICODE; + false + true + true + Default + --target=amd64-pc-windows-msvc + 17.0 @@ -111,12 +115,8 @@ $(SolutionDir)Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)Juliet\include\;$(SolutionDir)JulietApp;$(IncludePath) - $(SolutionDir)\bin\$(Platform)\$(Configuration)\;$(LibraryPath) - $(SolutionDir)Juliet\include\;$(SolutionDir)JulietApp;$(IncludePath) - $(SolutionDir)\bin\$(Platform)\$(Configuration)\;$(LibraryPath) $(SolutionDir)\bin\$(Platform)\$(Configuration)\ $(SolutionDir)Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ @@ -130,11 +130,13 @@ false Fast false + $(SolutionDir)Juliet\include\;$(SolutionDir)JulietApp;$(IncludePath) Console true Juliet.lib;%(AdditionalDependencies) + $(SolutionDir)\lib\$(Platform)\$(Configuration)\ @@ -152,6 +154,7 @@ false Fast false + $(SolutionDir)Juliet\include\;$(SolutionDir)JulietApp;$(IncludePath) Console @@ -159,6 +162,7 @@ true true Juliet.lib;%(AdditionalDependencies) + $(SolutionDir)\lib\$(Platform)\$(Configuration)\ diff --git a/JulietApp/main.cpp b/JulietApp/main.cpp index 4ea920a..daba1c3 100644 --- a/JulietApp/main.cpp +++ b/JulietApp/main.cpp @@ -58,12 +58,12 @@ void JulietApplication::Init() if (Running) { AttachToWindow(GraphicsDevice, MainWindow); - //Game = LoadDynamicLibrary("Game.dll"); + // Game = LoadDynamicLibrary("Game.dll"); GameCode.Functions = reinterpret_cast(&Game); GameCode.FunctionCount = ArraySize(GameFunctionTable); GameCode.FunctionNames = GameFunctionTable; - InitHotReloadCode(GameCode, StringBufferParam("Game.dll"),StringBufferParam("Game_Temp.dll"), StringBufferParam("lock.tmp")); + InitHotReloadCode(GameCode, StringBufferParam("Game.dll"), StringBufferParam("Game_Temp.dll"), StringBufferParam("lock.tmp")); if ((Running = GameCode.IsValid)) { Game.Init();