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
9bd9cf11
Commit
9bd9cf11
authored
3 years ago
by
Simeon Hermann
Browse files
Options
Downloads
Patches
Plain Diff
[
#76
] implement reflection of descriptors in multiple shader stages
parent
5fad3ab1
No related branches found
No related tags found
1 merge request
!71
Resolve "Descriptor in multiple shader stages"
Pipeline
#26190
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/ShaderProgram.cpp
+19
-7
19 additions, 7 deletions
src/vkcv/ShaderProgram.cpp
with
19 additions
and
7 deletions
src/vkcv/ShaderProgram.cpp
+
19
−
7
View file @
9bd9cf11
...
@@ -138,12 +138,6 @@ namespace vkcv {
...
@@ -138,12 +138,6 @@ namespace vkcv {
m_VertexAttachments
.
emplace_back
(
attachment_loc
,
attachment_name
,
attachment_format
);
m_VertexAttachments
.
emplace_back
(
attachment_loc
,
attachment_name
,
attachment_format
);
}
}
}
}
ShaderStages
stages
;
stages
|=
ShaderStage
::
VERTEX
;
stages
|=
ShaderStage
::
FRAGMENT
;
vk
::
ShaderStageFlags
flags
=
vk
::
ShaderStageFlagBits
::
eVertex
|
vk
::
ShaderStageFlagBits
::
eFragment
;
//reflect descriptor sets (uniform buffer, storage buffer, sampler, sampled image, storage image)
//reflect descriptor sets (uniform buffer, storage buffer, sampler, sampled image, storage image)
std
::
vector
<
std
::
pair
<
uint32_t
,
DescriptorBinding
>>
bindings
;
std
::
vector
<
std
::
pair
<
uint32_t
,
DescriptorBinding
>>
bindings
;
...
@@ -201,7 +195,25 @@ namespace vkcv {
...
@@ -201,7 +195,25 @@ namespace vkcv {
if
(
maxSetID
!=
-
1
)
{
if
(
maxSetID
!=
-
1
)
{
if
((
int32_t
)
m_DescriptorSets
.
size
()
<=
maxSetID
)
m_DescriptorSets
.
resize
(
maxSetID
+
1
);
if
((
int32_t
)
m_DescriptorSets
.
size
()
<=
maxSetID
)
m_DescriptorSets
.
resize
(
maxSetID
+
1
);
for
(
const
auto
&
binding
:
bindings
)
{
for
(
const
auto
&
binding
:
bindings
)
{
m_DescriptorSets
[
binding
.
first
].
push_back
(
binding
.
second
);
//checking if descriptor has already been reflected in another shader stage
bool
bindingFound
=
false
;
uint32_t
pos
=
0
;
for
(
const
auto
&
descriptor
:
m_DescriptorSets
[
binding
.
first
])
{
if
(
binding
.
second
.
bindingID
==
descriptor
.
bindingID
)
{
if
(
binding
.
second
.
descriptorType
==
descriptor
.
descriptorType
&&
binding
.
second
.
descriptorCount
==
descriptor
.
descriptorCount
)
{
//updating descriptor binding with another shader stage
ShaderStages
updatedShaders
=
descriptor
.
shaderStages
|
shaderStage
;
DescriptorBinding
newBinding
=
DescriptorBinding
(
binding
.
second
.
bindingID
,
binding
.
second
.
descriptorType
,
binding
.
second
.
descriptorCount
,
updatedShaders
);
m_DescriptorSets
[
binding
.
first
][
pos
]
=
newBinding
;
bindingFound
=
true
;
break
;
}
else
vkcv_log
(
LogLevel
::
ERROR
,
"Included shaders contain resources with same identifier but different type or count"
);
}
pos
++
;
}
//append new descriptor if it has not been reflected yet
if
(
!
bindingFound
)
m_DescriptorSets
[
binding
.
first
].
push_back
(
binding
.
second
);
}
}
}
}
...
...
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