Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Merge requests
!83
Resolve "Refactor Pipeline Config and Manager"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Refactor Pipeline Config and Manager"
71-refactor-pipeline-config-and-manager
into
develop
Overview
10
Commits
45
Pipelines
42
Changes
1
Merged
Mark Oliver Mints
requested to merge
71-refactor-pipeline-config-and-manager
into
develop
3 years ago
Overview
10
Commits
45
Pipelines
42
Changes
1
Expand
Closes
#71 (closed)
Edited
3 years ago
by
Tobias Frisch
0
0
Merge request reports
Viewing commit
ad066d60
Prev
Next
Show latest version
1 file
+
57
−
57
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
ad066d60
[
#71
] Refactor: move get and destroy functions
· ad066d60
Mark Oliver Mints
authored
3 years ago
src/vkcv/PipelineManager.cpp
+
57
−
57
Options
@@ -17,6 +17,63 @@ namespace vkcv
}
}
vk
::
Pipeline
PipelineManager
::
getVkPipeline
(
const
PipelineHandle
&
handle
)
const
{
const
uint64_t
id
=
handle
.
getId
();
if
(
id
>=
m_Pipelines
.
size
())
{
return
nullptr
;
}
auto
&
pipeline
=
m_Pipelines
[
id
];
return
pipeline
.
m_handle
;
}
vk
::
PipelineLayout
PipelineManager
::
getVkPipelineLayout
(
const
PipelineHandle
&
handle
)
const
{
const
uint64_t
id
=
handle
.
getId
();
if
(
id
>=
m_Pipelines
.
size
())
{
return
nullptr
;
}
auto
&
pipeline
=
m_Pipelines
[
id
];
return
pipeline
.
m_layout
;
}
const
PipelineConfig
&
PipelineManager
::
getPipelineConfig
(
const
PipelineHandle
&
handle
)
const
{
const
uint64_t
id
=
handle
.
getId
();
if
(
id
>=
m_Pipelines
.
size
())
{
static
PipelineConfig
dummyConfig
;
vkcv_log
(
LogLevel
::
ERROR
,
"Invalid handle"
);
return
dummyConfig
;
}
return
m_Pipelines
[
id
].
m_config
;
}
void
PipelineManager
::
destroyPipelineById
(
uint64_t
id
)
{
if
(
id
>=
m_Pipelines
.
size
())
{
return
;
}
auto
&
pipeline
=
m_Pipelines
[
id
];
if
(
pipeline
.
m_handle
)
{
m_Device
.
destroy
(
pipeline
.
m_handle
);
pipeline
.
m_handle
=
nullptr
;
}
if
(
pipeline
.
m_layout
)
{
m_Device
.
destroy
(
pipeline
.
m_layout
);
pipeline
.
m_layout
=
nullptr
;
}
}
// TODO: Move to Header
// currently assuming default 32 bit formats, no lower precision or normalized variants supported
vk
::
Format
vertexFormatToVulkanFormat
(
const
VertexAttachmentFormat
format
)
{
@@ -360,63 +417,6 @@ namespace vkcv
return
PipelineHandle
(
id
,
[
&
](
uint64_t
id
)
{
destroyPipelineById
(
id
);
});
}
vk
::
Pipeline
PipelineManager
::
getVkPipeline
(
const
PipelineHandle
&
handle
)
const
{
const
uint64_t
id
=
handle
.
getId
();
if
(
id
>=
m_Pipelines
.
size
())
{
return
nullptr
;
}
auto
&
pipeline
=
m_Pipelines
[
id
];
return
pipeline
.
m_handle
;
}
vk
::
PipelineLayout
PipelineManager
::
getVkPipelineLayout
(
const
PipelineHandle
&
handle
)
const
{
const
uint64_t
id
=
handle
.
getId
();
if
(
id
>=
m_Pipelines
.
size
())
{
return
nullptr
;
}
auto
&
pipeline
=
m_Pipelines
[
id
];
return
pipeline
.
m_layout
;
}
void
PipelineManager
::
destroyPipelineById
(
uint64_t
id
)
{
if
(
id
>=
m_Pipelines
.
size
())
{
return
;
}
auto
&
pipeline
=
m_Pipelines
[
id
];
if
(
pipeline
.
m_handle
)
{
m_Device
.
destroy
(
pipeline
.
m_handle
);
pipeline
.
m_handle
=
nullptr
;
}
if
(
pipeline
.
m_layout
)
{
m_Device
.
destroy
(
pipeline
.
m_layout
);
pipeline
.
m_layout
=
nullptr
;
}
}
const
PipelineConfig
&
PipelineManager
::
getPipelineConfig
(
const
PipelineHandle
&
handle
)
const
{
const
uint64_t
id
=
handle
.
getId
();
if
(
id
>=
m_Pipelines
.
size
())
{
static
PipelineConfig
dummyConfig
;
vkcv_log
(
LogLevel
::
ERROR
,
"Invalid handle"
);
return
dummyConfig
;
}
return
m_Pipelines
[
id
].
m_config
;
}
PipelineHandle
PipelineManager
::
createComputePipeline
(
const
ShaderProgram
&
shaderProgram
,
const
std
::
vector
<
vk
::
DescriptorSetLayout
>
&
descriptorSetLayouts
)
{
Loading