Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6cd5849
Batched device resources into a separate class
Beeeton Jun 25, 2026
eef969c
Removed unnecessary systems
Beeeton Jun 25, 2026
4d7677b
Fixed incorrect device feature collecting
Beeeton Jun 25, 2026
1713e4d
small fixes
Beeeton Jun 26, 2026
62f4972
Moved GPU Culling to a separate pass
Beeeton Jun 26, 2026
16a101e
Moved part of RenderPasses to separate class №1
Beeeton Jun 27, 2026
7f7a3d9
Moved all render passes to separate classes
Beeeton Jun 27, 2026
496496e
Added motion vector calculation
Beeeton Jun 29, 2026
c94fc7a
Added customizable render pipeline
Beeeton Jun 29, 2026
04402f8
Added sync flag to swapchain
Beeeton Jun 29, 2026
f443518
small fixes
Beeeton Jun 29, 2026
f60099c
Added secondary GPU data upload
Beeeton Jun 30, 2026
dad1408
Added texture transfering between GPUs
Beeeton Jul 1, 2026
1e9bef8
Upscaling pass preparations
Beeeton Jul 2, 2026
63aaf59
Better RenderPass Data distribution
Beeeton Jul 2, 2026
4f38490
FSR Upscaling pass implementation
Beeeton Jul 2, 2026
90bc7fe
Better render pass linking
Beeeton Jul 3, 2026
b7c783d
Device sync pass & bug fixes
Beeeton Jul 3, 2026
f506b75
Better RenderPass creation
Beeeton Jul 3, 2026
3b9b118
fixed memory leaks
Beeeton Jul 3, 2026
e22621f
FIX OR REVERT: mGPU render pipeline
Beeeton Jul 3, 2026
fddf966
some fixes
DvornikovArtem Jul 3, 2026
511cf23
cleanup
Beeeton Jul 3, 2026
43ad114
Easier, order-independent render pass linking
Beeeton Jul 4, 2026
d64c2d0
wrapped inputs&outputs into functions
Beeeton Jul 4, 2026
51db3a8
FIX OR REVERT: leaking render passes
Beeeton Jul 4, 2026
4f8c80b
Fixed memory leaks
Beeeton Jul 4, 2026
073097b
Added N inputs support for render passes
Beeeton Jul 4, 2026
b38ab25
Add xess
DvornikovArtem Jul 4, 2026
890ca85
Add nvidia streamline
DvornikovArtem Jul 5, 2026
fff6a73
Revert "Add nvidia streamline"
Beeeton Jul 5, 2026
4f181ba
XeSS upscaling preparations
Beeeton Jul 5, 2026
f6928b9
Fix nvidia sdk
DvornikovArtem Jul 5, 2026
90e11de
XeSS upscaling pass implementation
Beeeton Jul 5, 2026
ad14a0d
DLSS upscaling preparations
Beeeton Jul 5, 2026
b155bde
Active camera jittering implementation
Beeeton Jul 5, 2026
ecf424d
FSR & XeSS-SR quality improvements
Beeeton Jul 6, 2026
d1de559
Streamline SDK integration & DLSS upscaling
Beeeton Jul 6, 2026
596950c
Bug fixes
Beeeton Jul 6, 2026
6b2f412
QoL fixes
Beeeton Jul 6, 2026
9dff79c
added back scene loading
Beeeton Jul 6, 2026
9a9d69f
QoL refactorings
Beeeton Jul 7, 2026
bcbf199
XeSS ghosting fixes
Beeeton Jul 7, 2026
a735511
Other upscalers quality improvements
Beeeton Jul 7, 2026
b973e2e
RenderPass linking bug fixes
Beeeton Jul 7, 2026
30d520b
Cross-GPU transferring bug fixes
Beeeton Jul 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Apps/App.Base/App.Base.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
<ClInclude Include="Include\App.Base\Systems\GPUDataUpdateSystem.h" />
<ClInclude Include="Include\App.Base\Systems\LookAtTargetSystem.h" />
<ClInclude Include="Include\App.Base\Systems\MovementSystem.h" />
<ClInclude Include="Include\App.Base\Systems\RenderSubmitSystem.h" />
<ClInclude Include="Include\App.Base\Systems\SplineFollowSystem.h" />
<ClInclude Include="Include\App.Base\Window.h" />
</ItemGroup>
Expand Down Expand Up @@ -171,4 +170,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
5 changes: 1 addition & 4 deletions Apps/App.Base/App.Base.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
<ClInclude Include="Include\App.Base\Systems\MovementSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Include\App.Base\Systems\RenderSubmitSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Include\App.Base\Systems\GPUDataUpdateSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -117,4 +114,4 @@
<Filter>Source Files\ECS</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

