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
6e84ab3a
Commit
6e84ab3a
authored
3 years ago
by
Mark Oliver Mints
Browse files
Options
Downloads
Patches
Plain Diff
[
#71
] Refactor: implement a filling funtion for vertex binding description
parent
839e365b
No related branches found
No related tags found
1 merge request
!83
Resolve "Refactor Pipeline Config and Manager"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/vkcv/PipelineManager.cpp
+29
-21
29 additions, 21 deletions
src/vkcv/PipelineManager.cpp
src/vkcv/PipelineManager.hpp
+5
-0
5 additions, 0 deletions
src/vkcv/PipelineManager.hpp
with
34 additions
and
21 deletions
src/vkcv/PipelineManager.cpp
+
29
−
21
View file @
6e84ab3a
...
@@ -243,27 +243,7 @@ namespace vkcv
...
@@ -243,27 +243,7 @@ namespace vkcv
// Fill up VertexInputBindingDescription and VertexInputAttributeDescription Containers
// Fill up VertexInputBindingDescription and VertexInputAttributeDescription Containers
std
::
vector
<
vk
::
VertexInputAttributeDescription
>
vertexAttributeDescriptions
;
std
::
vector
<
vk
::
VertexInputAttributeDescription
>
vertexAttributeDescriptions
;
std
::
vector
<
vk
::
VertexInputBindingDescription
>
vertexBindingDescriptions
;
std
::
vector
<
vk
::
VertexInputBindingDescription
>
vertexBindingDescriptions
;
fillVertexInputDescription
(
vertexAttributeDescriptions
,
vertexBindingDescriptions
,
existsVertexShader
,
config
);
if
(
existsVertexShader
)
{
const
VertexLayout
&
layout
=
config
.
m_VertexLayout
;
// iterate over the layout's specified, mutually exclusive buffer bindings that make up a vertex buffer
for
(
const
auto
&
vertexBinding
:
layout
.
vertexBindings
)
{
vertexBindingDescriptions
.
emplace_back
(
vertexBinding
.
bindingLocation
,
vertexBinding
.
stride
,
vk
::
VertexInputRate
::
eVertex
);
// iterate over the bindings' specified, mutually exclusive vertex input attachments that make up a vertex
for
(
const
auto
&
vertexAttachment
:
vertexBinding
.
vertexAttachments
)
{
vertexAttributeDescriptions
.
emplace_back
(
vertexAttachment
.
inputLocation
,
vertexBinding
.
bindingLocation
,
vertexFormatToVulkanFormat
(
vertexAttachment
.
format
),
vertexAttachment
.
offset
%
vertexBinding
.
stride
);
}
}
}
// Handover Containers to PipelineVertexInputStateCreateIngo Struct
// Handover Containers to PipelineVertexInputStateCreateIngo Struct
vk
::
PipelineVertexInputStateCreateInfo
pipelineVertexInputStateCreateInfo
(
vk
::
PipelineVertexInputStateCreateInfo
pipelineVertexInputStateCreateInfo
(
...
@@ -562,4 +542,32 @@ namespace vkcv
...
@@ -562,4 +542,32 @@ namespace vkcv
vk
::
ShaderModuleCreateInfo
moduleInfo
({},
code
.
size
(),
reinterpret_cast
<
uint32_t
*>
(
code
.
data
()));
vk
::
ShaderModuleCreateInfo
moduleInfo
({},
code
.
size
(),
reinterpret_cast
<
uint32_t
*>
(
code
.
data
()));
return
m_Device
.
createShaderModule
(
&
moduleInfo
,
nullptr
,
&
module
);
return
m_Device
.
createShaderModule
(
&
moduleInfo
,
nullptr
,
&
module
);
}
}
void
PipelineManager
::
fillVertexInputDescription
(
std
::
vector
<
vk
::
VertexInputAttributeDescription
>
&
vertexAttributeDescriptions
,
std
::
vector
<
vk
::
VertexInputBindingDescription
>
&
vertexBindingDescriptions
,
const
bool
existsVertexShader
,
const
PipelineConfig
&
config
)
{
if
(
existsVertexShader
)
{
const
VertexLayout
&
layout
=
config
.
m_VertexLayout
;
// iterate over the layout's specified, mutually exclusive buffer bindings that make up a vertex buffer
for
(
const
auto
&
vertexBinding
:
layout
.
vertexBindings
)
{
vertexBindingDescriptions
.
emplace_back
(
vertexBinding
.
bindingLocation
,
vertexBinding
.
stride
,
vk
::
VertexInputRate
::
eVertex
);
// iterate over the bindings' specified, mutually exclusive vertex input attachments that make up a vertex
for
(
const
auto
&
vertexAttachment
:
vertexBinding
.
vertexAttachments
)
{
vertexAttributeDescriptions
.
emplace_back
(
vertexAttachment
.
inputLocation
,
vertexBinding
.
bindingLocation
,
vertexFormatToVulkanFormat
(
vertexAttachment
.
format
),
vertexAttachment
.
offset
%
vertexBinding
.
stride
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
src/vkcv/PipelineManager.hpp
+
5
−
0
View file @
6e84ab3a
...
@@ -23,6 +23,11 @@ namespace vkcv
...
@@ -23,6 +23,11 @@ namespace vkcv
void
destroyPipelineById
(
uint64_t
id
);
void
destroyPipelineById
(
uint64_t
id
);
vk
::
Result
createShaderModule
(
vk
::
ShaderModule
&
module
,
const
ShaderProgram
&
shaderProgram
,
ShaderStage
stage
);
vk
::
Result
createShaderModule
(
vk
::
ShaderModule
&
module
,
const
ShaderProgram
&
shaderProgram
,
ShaderStage
stage
);
void
fillVertexInputDescription
(
std
::
vector
<
vk
::
VertexInputAttributeDescription
>
&
vertexAttributeDescriptions
,
std
::
vector
<
vk
::
VertexInputBindingDescription
>
&
vertexBindingDescriptions
,
const
bool
existsVertexShader
,
const
PipelineConfig
&
config
);
public
:
public
:
PipelineManager
()
=
delete
;
// no default ctor
PipelineManager
()
=
delete
;
// no default ctor
...
...
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