Graphics System called in application
This commit is contained in:
parent
ae8e30f120
commit
fe6c5be8c6
|
@ -59,8 +59,8 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;$(VULKAN_SDK)\include;..\Dependencies\VMA\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
|
@ -79,8 +79,8 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PreprocessorDefinitions>_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;$(VULKAN_SDK)\include;..\Dependencies\VMA\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
|
|
@ -22,6 +22,9 @@ project "SHADE_Application"
|
||||||
includedirs
|
includedirs
|
||||||
{
|
{
|
||||||
"%{IncludeDir.spdlog}/include",
|
"%{IncludeDir.spdlog}/include",
|
||||||
|
"%{IncludeDir.VULKAN}/include",
|
||||||
|
"%{IncludeDir.VMA}/include",
|
||||||
|
"%{IncludeDir.VULKAN}/Source/SPIRV-Reflect",
|
||||||
"../SHADE_Engine/src",
|
"../SHADE_Engine/src",
|
||||||
"src"
|
"src"
|
||||||
}
|
}
|
||||||
|
@ -40,6 +43,11 @@ project "SHADE_Application"
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defines
|
||||||
|
{
|
||||||
|
"NOMINMAX"
|
||||||
|
}
|
||||||
|
|
||||||
warnings 'Extra'
|
warnings 'Extra'
|
||||||
|
|
||||||
filter "configurations:Debug"
|
filter "configurations:Debug"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "SBpch.h"
|
#include "SBpch.h"
|
||||||
#include "SBApplication.h"
|
#include "SBApplication.h"
|
||||||
|
#include "Engine/ECS_Base/System/SHSystemManager.h"
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#include "Editor/SHEditor.h"
|
#include "Editor/SHEditor.h"
|
||||||
|
@ -23,6 +24,11 @@ namespace Sandbox
|
||||||
{
|
{
|
||||||
|
|
||||||
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
||||||
|
SHADE::SHSystemManager::CreateSystem<SHADE::SHGraphicsSystem>("Graphics System");
|
||||||
|
SHADE::SHGraphicsSystem* graphicsSystem = static_cast<SHADE::SHGraphicsSystem*>(SHADE::SHSystemManager::GetSystem("Graphics System"));
|
||||||
|
graphicsSystem->SetWindow(&window);
|
||||||
|
|
||||||
|
SHADE::SHSystemManager::Init();
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#else
|
#else
|
||||||
|
@ -44,6 +50,8 @@ namespace Sandbox
|
||||||
|
|
||||||
void SBApplication::Exit(void)
|
void SBApplication::Exit(void)
|
||||||
{
|
{
|
||||||
|
SHADE::SHSystemManager::Exit();
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef SB_APPLICATION_H
|
#ifndef SB_APPLICATION_H
|
||||||
#define SB_APPLICATION_H
|
#define SB_APPLICATION_H
|
||||||
#include <Graphics/Windowing/SHWindow.h>
|
#include <Graphics/Windowing/SHWindow.h>
|
||||||
|
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||||
//using namespace SHADE;
|
//using namespace SHADE;
|
||||||
|
|
||||||
namespace Sandbox
|
namespace Sandbox
|
||||||
|
|
|
@ -25,11 +25,8 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
SHGraphicsSystem::SHGraphicsSystem(SHWindow& window)
|
void SHGraphicsSystem::Init(void)
|
||||||
{
|
{
|
||||||
// Save the SHWindow
|
|
||||||
this->window = &window;
|
|
||||||
|
|
||||||
// Set Up Instance
|
// Set Up Instance
|
||||||
SHVkInstance::Init(true, true, true);
|
SHVkInstance::Init(true, true, true);
|
||||||
|
|
||||||
|
@ -39,10 +36,10 @@ namespace SHADE
|
||||||
device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice);
|
device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice);
|
||||||
|
|
||||||
// Construct surface
|
// Construct surface
|
||||||
surface = device->CreateSurface(window.GetHWND());
|
surface = device->CreateSurface(window->GetHWND());
|
||||||
|
|
||||||
// Construct Swapchain
|
// Construct Swapchain
|
||||||
auto windowDims = window.GetWindowSize();
|
auto windowDims = window->GetWindowSize();
|
||||||
swapchain = device->CreateSwapchain(surface, windowDims.first, windowDims.second, SHSwapchainParams
|
swapchain = device->CreateSwapchain(surface, windowDims.first, windowDims.second, SHSwapchainParams
|
||||||
{
|
{
|
||||||
.surfaceImageFormats {vk::Format::eB8G8R8A8Unorm, vk::Format::eR8G8B8A8Unorm, vk::Format::eB8G8R8Unorm, vk::Format::eR8G8B8Unorm},
|
.surfaceImageFormats {vk::Format::eB8G8R8A8Unorm, vk::Format::eR8G8B8A8Unorm, vk::Format::eB8G8R8Unorm, vk::Format::eR8G8B8Unorm},
|
||||||
|
@ -51,7 +48,7 @@ namespace SHADE
|
||||||
.vsyncOn = false, // TODO: Set to true when shipping game
|
.vsyncOn = false, // TODO: Set to true when shipping game
|
||||||
});
|
});
|
||||||
|
|
||||||
window.RegisterWindowSizeCallback([&]([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height)
|
window->RegisterWindowSizeCallback([&]([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height)
|
||||||
{
|
{
|
||||||
renderContext.SetIsResized(true);
|
renderContext.SetIsResized(true);
|
||||||
});
|
});
|
||||||
|
@ -127,7 +124,13 @@ namespace SHADE
|
||||||
/* RENDERGRAPH END TESTING */
|
/* RENDERGRAPH END TESTING */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
}
|
}
|
||||||
SHGraphicsSystem::~SHGraphicsSystem()
|
|
||||||
|
void SHGraphicsSystem::Run(float dt)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHGraphicsSystem::Exit(void)
|
||||||
{
|
{
|
||||||
//renderPass.Free();
|
//renderPass.Free();
|
||||||
renderContext.Destroy();
|
renderContext.Destroy();
|
||||||
|
@ -235,4 +238,10 @@ namespace SHADE
|
||||||
void SHGraphicsSystem::RemoveSegment(Handle<SHScreenSegment> segment)
|
void SHGraphicsSystem::RemoveSegment(Handle<SHScreenSegment> segment)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHGraphicsSystem::SetWindow(SHWindow* wind) noexcept
|
||||||
|
{
|
||||||
|
window = wind;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Graphics/MiddleEnd/PerFrame/SHRenderContext.h"
|
#include "Graphics/MiddleEnd/PerFrame/SHRenderContext.h"
|
||||||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||||
|
#include "Engine/ECS_Base/System/SHSystem.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ namespace SHADE
|
||||||
portions of the screen.
|
portions of the screen.
|
||||||
*/
|
*/
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
class SHGraphicsSystem
|
class SHGraphicsSystem : public SHSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -72,8 +73,15 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
SHGraphicsSystem(SHWindow& window);
|
SHGraphicsSystem (void) = default;
|
||||||
~SHGraphicsSystem();
|
~SHGraphicsSystem(void) noexcept = default;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* SHSystem overrides */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
virtual void Init(void) override;
|
||||||
|
virtual void Run (float dt) override;
|
||||||
|
virtual void Exit(void) override;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Lifecycle Functions */
|
/* Lifecycle Functions */
|
||||||
|
@ -93,6 +101,11 @@ namespace SHADE
|
||||||
Handle<SHScreenSegment> AddSegment(const VkViewport& viewport, Handle<SHVkImage> imageToUse);
|
Handle<SHScreenSegment> AddSegment(const VkViewport& viewport, Handle<SHVkImage> imageToUse);
|
||||||
void RemoveSegment(Handle<SHScreenSegment> segment);
|
void RemoveSegment(Handle<SHScreenSegment> segment);
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Setters */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
void SetWindow (SHWindow* wind) noexcept;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Getters (Temporary) */
|
/* Getters (Temporary) */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue