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
73ebf0b4
Commit
73ebf0b4
authored
3 years ago
by
Sebastian Gaida
Browse files
Options
Downloads
Patches
Plain Diff
[
#105
] add recordIndirectDrawcallsToCmdStream
parent
6bc54469
No related branches found
No related tags found
1 merge request
!88
Resolve "Indirect Draw"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/vkcv/DrawcallRecording.hpp
+10
-0
10 additions, 0 deletions
include/vkcv/DrawcallRecording.hpp
src/vkcv/DrawcallRecording.cpp
+42
-0
42 additions, 0 deletions
src/vkcv/DrawcallRecording.cpp
with
52 additions
and
0 deletions
include/vkcv/DrawcallRecording.hpp
+
10
−
0
View file @
73ebf0b4
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include
<vkcv/Handles.hpp>
#include
<vkcv/Handles.hpp>
#include
<vkcv/DescriptorConfig.hpp>
#include
<vkcv/DescriptorConfig.hpp>
#include
<vkcv/PushConstants.hpp>
#include
<vkcv/PushConstants.hpp>
#include
"Buffer.hpp"
namespace
vkcv
{
namespace
vkcv
{
struct
VertexBufferBinding
{
struct
VertexBufferBinding
{
...
@@ -55,6 +56,15 @@ namespace vkcv {
...
@@ -55,6 +56,15 @@ namespace vkcv {
const
PushConstants
&
pushConstants
,
const
PushConstants
&
pushConstants
,
const
size_t
drawcallIndex
);
const
size_t
drawcallIndex
);
void
recordIndirectDrawcall
(
const
DrawcallInfo
&
drawcall
,
vk
::
CommandBuffer
cmdBuffer
,
const
vkcv
::
Buffer
<
vk
::
DrawIndexedIndirectCommand
>
&
drawBuffer
,
const
uint32_t
drawCount
,
vk
::
PipelineLayout
pipelineLayout
,
const
PushConstants
&
pushConstants
,
const
size_t
drawcallIndex
);
void
InitMeshShaderDrawFunctions
(
vk
::
Device
device
);
void
InitMeshShaderDrawFunctions
(
vk
::
Device
device
);
struct
MeshShaderDrawcall
{
struct
MeshShaderDrawcall
{
...
...
This diff is collapsed.
Click to expand it.
src/vkcv/DrawcallRecording.cpp
+
42
−
0
View file @
73ebf0b4
...
@@ -52,7 +52,49 @@ namespace vkcv {
...
@@ -52,7 +52,49 @@ namespace vkcv {
}
}
}
}
void
recordIndirectDrawcall
(
const
DrawcallInfo
&
drawcall
,
vk
::
CommandBuffer
cmdBuffer
,
const
Buffer
<
vk
::
DrawIndexedIndirectCommand
>
&
drawBuffer
,
const
uint32_t
drawCount
,
vk
::
PipelineLayout
pipelineLayout
,
const
PushConstants
&
pushConstants
,
const
size_t
drawcallIndex
)
{
for
(
uint32_t
i
=
0
;
i
<
drawcall
.
mesh
.
vertexBufferBindings
.
size
();
i
++
)
{
const
auto
&
vertexBinding
=
drawcall
.
mesh
.
vertexBufferBindings
[
i
];
cmdBuffer
.
bindVertexBuffers
(
i
,
vertexBinding
.
buffer
,
vertexBinding
.
offset
);
}
for
(
const
auto
&
descriptorUsage
:
drawcall
.
descriptorSets
)
{
cmdBuffer
.
bindDescriptorSets
(
vk
::
PipelineBindPoint
::
eGraphics
,
pipelineLayout
,
descriptorUsage
.
setLocation
,
descriptorUsage
.
vulkanHandle
,
nullptr
);
}
if
(
pushConstants
.
getSizePerDrawcall
()
>
0
)
{
cmdBuffer
.
pushConstants
(
pipelineLayout
,
vk
::
ShaderStageFlagBits
::
eAll
,
0
,
pushConstants
.
getSizePerDrawcall
(),
pushConstants
.
getDrawcallData
(
drawcallIndex
));
}
if
(
drawcall
.
mesh
.
indexBuffer
)
{
cmdBuffer
.
bindIndexBuffer
(
drawcall
.
mesh
.
indexBuffer
,
0
,
getIndexType
(
drawcall
.
mesh
.
indexBitCount
));
cmdBuffer
.
drawIndexedIndirect
(
drawBuffer
.
getVulkanHandle
(),
0
,
drawCount
,
sizeof
(
vk
::
DrawIndexedIndirectCommand
)
);
}
else
{
cmdBuffer
.
drawIndirect
(
drawBuffer
.
getVulkanHandle
(),
0
,
drawCount
,
sizeof
(
vk
::
DrawIndexedIndirectCommand
)
);
}
}
struct
MeshShaderFunctions
struct
MeshShaderFunctions
{
{
...
...
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