#include "Engine.Core/ECS/Component.h"
#include <cstdint>
#include "Engine.RendererDX12/D3DHelpers.h"

struct CameraComponent : ComponentTag
{
float FOV;
float NearPlane;
float FarPlane;
Matrix ViewProj;
Matrix PrevViewProjNoJitter;

bool DirtyFlag;

CameraComponent()
: DirtyFlag(true), _numFramesDirty(0), _CBufferIndex(0),
FOV(60.0f), NearPlane(0.1f), FarPlane(10000.f)
FOV(60.0f), NearPlane(0.1f), FarPlane(10000.f), ViewProj(Identity4x4()), PrevViewProjNoJitter(Identity4x4())
{
}

Expand Down
102 changes: 44 additions & 58 deletions Apps/App.Base/Include/App.Base/Modules/RenderModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,14 @@

#include "Common/GameTimer.h"
#include "Common/Module.h"
#include "Engine.RendererDX12/D3DHelpers.h"
#include "Engine.RendererDX12/GDX12Device.h"
#include "Engine.RendererDX12/GDX12DescriptorHeap.h"
#include "Engine.RendererDX12/GDX12FrameConstants.h"
#include "Engine.RendererDX12/GDX12RootSignature.h"
#include "Engine.RendererDX12/GDX12SwapChain.h"
#include "Engine.RendererDX12/GDX12Texture.h"
#include "Engine.RendererDX12/GDX12Material.h"
#include "Engine.RendererDX12/GDX12GeometryBuffer.h"
#include "Engine.RendererDX12/GDX12RenderCommandRecorder.h"

#include "Engine.Core/Types/TextureTypes.h"

#include "Engine.RendererDX12/RenderPasses/GDX12RenderPass.h"
#include "Engine.Core/ECS/Entity.h"
#include "Engine.Core/ECS/Event.h"

class SceneManagerModule;
class World;
class GDX12SwapChain;

struct TransformComponent;
struct CameraComponent;
Expand All @@ -30,9 +21,10 @@ using namespace Engine::Core;

struct TransformCompGPUData
{
UINT CBufferIndex;
UINT NumFramesDirty;
Matrix World;
UINT CBufferIndex = -1;
UINT NumFramesDirty = -1;
Matrix World = Identity4x4();
Matrix PrevWorld = Identity4x4();
};

class RenderModule final : public Module
Expand All @@ -44,19 +36,21 @@ class RenderModule final : public Module
void Initialize() override;
void Uninitialize() override;

void OnResize() const;
void OnResize();

GDX12Material* GetMaterialByName(const std::string& name);

//returns a pointer to a fully initialized structure that you can specify in components
GDX12Material* CreateMaterial(const std::string& name);

GDX12Texture* GetTextureByName(const std::string& name);
GPUTexture* GetTextureByName(const std::string& name);
//returns a pointer to a fully initialized structure that you can specify in materials
GDX12Texture* CreateTexture(const std::string& name, const Texture* texture);
GPUTexture* CreateTexture(const std::string& name, const Texture* texture);

//Uploads Mesh geometry to GPU
void SubmitMesh(const Mesh* mesh, MeshHandle handle);

void SetActiveCamera(CameraComponent* camera);

struct WorldRenderSubscriptions
{
Expand Down Expand Up @@ -96,10 +90,18 @@ class RenderModule final : public Module
void OnRenderComponentUpdated(World& world, Entity entity, StaticMeshRenderComponent& component);

const float GetAspectRatio();
GDX12RenderCommandRecorder* GetCommandRecorder();
GDX12FrameConstants* GetCurrentFrameConstants();
const GPUMesh* GetGPUMesh(MeshHandle handle);
GDX12UploadBuffer<GDX12IndirectDrawArgs>* GetIndirectCommandsCache();
GDX12FrameConstants* GetCurrentPrimaryFrameConstants();
GDX12FrameConstants* GetCurrentSecondaryFrameConstants();
const GPUMesh* GetPrimaryGPUMesh(MeshHandle handle);
const GPUMesh* GetSecondaryGPUMesh(MeshHandle handle);
GDX12UploadBuffer<GDX12IndirectDrawArgs>* GetPrimaryIndirectCommandsCache();
GDX12UploadBuffer<GDX12IndirectDrawArgs>* GetSecondaryIndirectCommandsCache();

uint32_t GetPrimaryPipelineFlags();
uint32_t GetSecondaryPipelineFlags();
RenderPipelineCommonData* GetRenderPipelineCommonData();
bool PrimaryPipelineHasFlag(uint32_t flag);
bool SecondaryPipelineHasFlag(uint32_t flag);

protected:
void OnUpdate() override;
Expand All @@ -109,19 +111,18 @@ class RenderModule final : public Module
bool ShouldRender() override;

private:
void BuildDescHeapsAndBackBuffer();
void BuildRootSignatures();
void BuildShaders();
void BuildPSOs();
void BuildFrameConstants();

void UpdateMainCB();
void UpdateMaterialCB();
void BuildBackBuffer();
void ShareFences();
void ConfigureRenderPipeline();
void SetupRenderPasses();
void InitializeRenderPasses();

void SubscribeToSceneManager();
void UnsubscribeFromSceneManager();
void UnsubscribeFromAllWorlds();

GDX12Texture* CreateDX12Texture(const std::string& name, GDX12DeviceResources* resources, const Texture* texture);

GameTimer* _timer;
Window* _window;

Expand All @@ -130,42 +131,27 @@ class RenderModule final : public Module

std::unordered_map<Entity, TransformCompGPUData> _transformGPUData;
std::unordered_map<World*, WorldRenderSubscriptions> _worldSubscriptions;

GDX12RenderCommandRecorder _commandRecorder;
RenderPipelineCommonData _RPcommonData;

std::unique_ptr<GDX12Device> _primaryDevice;
std::unique_ptr<GDX12Device> _secondaryDevice;
bool _dualGPUMode;

std::unordered_map<std::string, std::vector<D3D12_INPUT_ELEMENT_DESC>> _inputLayouts;
GDX12DeviceResources _primaryResources;
GDX12DeviceResources _secondaryResources;
std::unordered_map<std::string, std::unique_ptr<GPUTexture>> _textures;
std::unordered_map<std::string, std::unique_ptr<GDX12Material>> _materials;

// All of class members below should probably be put into DeviceResources class, and made for each device
// Since all of these resources are currently existing on _primaryDevice only
std::unique_ptr<GDX12GeometryBuffer> _geometryBuffer;

// All heaps created in one high-capacity instance
std::unique_ptr<GDX12DescriptorHeap> _rtvHeap;
std::unique_ptr<GDX12DescriptorHeap> _srvuavHeap;
std::unique_ptr<GDX12DescriptorHeap> _dsvHeap;

std::vector<std::unique_ptr<GDX12FrameConstants>> _frameConstants;
UINT _currFrameConstantsIndex;

std::unique_ptr<GDX12UploadBuffer<GDX12IndirectDrawArgs>> _IndirectCommandsCache;

std::unordered_map<std::string, ComPtr<ID3DBlob>> _shaders;
std::unordered_map<std::string, ComPtr<ID3D12PipelineState>> _PSOs;
std::unordered_map<std::string, std::unique_ptr<GDX12RootSignature>> _rootSignatures;
std::unordered_map <std::string, ComPtr<ID3D12CommandSignature>> _commandSignatures;

std::unordered_map<std::string, std::unique_ptr<GDX12Texture>> _textures;

// These two resources are made on _primaryDevice only
std::unique_ptr<GDX12SwapChain> _backBuffer;
std::unique_ptr<GDX12Texture> _depthStencil;

std::unique_ptr<GDX12Texture> _opaqueAccumTexture;
std::unique_ptr<GDX12Texture> _transparencyAccumTexture;
std::unique_ptr<GDX12Texture> _transparencyRevealageTexture;

// Sorted in execution order
std::vector<std::unique_ptr<GDX12RenderPass>> _primaryRenderPassExecutionList;
std::vector<std::unique_ptr<GDX12RenderPass>> _secondaryRenderPassExecutionList;

// Flags that are accumulated from every active RenderPass on the device
// Defines which resources should be uploaded onto respective GPU
uint32_t _primaryPipelineFlags;
uint32_t _secondaryPipelineFlags;
};
Loading