Compare commits

..

2 Commits

Author SHA1 Message Date
Anish Bhobe 4cdb39c6ba Change name for pipeline creation. 2025-05-31 11:51:21 +02:00
Anish Bhobe cc1fd12b64 fix: Async Compute 2025-05-28 20:58:00 +02:00
5 changed files with 14 additions and 10 deletions

View File

@ -386,7 +386,7 @@ struct Frame
// TODO: ThreadSafe
_internal::GraphicsContextPool m_PrimaryPool;
_internal::TransferContextPool m_AsyncTransferPool;
_internal::ContextPool m_AsyncComputePool;
_internal::ComputeContextPool m_AsyncComputePool;
vk::Fence m_FrameAvailableFence;
vk::Semaphore m_ImageAcquireSem;
@ -402,6 +402,7 @@ struct Frame
void Reset(u32 imageIdx, vk::Image swapchainImage, vk::ImageView swapchainImageView, Size2D swapchainSize);
GraphicsContext CreateGraphicsContext();
TransferContext CreateAsyncTransferContext();
ComputeContext CreateAsyncComputeContext();
void WaitUntilReady();
Frame() = default;
@ -541,15 +542,12 @@ class Device final
PipelineCreationError
CreateShaders(eastl::fixed_vector<vk::PipelineShaderStageCreateInfo, ShaderTypeCount, false> &shadersOut,
Slang::ComPtr<slang::IComponentType> &program, std::span<ShaderInfo const> const &shaders);
systems::PipelineCreationError
CreateShader(vk::PipelineShaderStageCreateInfo &shadersOut, Slang::ComPtr<slang::IComponentType> &program,
ShaderInfo const &shaders);
PipelineCreationError
CreatePipelineLayout(vk::PipelineLayout &pipelineLayout, Slang::ComPtr<slang::IComponentType> const &program);
public:
// Pipelines, unlike the other resources, are not ref-counted.
PipelineCreationError CreatePipeline(Pipeline &pipeline, GraphicsPipelineCreateInfo const &createInfo);
PipelineCreationError CreateGraphicsPipeline(Pipeline &pipeline, GraphicsPipelineCreateInfo const &createInfo);
PipelineCreationError CreateComputePipeline(Pipeline &pipeline, ComputePipelineCreateInfo const &createInfo);
//

View File

@ -502,7 +502,7 @@ systems::Device::CreateSampler(SamplerCreateInfo const &createInfo)
// ----------------------------------------------------------------------------------------------------
systems::PipelineCreationError
systems::Device::CreatePipeline(Pipeline &pipelineOut, GraphicsPipelineCreateInfo const &createInfo)
systems::Device::CreateGraphicsPipeline(Pipeline &pipelineOut, GraphicsPipelineCreateInfo const &createInfo)
{
eastl::fixed_vector<vk::PipelineShaderStageCreateInfo, ShaderTypeCount, false> shaders;
Slang::ComPtr<slang::IComponentType> program;
@ -1286,6 +1286,12 @@ systems::Frame::CreateAsyncTransferContext()
return m_AsyncTransferPool.CreateTransferContext();
}
systems::ComputeContext
systems::Frame::CreateAsyncComputeContext()
{
return m_AsyncComputePool.CreateComputeContext();
}
void
systems::Frame::WaitUntilReady()
{

View File

@ -62,7 +62,7 @@ main(int, char **)
}};
Pipeline pipeline;
auto pipelineError = device.CreatePipeline(pipeline, {
auto pipelineError = device.CreateGraphicsPipeline(pipeline, {
.m_VertexInputs = {{
.m_Attribute = Vertex::GetAttributes(),
.m_Stride = sizeof(Vertex),

View File

@ -127,7 +127,7 @@ main(int, char **)
Pipeline pipeline;
auto pipelineResult =
device.CreatePipeline(pipeline, {.m_Shaders = {
device.CreateGraphicsPipeline(pipeline, {.m_Shaders = {
{.m_ShaderFile = SHADER_FILE, .m_EntryPoints = {"vsmain", "fsmain"}},
}});
ERROR_IF(pipelineResult, "Could not create pipeline. Cause: {}", pipelineResult.What())

View File

@ -184,7 +184,7 @@ main(int, char **)
auto attachmentFormat = device.m_Swapchain.m_Format;
Pipeline pipeline;
if (auto result = device.CreatePipeline(pipeline, {
if (auto result = device.CreateGraphicsPipeline(pipeline, {
.m_Shaders = {{
.m_ShaderFile = MODEL_SHADER_FILE,
.m_EntryPoints = {"vsmain", "fsmain"},
@ -196,7 +196,7 @@ main(int, char **)
}
Pipeline backgroundPipeline;
if (auto result = device.CreatePipeline(
if (auto result = device.CreateGraphicsPipeline(
backgroundPipeline, {
.m_Shaders = {{
.m_ShaderFile = BACKGROUND_SHADER_FILE,