Graphics pipeline creation is working

This commit is contained in:
2025-03-11 22:45:21 -04:00
parent a9fe4683fb
commit 0d93cd9e6d
13 changed files with 461 additions and 46 deletions

View File

@@ -9,12 +9,12 @@
#include <Core/Logging/LogTypes.h>
#include <Graphics/Graphics.h>
#include <Graphics/GraphicsConfig.h>
#include <Graphics/GraphicsPipeline.h>
#include <Graphics/RenderPass.h>
#include <Core/Common/String.h>
#include <Core/Memory/Utils.h>
#include <cstdlib>
#include <Graphics/GraphicsPipeline.h>
// TODO : Replace with message box from framework + call main and not winmain + subsystem
// TODO : Think how to do the draw pipeline.
@@ -49,6 +49,9 @@ void JulietApplication::Init()
Log(LogLevel::Message, LogCategory::Tool, "%s", CStr(GetBasePath()));
GraphicsConfig config;
#if JULIET_DEBUG
config.EnableDebug = true;
#endif
GraphicsDevice = CreateGraphicsDevice(config);
MainWindow = CreatePlatformWindow("Juliet Editor", 1280, 720);
@@ -81,13 +84,18 @@ void JulietApplication::Init()
pipelineCI.VertexShader = vertexShader;
pipelineCI.FragmentShader = fragmentShader;
pipelineCI.PrimitiveType = PrimitiveType::TriangleList;
pipelineCI.TargetInfo = {
.ColorTargetDescriptions = &colorTargetDescription,
.NumColorTargets = 1,
};
pipelineCI.RasterizerState.FillMode = FillMode::Solid;
pipelineCI.TargetInfo = { .ColorTargetDescriptions = &colorTargetDescription,
.NumColorTargets = 1,
.DepthStencilFormat = {},
.HasDepthStencilTarget = false };
pipelineCI.RasterizerState.FillMode = FillMode::Solid;
GraphicsPipeline* mainPipeline = CreateGraphicsPipeline(GraphicsDevice, pipelineCI);
GraphicsPipeline = CreateGraphicsPipeline(GraphicsDevice, pipelineCI);
if (GraphicsPipeline == nullptr)
{
LogError(LogCategory::Game, "Failed to create graphics pipeline!");
Running = false;
}
if (vertexShader)
{
@@ -97,6 +105,11 @@ void JulietApplication::Init()
{
DestroyShader(GraphicsDevice, fragmentShader);
}
if (Running == false)
{
return;
}
}
GameCode.Functions = reinterpret_cast<void**>(&Game);
@@ -114,8 +127,16 @@ void JulietApplication::Shutdown()
{
Log(LogLevel::Message, LogCategory::Tool, "Shutting down Juliet Application...");
Game.Shutdown();
ShutdownHotReloadCode(GameCode);
if (GameCode.IsValid)
{
Game.Shutdown();
ShutdownHotReloadCode(GameCode);
}
if (GraphicsPipeline)
{
DestroyGraphicsPipeline(GraphicsDevice, GraphicsPipeline);
}
if (MainWindow && GraphicsDevice)
{

View File

@@ -4,6 +4,7 @@
#include <Core/HAL/Display/Display.h>
#include <Core/HAL/DynLib/DynamicLibrary.h>
#include <Core/HotReload/HotReload.h>
#include <Graphics/GraphicsPipeline.h>
namespace Juliet
{
@@ -20,9 +21,10 @@ class JulietApplication : public Juliet::IApplication
bool IsRunning() override;
private:
Juliet::Window* MainWindow = {};
Juliet::GraphicsDevice* GraphicsDevice = {};
Juliet::HotReloadCode GameCode = {};
Juliet::Window* MainWindow = {};
Juliet::GraphicsDevice* GraphicsDevice = {};
Juliet::HotReloadCode GameCode = {};
Juliet::GraphicsPipeline* GraphicsPipeline = {};
bool Running = false;
};