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
Commits
ad066d60
Commit
ad066d60
authored
3 years ago
by
Mark Oliver Mints
Browse files
Options
Downloads
Patches
Plain Diff
[
#71
] Refactor: move get and destroy functions
parent
612a08c9
No related branches found
No related tags found
1 merge request
!83
Resolve "Refactor Pipeline Config and Manager"
Pipeline
#26542
passed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/vkcv/PipelineManager.cpp
+57
-57
57 additions, 57 deletions
src/vkcv/PipelineManager.cpp
with
57 additions
and
57 deletions
src/vkcv/PipelineManager.cpp
+
57
−
57
View file @
ad066d60
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment