Skip to content

Commit

Permalink
Rename graphics to platform
Browse files Browse the repository at this point in the history
  • Loading branch information
edisonlee0212 committed Sep 8, 2024
1 parent 48ad3f1 commit e450a76
Show file tree
Hide file tree
Showing 47 changed files with 566 additions and 575 deletions.
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/DigitalAgriculture/src/SorghumLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#endif
#include <SorghumLayer.hpp>
#include "ClassRegistry.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "SkyIlluminance.hpp"
#include "SorghumStateGenerator.hpp"
#include "Times.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Application.hpp"
#include "EditorLayer.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "Jobs.hpp"
#include "StrandModel.hpp"
#include "TreeModel.hpp"
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/EcoSysLab/src/ForestDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Climate.hpp"
#include "EcoSysLabLayer.hpp"
#include "EditorLayer.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "Tree.hpp"
using namespace eco_sys_lab;

Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/EcoSysLab/src/RadialBoundingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <Material.hpp>

#include "Graphics.hpp"
#include "Platform.hpp"
#include "PointCloud.hpp"
#include "Tree.hpp"

Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/EcoSysLab/src/Soil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "EcoSysLabLayer.hpp"
#include "EditorLayer.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "HeightField.hpp"
using namespace eco_sys_lab;

Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/EcoSysLab/src/TreeStructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <unordered_set>
#include "EcoSysLabLayer.hpp"
#include "FoliageDescriptor.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "rapidcsv.h"
using namespace eco_sys_lab;

Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/Universe/src/StarClusterSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Serialization.hpp"
#include "Resources.hpp"
#include "ClassRegistry.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "Jobs.hpp"
#include "Particles.hpp"
#include "Times.hpp"
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Core/Input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Input final {
static glm::vec2 GetMousePosition();

private:
friend class Graphics;
friend class Platform;
friend class Application;
friend class EditorLayer;
std::unordered_map<int, KeyActionType> pressed_keys_ = {};
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Layers/WindowLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "ILayer.hpp"
namespace evo_engine {
class WindowLayer final : public ILayer {
friend class Graphics;
friend class Platform;
friend class RenderLayer;
#pragma region Presenters
std::vector<GLFWmonitor*> monitors_;
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct CameraInfoBlock {
};

class Camera final : public IPrivateComponent {
friend class Graphics;
friend class Platform;
friend class RenderLayer;
friend class EditorLayer;
friend struct CameraInfoBlock;
Expand Down
16 changes: 8 additions & 8 deletions EvoEngine_SDK/include/Rendering/Geometry/GeometryStorage.hpp
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#pragma once
#include "Graphics.hpp"
#include "Platform.hpp"
#include "GraphicsResources.hpp"
#include "ISingleton.hpp"
#include "Vertex.hpp"

namespace evo_engine {
struct VertexDataChunk {
Vertex vertex_data[Graphics::Constants::meshlet_max_vertices_size] = {};
Vertex vertex_data[Platform::Constants::meshlet_max_vertices_size] = {};
};

struct Meshlet {
glm::u8vec3 triangles[Graphics::Constants::meshlet_max_triangles_size] = {}; // up to 126 triangles
glm::u8vec3 triangles[Platform::Constants::meshlet_max_triangles_size] = {}; // up to 126 triangles
uint32_t vertices_size = 0;
uint32_t triangle_size = 0;
uint32_t vertex_chunk_index = 0;
};

struct SkinnedVertexDataChunk {
SkinnedVertex skinned_vertex_data[Graphics::Constants::meshlet_max_vertices_size] = {};
SkinnedVertex skinned_vertex_data[Platform::Constants::meshlet_max_vertices_size] = {};
};
struct SkinnedMeshlet {
glm::u8vec3 skinned_triangles[Graphics::Constants::meshlet_max_triangles_size] = {}; // up to 126 triangles
glm::u8vec3 skinned_triangles[Platform::Constants::meshlet_max_triangles_size] = {}; // up to 126 triangles
uint32_t skinned_vertices_size = 0;
uint32_t skinned_triangle_size = 0;
uint32_t skinned_vertex_chunk_index = 0;
};

struct StrandPointDataChunk {
StrandPoint strand_point_data[Graphics::Constants::meshlet_max_vertices_size] = {};
StrandPoint strand_point_data[Platform::Constants::meshlet_max_vertices_size] = {};
};
struct StrandMeshlet {
glm::u8vec4 segments[Graphics::Constants::meshlet_max_triangles_size] = {}; // up to 126 triangles
glm::u8vec4 segments[Platform::Constants::meshlet_max_triangles_size] = {}; // up to 126 triangles
uint32_t strand_points_size = 0;
uint32_t segment_size = 0;
uint32_t strand_point_chunk_index = 0;
Expand Down Expand Up @@ -105,7 +105,7 @@ class GeometryStorage final {
void UploadData();
friend class RenderLayer;
friend class Resources;
friend class Graphics;
friend class Platform;
static void DeviceSync();
static void Initialize();

Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/Geometry/Mesh.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "Bound.hpp"
#include "GeometryStorage.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "GraphicsResources.hpp"
#include "IAsset.hpp"
#include "IGeometry.hpp"
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/Geometry/SkinnedMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SkinnedMesh : public IAsset, public IGeometry {
Bound bound_;
friend class SkinnedMeshRenderer;
friend class Particles;
friend class Graphics;
friend class Platform;
friend class RenderLayer;
SkinnedVertexAttributes skinned_vertex_attributes_ = {};
std::vector<SkinnedVertex> skinned_vertices_;
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/PBR/EnvironmentalMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace evo_engine {
class EnvironmentalMap final : public IAsset {
friend class Graphics;
friend class Platform;
friend class Camera;
friend class Environment;
friend class RenderLayer;
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/PBR/Material.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "AssetRef.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "IAsset.hpp"
#include "MaterialProperties.hpp"
#include "Texture2D.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace evo_engine {
class Shader;
class ComputePipeline final : public IGraphicsResource{
friend class Graphics;
friend class Platform;

std::unique_ptr<PipelineLayout> pipeline_layout_ = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct PipelineDynamicState {
#pragma endregion

class GraphicsPipeline final : public IGraphicsResource {
friend class Graphics;
friend class Platform;
friend class RenderLayer;
friend class GraphicsPipelineStates;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace evo_engine {
class GraphicsPipelineStates {
friend class Graphics;
friend class Platform;
VkViewport view_port_applied_ = {};
VkRect2D scissor_applied_ = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ImageView final : public IGraphicsResource {
VkComponentMapping components_;
VkImageSubresourceRange subresource_range_;
friend class Swapchain;
friend class Graphics;
friend class Platform;

public:
explicit ImageView(const VkImageViewCreateInfo& image_view_create_info);
Expand Down Expand Up @@ -332,7 +332,7 @@ class ShaderExt final : public IGraphicsResource {

enum class CommandBufferStatus { Ready, Recording, Recorded, Invalid };
class CommandBuffer final : public IGraphicsResource {
friend class Graphics;
friend class Platform;
CommandBufferStatus status_ = CommandBufferStatus::Invalid;
VkCommandBuffer vk_command_buffer_ = VK_NULL_HANDLE;

Expand All @@ -358,7 +358,7 @@ class CommandBuffer final : public IGraphicsResource {
};

class CommandQueue final : public IGraphicsResource {
friend class Graphics;
friend class Platform;
VkQueue vk_queue_ = VK_NULL_HANDLE;

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ struct SwapChainSupportDetails {
std::vector<VkPresentModeKHR> present_modes;
};

class Graphics final {
EVOENGINE_SINGLETON_INSTANCE(Graphics)
class Platform final {
EVOENGINE_SINGLETON_INSTANCE(Platform)
friend class Application;
friend class Resources;
friend class Lighting;
Expand Down Expand Up @@ -56,8 +56,7 @@ class Graphics final {

std::unique_ptr<CommandQueue> immediate_submit_queue_ {};

std::unique_ptr<CommandQueue> graphics_queue_{};
std::unique_ptr<CommandQueue> compute_queue_{};
std::unique_ptr<CommandQueue> main_queue_{};
std::unique_ptr<CommandQueue> present_queue_{};

std::shared_ptr<Swapchain> swapchain_ = {};
Expand Down Expand Up @@ -142,7 +141,7 @@ class Graphics final {
std::vector<std::vector<std::shared_ptr<CommandBuffer>>> command_buffer_pool_ = {};
std::shared_ptr<CommandBuffer> immediate_submit_command_buffer;
public:
static void RecordCommandsToMainGraphicsQueue(const std::function<void(VkCommandBuffer vk_command_buffer)>& action);
static void RecordCommandsMainQueue(const std::function<void(VkCommandBuffer vk_command_buffer)>& action);


double cpu_wait_time = 0.0f;
Expand Down Expand Up @@ -218,8 +217,7 @@ class Graphics final {
static uint32_t GetCurrentFrameIndex();
static uint32_t GetNextImageIndex();
static VkCommandPool GetVkCommandPool();
static const std::unique_ptr<CommandQueue>& GetGraphicsQueue();
static const std::unique_ptr<CommandQueue>& GetComputeQueue();
static const std::unique_ptr<CommandQueue>& GetMainQueue();
static const std::unique_ptr<CommandQueue>& GetImmediateSubmitQueue();
static const std::unique_ptr<CommandQueue>& GetPresentQueue();
static VmaAllocator GetVmaAllocator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SkinnedMeshRenderer : public IPrivateComponent {
friend class Prefab;
friend class RenderLayer;
void RenderBound(const std::shared_ptr<EditorLayer>& editor_layer, glm::vec4& color);
friend class Graphics;
friend class Platform;
bool rag_doll_ = false;
std::vector<glm::mat4> rag_doll_transform_chain_;
std::vector<EntityRef> bound_entities_;
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/Texture/Cubemap.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "Graphics.hpp"
#include "Platform.hpp"
#include "GraphicsResources.hpp"
#include "IAsset.hpp"
#include "Texture2D.hpp"
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/Texture/RenderTexture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct RenderTextureCreateInfo {
};

class RenderTexture {
friend class Graphics;
friend class Platform;
friend class RenderLayer;
friend class Camera;
std::shared_ptr<Image> color_image_ = {};
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_SDK/include/Rendering/Texture/TextureStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TextureStorage final {
std::vector<CubemapStorage> cubemaps_;

friend class RenderLayer;
friend class Graphics;
friend class Platform;
friend class Resources;
static void DeviceSync();

Expand Down
26 changes: 13 additions & 13 deletions EvoEngine_SDK/src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Cubemap.hpp"
#include "EditorLayer.hpp"
#include "EnvironmentalMap.hpp"
#include "Graphics.hpp"
#include "Platform.hpp"
#include "Input.hpp"
#include "Jobs.hpp"
#include "Json.hpp"
Expand Down Expand Up @@ -96,7 +96,7 @@ void Application::PreUpdateInternal() {

application.application_execution_status_ = ApplicationExecutionStatus::PreUpdate;
Input::PreUpdate();
Graphics::PreUpdate();
Platform::PreUpdate();

if (application.application_status_ == ApplicationStatus::NoProject)
return;
Expand Down Expand Up @@ -239,19 +239,19 @@ void Application::LateUpdateInternal() {
}
}

Graphics::RecordCommandsToMainGraphicsQueue([&](const VkCommandBuffer vk_command_buffer) {
Graphics::EverythingBarrier(vk_command_buffer);
Platform::RecordCommandsMainQueue([&](const VkCommandBuffer vk_command_buffer) {
Platform::EverythingBarrier(vk_command_buffer);
constexpr VkClearValue clear_color = {{{0.0f, 0.0f, 0.0f, 1.0f}}};
VkRect2D render_area;
render_area.offset = {0, 0};
render_area.extent = Graphics::GetSwapchain()->GetImageExtent();
Graphics::TransitImageLayout(vk_command_buffer, Graphics::GetSwapchain()->GetVkImage(),
Graphics::GetSwapchain()->GetImageFormat(), 1, VK_IMAGE_LAYOUT_UNDEFINED,
render_area.extent = Platform::GetSwapchain()->GetImageExtent();
Platform::TransitImageLayout(vk_command_buffer, Platform::GetSwapchain()->GetVkImage(),
Platform::GetSwapchain()->GetImageFormat(), 1, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

VkRenderingAttachmentInfo color_attachment_info{};
color_attachment_info.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
color_attachment_info.imageView = Graphics::GetSwapchain()->GetVkImageView();
color_attachment_info.imageView = Platform::GetSwapchain()->GetVkImageView();
color_attachment_info.imageLayout = VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR;
color_attachment_info.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
color_attachment_info.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
Expand All @@ -270,8 +270,8 @@ void Application::LateUpdateInternal() {
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), vk_command_buffer);

vkCmdEndRendering(vk_command_buffer);
Graphics::TransitImageLayout(vk_command_buffer, Graphics::GetSwapchain()->GetVkImage(),
Graphics::GetSwapchain()->GetImageFormat(), 1,
Platform::TransitImageLayout(vk_command_buffer, Platform::GetSwapchain()->GetVkImage(),
Platform::GetSwapchain()->GetImageFormat(), 1,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR);
});

Expand Down Expand Up @@ -299,7 +299,7 @@ void Application::LateUpdateInternal() {
if (application.application_status_ == ApplicationStatus::Step)
application.application_status_ = ApplicationStatus::Pause;
}
Graphics::LateUpdate();
Platform::LateUpdate();
}

const ApplicationInfo& Application::GetApplicationInfo() {
Expand Down Expand Up @@ -346,9 +346,9 @@ void Application::Initialize(const ApplicationInfo& application_create_info) {
Jobs::Initialize(default_thread_size - 2);
Entities::Initialize();
TransformGraph::Initialize();
Graphics::Initialize();
Platform::Initialize();
Resources::Initialize();
Graphics::PostResourceLoadingInitialization();
Platform::PostResourceLoadingInitialization();
Resources::InitializeEnvironmentalMap();

for (const auto& layer : application.layers_) {
Expand Down
Loading

0 comments on commit e450a76

Please sign in to comment.