Skip to content

Commit 31b9186

Browse files
authored
Merge pull request #23 from aka411/feature/render-system-redesign
Feature/render system redesign
2 parents 232a941 + 6d6755b commit 31b9186

34 files changed

Lines changed: 232 additions & 256 deletions

include/asset-system/texture_system.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ namespace TheEngine::AssetSystem
3737

3838
TextureSystem(RenderingSystem::ITextureManager& textureManager, TheEngine::Platform::Platform& platform);
3939

40-
RenderingSystem::TextureHandle createNewTexture(RenderingSystem::TextureCreateInfo& textureCreateInfo);
40+
RenderingSystem::TextureHandle createNewTexture(const RenderingSystem::TextureCreateInfo& textureCreateInfo);
4141

4242
//A helper method primarily created to help create default textures and materials
43-
RenderingSystem::TextureCreateInfo createDefaultTexture(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
43+
RenderingSystem::TextureHandle createDefaultTexture(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
4444
//Use Path
4545
RenderingSystem::TextureHandle loadTexture(const TheEngine::Platform::Path& path);//allow sampler settings also?
4646

include/engine/engine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace TheEngine
1515

1616
private:
1717

18-
//use pimpl?
18+
1919
TheEngine::Platform::Platform m_platform;
2020
TheEngine::RenderingSystem::RenderingSystem m_renderingSystem;
2121
TheEngine::AssetSystem::AssetSystem m_assetSystem;

include/engine/engine_core_data_types.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,28 @@ namespace TheEngine
1313
};
1414

1515

16+
17+
struct Extend2D
18+
{
19+
uint32_t width{ 0 };
20+
uint32_t height{ 0 };
21+
};
22+
1623
struct WindowExtent
1724
{
18-
// The size in screen coordinates (logical), similar to css pixels
19-
uint32_t width = 0;
20-
uint32_t height = 0;
21-
22-
// The size in actual pixels (physical) , the framebuffer size, the size considering Device Pixel Density(or is it dpi)
23-
//Frame buffer Size
24-
uint32_t physicalWidth = 0;
25-
uint32_t physicalHeight = 0;
25+
Extend2D logical{};
26+
Extend2D framebuffer{};
2627
};
2728

29+
30+
2831
struct EngineConfiguration
2932
{
3033

31-
TheEngine::RenderingAPI renderingAPI;
34+
TheEngine::RenderingAPI renderingAPI{ RenderingAPI::VULKAN_1_3};
3235

33-
//This is the ;ogical pixels not frame buffer size
34-
int windowWidth;
35-
int windowHeight;
36+
37+
Extend2D logicalWindowExtend{};
3638

3739

3840
std::string windowName;

include/memory-management/memory_block.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace TheEngine::Memory
88
class MemoryBlock
99
{
1010
private:
11-
std::byte* m_data = nullptr;
12-
size_t m_sizeInBytes = 0;
11+
std::byte* m_data{ nullptr };
12+
size_t m_size{ 0 };
1313

1414

1515

include/rendering-system/api-backend/vulkan/vulkan-only/vulkan_texture_store.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace TheEngine::RenderingSystem::VulkanBackend
4949

5050
VulkanTextureStore(VulkanContext& vulkanContext, VulkanSamplerManager& vulkanSamplerManager);
5151

52-
TextureHandle createNewTexture(TextureCreateInfo& textureCreateInfo, std::vector<TextureMetadata>& textureRegistry);
52+
TextureHandle createNewTexture(const TextureCreateInfo& textureCreateInfo, std::vector<TextureMetadata>& textureRegistry);
5353
void destroyTexture(const TextureHandle& textureHandle, std::vector<TextureMetadata>& textureRegistry);
5454

5555

include/rendering-system/api-backend/vulkan/vulkan_texture_manager.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ namespace TheEngine::RenderingSystem::VulkanBackend
3030

3131
virtual ~VulkanTextureManager() override;
3232

33-
virtual TextureHandle createNewTexture(TextureCreateInfo& textureCreateInfo) override;
33+
34+
virtual TextureHandle createTexture(const TextureCreateInfo& info) override;
35+
virtual TextureHandle createTexture(const TextureCreateInfo& info, TheEngine::Memory::MemoryBlock&& initialData) override;
3436

3537
virtual void destroyTexture(const TextureHandle& textureHandle) override;
3638

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#pragma once
2+
#include <rendering-system/engine_handles.h>
3+
#include <rendering-system/gpu-resource-system/data-structures/gpu_mesh_system_data_structures.h>
4+
#include <rendering-system/gpu-resource-system/data-structures/gpu_material_system_data_structures.h>
5+
6+
namespace TheEngine::RenderingSystem
7+
{
8+
9+
class GPUResourceSystem;
10+
11+
class GPUResourceResolver
12+
{
13+
14+
private:
15+
16+
GPUResourceSystem& m_gpuResourceSystem;
17+
18+
public:
19+
20+
GPUResourceResolver(GPUResourceSystem& gpuResourceSystem);
21+
22+
const BufferHandle getMeshBufferHandle(const VertexFormat& vertexFormat, const BufferResourceUsageHint& bufferResourceUsageHint) const;
23+
const BufferHandle getIndexBufferhandle(const IndexFormat& indexFormat, const BufferResourceUsageHint& bufferResourceUsageHint) const;
24+
const BufferHandle getMaterialBufferHandle(const ShadingModel& shadingModel) const;
25+
26+
27+
//const BufferHandle getAnimationBufferHandle() const;
28+
29+
};
30+
31+
32+
33+
}

include/rendering-system/render-graph/i_render_graph_node.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
namespace TheEngine::RenderingSystem
55
{
6-
class RenderGraphBuilder;
6+
class RenderGraphBuilder;
7+
class GPUResourceResolver;
78

89
class IRenderGraphNode
910
{
@@ -16,11 +17,11 @@ namespace TheEngine::RenderingSystem
1617
virtual ~IRenderGraphNode() = default;
1718

1819
virtual void setUp(RenderPassSetupContext& ctx, RenderGraphBuilder& builder) = 0;
19-
virtual void execute(RenderPassExecuteContext& ctx) = 0;
20+
virtual void execute(RenderPassExecuteContext& ctx, GPUResourceResolver& gpuResourceResolver) = 0;
2021

21-
virtual void onResize(const WindowExtent& extent, RenderGraphBuilder& builder) = 0;
22+
//virtual void onResize(const WindowExtent& extent, RenderGraphBuilder& builder) = 0;
2223

23-
virtual std::string getName() const = 0;
24+
//virtual std::string getName() const = 0;
2425

2526

2627
};

include/rendering-system/render-graph/render_graph.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <rendering-system/render-graph/render_graph_types.h>
99
#include <rendering-system/render-graph/render_graph_builder.h>
10-
#include <rendering-system/render-graph/i_render_graph_node.h>
11-
10+
#include <rendering-system/render-graph/i_render_graph_node.h>
11+
#include <rendering-system/render-graph/gpu_resource_resolver.h>
1212

1313

1414
namespace TheEngine::RenderingSystem
@@ -30,24 +30,28 @@ namespace TheEngine::RenderingSystem
3030

3131
std::vector<std::unique_ptr<IRenderGraphNode>> m_renderGraphNodes;
3232

33+
private:
34+
3335
RenderGraphBuilder m_renderGraphBuilder;
3436

3537
RenderPassSetupContext m_renderPassSetupContext;
3638

37-
WindowExtent m_currenWindowExtend;
39+
WindowExtent m_currenWindowExtend;//REMOVE
40+
41+
private:
3842

43+
GPUResourceResolver m_gpuResourceResolver;
3944

4045
public:
4146

42-
RenderGraph(IRenderDevice& renderDevice, const RenderPassSetupContext& renderPassSetupContext);
47+
RenderGraph(IRenderDevice& renderDevice, const RenderPassSetupContext& renderPassSetupContext,GPUResourceSystem& gpuResourceSystem);
4348

4449

4550

4651
void addPass(std::unique_ptr<IRenderGraphNode>&& renderGraphNode);
4752

4853

4954

50-
//These methods below should be hidden
5155
void compile();
5256

5357
void execute(RenderPassExecuteContext& renderPassExecuteContext);

include/rendering-system/render-graph/render_graph_builder.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,28 @@
33
#include <unordered_map>
44
#include <rendering-system/engine_handles.h>
55
#include <rendering-system/rhi/data-structures/gpu_texture_data_structures.h>
6+
#include <map>
67

78

89
namespace TheEngine::RenderingSystem
910
{
11+
12+
1013
class IRenderDevice;
1114

15+
1216
class RenderGraphBuilder
1317
{
1418

1519
private:
1620

1721
IRenderDevice& m_renderDevice;
1822

19-
//ResourceRegistry& m_resourceRegistry;
2023
std::unordered_map<std::string, TextureHandle> m_textureResources;
24+
// std::unordered_map<TextureHandle, std::string> m_textureResourcesMapping;
25+
// std::map<uint64_t, TextureHandle> m_textureBufferResource;
2126

22-
23-
//FRAME DATA
27+
//FRAME DATA
2428

2529

2630

@@ -35,15 +39,11 @@ namespace TheEngine::RenderingSystem
3539
TextureHandle readTexture(const std::string& name);//string based look up
3640
TextureHandle writeTexture(const std::string& name);
3741

38-
39-
void deleteTexture(const TextureHandle textureHandle);
40-
41-
};
42-
43-
42+
TextureHandle writeSwapChainImage();
4443

4544

4645

46+
};
4747

4848

4949
}

0 commit comments

Comments
 (0)