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
be8ee323
Commit
be8ee323
authored
3 years ago
by
Sebastian Gaida
Browse files
Options
Downloads
Patches
Plain Diff
[
#105
] change project to indirect draw
parent
8b1633d4
No related branches found
No related tags found
1 merge request
!88
Resolve "Indirect Draw"
Pipeline
#26679
failed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/draw_indirect/src/main.cpp
+14
-4
14 additions, 4 deletions
projects/draw_indirect/src/main.cpp
with
14 additions
and
4 deletions
projects/draw_indirect/src/main.cpp
+
14
−
4
View file @
be8ee323
...
@@ -19,7 +19,7 @@ void addMeshToIdirectDraw(const std::vector<vkcv::asset::VertexGroup>& meshes, s
...
@@ -19,7 +19,7 @@ void addMeshToIdirectDraw(const std::vector<vkcv::asset::VertexGroup>& meshes, s
}
}
}
}
int
main
(
int
argc
,
const
char
**
argv
)
{
int
main
(
int
argc
,
const
char
**
argv
)
{
const
char
*
applicationName
=
"
First Mesh
"
;
const
char
*
applicationName
=
"
Indirect draw
"
;
uint32_t
windowWidth
=
800
;
uint32_t
windowWidth
=
800
;
uint32_t
windowHeight
=
600
;
uint32_t
windowHeight
=
600
;
...
@@ -28,7 +28,7 @@ int main(int argc, const char** argv) {
...
@@ -28,7 +28,7 @@ int main(int argc, const char** argv) {
applicationName
,
applicationName
,
windowWidth
,
windowWidth
,
windowHeight
,
windowHeight
,
tru
e
fals
e
);
);
vkcv
::
Core
core
=
vkcv
::
Core
::
create
(
vkcv
::
Core
core
=
vkcv
::
Core
::
create
(
...
@@ -61,6 +61,14 @@ int main(int argc, const char** argv) {
...
@@ -61,6 +61,14 @@ int main(int argc, const char** argv) {
vertexBuffer
.
fill
(
mesh
.
vertexGroups
[
0
].
vertexBuffer
.
data
);
vertexBuffer
.
fill
(
mesh
.
vertexGroups
[
0
].
vertexBuffer
.
data
);
std
::
vector
<
vk
::
DrawIndexedIndirectCommand
>
indexedIndirectCommands
;
addMeshToIdirectDraw
(
mesh
.
vertexGroups
,
indexedIndirectCommands
);
vkcv
::
Buffer
<
vk
::
DrawIndexedIndirectCommand
>
indirectBuffer
=
core
.
createBuffer
<
vk
::
DrawIndexedIndirectCommand
>
(
vkcv
::
BufferType
::
INDIRECT
,
indexedIndirectCommands
.
size
()
*
sizeof
(
vk
::
DrawIndexedIndirectCommand
),
vkcv
::
BufferMemoryType
::
DEVICE_LOCAL
);
indirectBuffer
.
fill
(
indexedIndirectCommands
);
auto
indexBuffer
=
core
.
createBuffer
<
uint8_t
>
(
auto
indexBuffer
=
core
.
createBuffer
<
uint8_t
>
(
vkcv
::
BufferType
::
INDEX
,
vkcv
::
BufferType
::
INDEX
,
mesh
.
vertexGroups
[
0
].
indexBuffer
.
data
.
size
(),
mesh
.
vertexGroups
[
0
].
indexBuffer
.
data
.
size
(),
...
@@ -215,13 +223,15 @@ int main(int argc, const char** argv) {
...
@@ -215,13 +223,15 @@ int main(int argc, const char** argv) {
const
std
::
vector
<
vkcv
::
ImageHandle
>
renderTargets
=
{
swapchainInput
,
depthBuffer
};
const
std
::
vector
<
vkcv
::
ImageHandle
>
renderTargets
=
{
swapchainInput
,
depthBuffer
};
auto
cmdStream
=
core
.
createCommandStream
(
vkcv
::
QueueType
::
Graphics
);
auto
cmdStream
=
core
.
createCommandStream
(
vkcv
::
QueueType
::
Graphics
);
core
.
recordDrawcallsToCmdStream
(
core
.
record
Indirect
DrawcallsToCmdStream
(
cmdStream
,
cmdStream
,
firstMeshPass
,
firstMeshPass
,
firstMeshPipeline
,
firstMeshPipeline
,
pushConstants
,
pushConstants
,
{
drawcall
},
{
drawcall
},
renderTargets
);
renderTargets
,
indirectBuffer
,
indexedIndirectCommands
.
size
());
core
.
prepareSwapchainImageForPresent
(
cmdStream
);
core
.
prepareSwapchainImageForPresent
(
cmdStream
);
core
.
submitCommandStream
(
cmdStream
);
core
.
submitCommandStream
(
cmdStream
);
core
.
endFrame
();
core
.
endFrame
();
...
...
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