First pass graphics pipeline. Not functional

This commit is contained in:
2025-03-09 16:54:26 -04:00
parent 8c6c42e123
commit aae780ec6d
12 changed files with 194 additions and 32 deletions

View File

@@ -14,6 +14,7 @@
#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.
@@ -60,15 +61,38 @@ void JulietApplication::Init()
{
// Create graphics pipeline
// TODO: Assets management that handles path to assets or something.
String shaderPath = WrapString("../../../Assets/compiled/Triangle.vert.dxil");
String entryPoint = WrapString("main");
ShaderCreateInfo shaderCI = {};
shaderCI.Stage = ShaderStage::Vertex;
shaderCI.EntryPoint = WrapString("main");
Shader* shader = CreateShader(GraphicsDevice, shaderPath, shaderCI);
if (shader)
shaderCI.EntryPoint = entryPoint;
// TODO: Assets management that handles path to assets or something.
String shaderPath = WrapString("../../../Assets/compiled/Triangle.vert.dxil");
shaderCI.Stage = ShaderStage::Vertex;
Shader* vertexShader = CreateShader(GraphicsDevice, shaderPath, shaderCI);
shaderPath = WrapString("../../../Assets/compiled/SolidColor.frag.dxil");
shaderCI.Stage = ShaderStage::Fragment;
Shader* fragmentShader = CreateShader(GraphicsDevice, shaderPath, shaderCI);
ColorTargetDescription colorTargetDescription = { .Format = GetSwapChainTextureFormat(GraphicsDevice, MainWindow) };
GraphicsPipelineCreateInfo pipelineCI = {
.VertexShader = vertexShader,
.FragmentShader = fragmentShader,
.PrimitiveType = PrimitiveType::TriangleList,
.TargetInfo = {
.ColorTargetDescriptions = &colorTargetDescription,
.NumColorTargets = 1,
},
};
pipelineCI.RasterizerState.FillMode = FillMode::Solid;
if (vertexShader)
{
DestroyShader(GraphicsDevice, shader);
DestroyShader(GraphicsDevice, vertexShader);
}
if (fragmentShader)
{
DestroyShader(GraphicsDevice, fragmentShader);
}
}