Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
Native_SDK
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
Native_SDK
Commits
409c9d54
Unverified
Commit
409c9d54
authored
Aug 13, 2020
by
Omar Zohdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Synchronization Issues.
Fixed synchronization issues in the VulkanGlass example where running the example with validation layers active would cause them to throw and exception error.
parent
afdfce88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
VulkanGlass.cpp
examples/Vulkan/Glass/VulkanGlass.cpp
+18
-16
No files found.
examples/Vulkan/Glass/VulkanGlass.cpp
View file @
409c9d54
...
@@ -1157,9 +1157,9 @@ struct DeviceResources
...
@@ -1157,9 +1157,9 @@ struct DeviceResources
pvr
::
Multi
<
pvrvk
::
ImageView
>
depthStencilImages
;
pvr
::
Multi
<
pvrvk
::
ImageView
>
depthStencilImages
;
pvrvk
::
Sampler
samplerTrilinear
;
pvrvk
::
Sampler
samplerTrilinear
;
pvrvk
::
Semaphore
semaphoreAcquire
[
uint32_t
(
pvrvk
::
FrameworkCaps
::
MaxSwapChains
)];
pvrvk
::
Semaphore
imageAcquiredSemaphores
[
uint32_t
(
pvrvk
::
FrameworkCaps
::
MaxSwapChains
)];
pvrvk
::
Semaphore
semaphoreSubmit
[
uint32_t
(
pvrvk
::
FrameworkCaps
::
MaxSwapChains
)];
pvrvk
::
Semaphore
presentationSemaphores
[
uint32_t
(
pvrvk
::
FrameworkCaps
::
MaxSwapChains
)];
pvrvk
::
Fence
perFrame
Fence
[
uint32_t
(
pvrvk
::
FrameworkCaps
::
MaxSwapChains
)];
pvrvk
::
Fence
perFrame
ResourcesFences
[
uint32_t
(
pvrvk
::
FrameworkCaps
::
MaxSwapChains
)];
~
DeviceResources
()
~
DeviceResources
()
{
{
if
(
device
)
if
(
device
)
...
@@ -1168,8 +1168,8 @@ struct DeviceResources
...
@@ -1168,8 +1168,8 @@ struct DeviceResources
uint32_t
l
=
swapchain
->
getSwapchainLength
();
uint32_t
l
=
swapchain
->
getSwapchainLength
();
for
(
uint32_t
i
=
0
;
i
<
l
;
++
i
)
for
(
uint32_t
i
=
0
;
i
<
l
;
++
i
)
{
{
if
(
perFrame
Fence
[
i
])
perFrameFence
[
i
]
->
wait
();
if
(
perFrame
ResourcesFences
[
i
])
perFrameResourcesFences
[
i
]
->
wait
();
if
(
perFrame
Fence
[
i
])
perFrameFence
[
i
]
->
wait
();
if
(
perFrame
ResourcesFences
[
i
])
perFrameResourcesFences
[
i
]
->
wait
();
}
}
}
}
}
}
...
@@ -1335,9 +1335,9 @@ pvr::Result VulkanGlass::initView()
...
@@ -1335,9 +1335,9 @@ pvr::Result VulkanGlass::initView()
_deviceResources
->
uiSecondaryCommandBuffers
[
i
]
=
_deviceResources
->
commandPool
->
allocateSecondaryCommandBuffer
();
_deviceResources
->
uiSecondaryCommandBuffers
[
i
]
=
_deviceResources
->
commandPool
->
allocateSecondaryCommandBuffer
();
if
(
i
==
0
)
{
_deviceResources
->
sceneCommandBuffers
[
0
]
->
begin
();
}
if
(
i
==
0
)
{
_deviceResources
->
sceneCommandBuffers
[
0
]
->
begin
();
}
_deviceResources
->
semaphoreSubmit
[
i
]
=
_deviceResources
->
device
->
createSemaphore
();
_deviceResources
->
presentationSemaphores
[
i
]
=
_deviceResources
->
device
->
createSemaphore
();
_deviceResources
->
semaphoreAcquire
[
i
]
=
_deviceResources
->
device
->
createSemaphore
();
_deviceResources
->
imageAcquiredSemaphores
[
i
]
=
_deviceResources
->
device
->
createSemaphore
();
_deviceResources
->
perFrame
Fence
[
i
]
=
_deviceResources
->
device
->
createFence
(
pvrvk
::
FenceCreateFlags
::
e_SIGNALED_BIT
);
_deviceResources
->
perFrame
ResourcesFences
[
i
]
=
_deviceResources
->
device
->
createFence
(
pvrvk
::
FenceCreateFlags
::
e_SIGNALED_BIT
);
}
}
// Create the pipeline cache
// Create the pipeline cache
...
@@ -1401,11 +1401,13 @@ pvr::Result VulkanGlass::releaseView()
...
@@ -1401,11 +1401,13 @@ pvr::Result VulkanGlass::releaseView()
/// <returns>Return Result::Success if no error occurred</returns>
/// <returns>Return Result::Success if no error occurred</returns>
pvr
::
Result
VulkanGlass
::
renderFrame
()
pvr
::
Result
VulkanGlass
::
renderFrame
()
{
{
// make sure the commandbuffer and the semaphore are free to use.
_deviceResources
->
swapchain
->
acquireNextImage
(
uint64_t
(
-
1
),
_deviceResources
->
imageAcquiredSemaphores
[
_frameId
]);
_deviceResources
->
perFrameFence
[
_frameId
]
->
wait
();
_deviceResources
->
perFrameFence
[
_frameId
]
->
reset
();
_deviceResources
->
swapchain
->
acquireNextImage
(
uint64_t
(
-
1
),
_deviceResources
->
semaphoreAcquire
[
_frameId
]);
const
uint32_t
swapchainIndex
=
_deviceResources
->
swapchain
->
getSwapchainIndex
();
const
uint32_t
swapchainIndex
=
_deviceResources
->
swapchain
->
getSwapchainIndex
();
// make sure the commandbuffer and the semaphore are free to use.
_deviceResources
->
perFrameResourcesFences
[
swapchainIndex
]
->
wait
();
_deviceResources
->
perFrameResourcesFences
[
swapchainIndex
]
->
reset
();
updateScene
(
swapchainIndex
);
updateScene
(
swapchainIndex
);
//--------------------
//--------------------
...
@@ -1415,11 +1417,11 @@ pvr::Result VulkanGlass::renderFrame()
...
@@ -1415,11 +1417,11 @@ pvr::Result VulkanGlass::renderFrame()
submitInfo
.
commandBuffers
=
&
_deviceResources
->
sceneCommandBuffers
[
swapchainIndex
];
submitInfo
.
commandBuffers
=
&
_deviceResources
->
sceneCommandBuffers
[
swapchainIndex
];
submitInfo
.
numCommandBuffers
=
1
;
submitInfo
.
numCommandBuffers
=
1
;
submitInfo
.
numWaitSemaphores
=
1
;
submitInfo
.
numWaitSemaphores
=
1
;
submitInfo
.
waitSemaphores
=
&
_deviceResources
->
semaphoreAcquire
[
_frameId
];
submitInfo
.
waitSemaphores
=
&
_deviceResources
->
imageAcquiredSemaphores
[
_frameId
];
submitInfo
.
waitDstStageMask
=
&
waitStage
;
submitInfo
.
waitDstStageMask
=
&
waitStage
;
submitInfo
.
signalSemaphores
=
&
_deviceResources
->
semaphoreSubmit
[
_frameId
];
submitInfo
.
signalSemaphores
=
&
_deviceResources
->
presentationSemaphores
[
_frameId
];
submitInfo
.
numSignalSemaphores
=
1
;
submitInfo
.
numSignalSemaphores
=
1
;
_deviceResources
->
queue
->
submit
(
&
submitInfo
,
1
,
_deviceResources
->
perFrame
Fence
[
_frameId
]);
_deviceResources
->
queue
->
submit
(
&
submitInfo
,
1
,
_deviceResources
->
perFrame
ResourcesFences
[
swapchainIndex
]);
if
(
this
->
shouldTakeScreenshot
())
if
(
this
->
shouldTakeScreenshot
())
{
{
...
@@ -1432,7 +1434,7 @@ pvr::Result VulkanGlass::renderFrame()
...
@@ -1432,7 +1434,7 @@ pvr::Result VulkanGlass::renderFrame()
pvrvk
::
PresentInfo
presentInfo
;
pvrvk
::
PresentInfo
presentInfo
;
presentInfo
.
swapchains
=
&
_deviceResources
->
swapchain
;
presentInfo
.
swapchains
=
&
_deviceResources
->
swapchain
;
presentInfo
.
numWaitSemaphores
=
1
;
presentInfo
.
numWaitSemaphores
=
1
;
presentInfo
.
waitSemaphores
=
&
_deviceResources
->
semaphoreSubmit
[
_frameId
];
presentInfo
.
waitSemaphores
=
&
_deviceResources
->
presentationSemaphores
[
_frameId
];
presentInfo
.
imageIndices
=
&
swapchainIndex
;
presentInfo
.
imageIndices
=
&
swapchainIndex
;
presentInfo
.
numSwapchains
=
1
;
presentInfo
.
numSwapchains
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment