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
8a5b686e
Verified
Commit
8a5b686e
authored
3 years ago
by
Tobias Frisch
Browse files
Options
Downloads
Patches
Plain Diff
[
#18
] Drop the frame while you can!
Signed-off-by:
Tobias Frisch
<
tfrisch@uni-koblenz.de
>
parent
b209cd87
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!12
Resolve "Swapchain Class"
Pipeline
#24810
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/vkcv/Core.cpp
+20
-1
20 additions, 1 deletion
src/vkcv/Core.cpp
with
20 additions
and
1 deletion
src/vkcv/Core.cpp
+
20
−
1
View file @
8a5b686e
...
@@ -314,8 +314,13 @@ namespace vkcv
...
@@ -314,8 +314,13 @@ namespace vkcv
m_Context
.
getDevice
().
acquireNextImageKHR
(
m_swapchain
.
getSwapchain
(),
0
,
nullptr
,
m_Context
.
getDevice
().
acquireNextImageKHR
(
m_swapchain
.
getSwapchain
(),
0
,
nullptr
,
m_SyncResources
.
swapchainImageAcquired
,
&
index
,
{});
m_SyncResources
.
swapchainImageAcquired
,
&
index
,
{});
const
uint64_t
timeoutPeriodNs
=
1000
;
// TODO: think if is adequate
const
uint64_t
timeoutPeriodNs
=
1000
;
// TODO: think if is adequate
m_Context
.
getDevice
().
waitForFences
(
m_SyncResources
.
swapchainImageAcquired
,
true
,
timeoutPeriodNs
);
const
auto
&
result
=
m_Context
.
getDevice
().
waitForFences
(
m_SyncResources
.
swapchainImageAcquired
,
true
,
timeoutPeriodNs
);
m_Context
.
getDevice
().
resetFences
(
m_SyncResources
.
swapchainImageAcquired
);
m_Context
.
getDevice
().
resetFences
(
m_SyncResources
.
swapchainImageAcquired
);
if
(
result
==
vk
::
Result
::
eTimeout
)
{
index
=
std
::
numeric_limits
<
uint32_t
>::
max
();
}
return
index
;
return
index
;
}
}
...
@@ -328,6 +333,12 @@ namespace vkcv
...
@@ -328,6 +333,12 @@ namespace vkcv
void
Core
::
beginFrame
()
{
void
Core
::
beginFrame
()
{
m_currentSwapchainImageIndex
=
acquireSwapchainImage
();
m_currentSwapchainImageIndex
=
acquireSwapchainImage
();
if
(
m_currentSwapchainImageIndex
==
std
::
numeric_limits
<
uint32_t
>::
max
())
{
std
::
cerr
<<
"Drop frame!"
<<
std
::
endl
;
return
;
}
m_Context
.
getDevice
().
waitIdle
();
// FIMXE: this is a sin against graphics programming, but its getting late - Alex
m_Context
.
getDevice
().
waitIdle
();
// FIMXE: this is a sin against graphics programming, but its getting late - Alex
destroyTemporaryFramebuffers
();
destroyTemporaryFramebuffers
();
const
vk
::
CommandBufferUsageFlags
beginFlags
=
vk
::
CommandBufferUsageFlagBits
::
eOneTimeSubmit
;
const
vk
::
CommandBufferUsageFlags
beginFlags
=
vk
::
CommandBufferUsageFlagBits
::
eOneTimeSubmit
;
...
@@ -337,6 +348,10 @@ namespace vkcv
...
@@ -337,6 +348,10 @@ namespace vkcv
void
Core
::
renderTriangle
(
const
PassHandle
renderpassHandle
,
const
PipelineHandle
pipelineHandle
,
void
Core
::
renderTriangle
(
const
PassHandle
renderpassHandle
,
const
PipelineHandle
pipelineHandle
,
const
int
width
,
const
int
height
)
{
const
int
width
,
const
int
height
)
{
if
(
m_currentSwapchainImageIndex
==
std
::
numeric_limits
<
uint32_t
>::
max
())
{
return
;
}
const
vk
::
RenderPass
renderpass
=
m_PassManager
->
getVkPass
(
renderpassHandle
);
const
vk
::
RenderPass
renderpass
=
m_PassManager
->
getVkPass
(
renderpassHandle
);
const
std
::
array
<
float
,
4
>
clearColor
=
{
1.
f
,
1.
f
,
0.
f
,
1.
f
};
const
std
::
array
<
float
,
4
>
clearColor
=
{
1.
f
,
1.
f
,
0.
f
,
1.
f
};
const
vk
::
ClearValue
clearValues
(
clearColor
);
const
vk
::
ClearValue
clearValues
(
clearColor
);
...
@@ -351,6 +366,10 @@ namespace vkcv
...
@@ -351,6 +366,10 @@ namespace vkcv
}
}
void
Core
::
endFrame
()
{
void
Core
::
endFrame
()
{
if
(
m_currentSwapchainImageIndex
==
std
::
numeric_limits
<
uint32_t
>::
max
())
{
return
;
}
const
auto
swapchainImages
=
m_Context
.
getDevice
().
getSwapchainImagesKHR
(
m_swapchain
.
getSwapchain
());
const
auto
swapchainImages
=
m_Context
.
getDevice
().
getSwapchainImagesKHR
(
m_swapchain
.
getSwapchain
());
const
vk
::
Image
presentImage
=
swapchainImages
[
m_currentSwapchainImageIndex
];
const
vk
::
Image
presentImage
=
swapchainImages
[
m_currentSwapchainImageIndex
];
...
...
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