![]() |
Vulkan SDK for Android 1.1.1
Mali Developer Center
|
The Context is the primary way for samples to interact with the swapchain and get rendered images to screen. More...
#include <context.hpp>
Public Member Functions | |
Result | onPlatformUpdate (Platform *pPlatform) |
Called by the platform internally when platform either initializes itself or the swapchain has been recreated. More... | |
VkDevice | getDevice () |
Get the Vulkan device assigned to the context. More... | |
VkPhysicalDevice | getPhysicalDevice () const |
Gets the Vulkan physical device assigned to the context. More... | |
VkQueue | getGraphicsQueue () |
Get the Vulkan graphics queue assigned to the context. More... | |
Platform & | getPlatform () |
Gets the current platform. More... | |
VkCommandBuffer | requestPrimaryCommandBuffer () |
Requests a reset primary command buffer. More... | |
VkCommandBuffer | requestSecondaryCommandBuffer (unsigned threadIndex) |
Requests a reset secondary command buffer, suitable for rendering multithreaded. More... | |
void | submit (VkCommandBuffer cmdBuffer) |
Submit a command buffer to the queue. More... | |
void | submitSwapchain (VkCommandBuffer cmdBuffer) |
Submit a command buffer to the queue which renders to the swapchain image. More... | |
VkSemaphore | beginFrame (unsigned index, VkSemaphore acquireSemaphore) |
Called by the platform, begins a frame. More... | |
void | setRenderingThreadCount (unsigned count) |
Sets the number of worker threads which can use secondary command buffers. This call is blocking and will wait for all GPU work to complete before resizing. More... | |
FenceManager & | getFenceManager () |
Gets the fence manager for the current swapchain image. Used by the platform internally. More... | |
const VkSemaphore & | getSwapchainAcquireSemaphore () const |
Gets the acquire semaphore for the swapchain. Used by the platform internally. More... | |
const VkSemaphore & | getSwapchainReleaseSemaphore () const |
Gets the release semaphore for the swapchain. Used by the platform internally. More... | |
The Context is the primary way for samples to interact with the swapchain and get rendered images to screen.
Definition at line 36 of file context.hpp.
|
inline |
Called by the platform, begins a frame.
index | The swapchain index which will be rendered into this frame. |
acquireSemaphore | When submitting command buffers using submitSwapchain, Use the acquireSemaphore as a wait semaphore in vkQueueSubmit to wait for the swapchain to become ready before rendering begins on GPU. May be VK_NULL_HANDLE in case no waiting is required by the platform. |
Definition at line 131 of file context.hpp.
|
inline |
Get the Vulkan device assigned to the context.
Definition at line 49 of file context.hpp.
|
inline |
Gets the fence manager for the current swapchain image. Used by the platform internally.
Definition at line 154 of file context.hpp.
|
inline |
Get the Vulkan graphics queue assigned to the context.
Definition at line 60 of file context.hpp.
VkPhysicalDevice MaliSDK::Context::getPhysicalDevice | ( | ) | const |
Gets the Vulkan physical device assigned to the context.
Definition at line 44 of file context.cpp.
|
inline |
Gets the current platform.
Definition at line 67 of file context.hpp.
|
inline |
Gets the acquire semaphore for the swapchain. Used by the platform internally.
Definition at line 162 of file context.hpp.
|
inline |
Gets the release semaphore for the swapchain. Used by the platform internally.
Definition at line 170 of file context.hpp.
Result MaliSDK::Context::onPlatformUpdate | ( | Platform * | pPlatform | ) |
Called by the platform internally when platform either initializes itself or the swapchain has been recreated.
pPlatform | The underlying Vulkan platform. |
Definition at line 84 of file context.cpp.
|
inline |
Requests a reset primary command buffer.
The lifetime of this command buffer is only for the current frame. It must be submitted in the same frame that the application obtains the command buffer.
Definition at line 79 of file context.hpp.
|
inline |
Requests a reset secondary command buffer, suitable for rendering multithreaded.
The lifetime of this command buffer is only for the current frame. It must be submitted in the same frame that the application obtains the command buffer.
threadIndex | The worker thread index in range [0, N) which will be rendering using this secondary buffer. It is a race condition for two threads to use a command buffer which was obtained from the same threadIndex. In order to use secondary command buffers, the application must call setRenderingThreadCount first. |
Definition at line 100 of file context.hpp.
|
inline |
Sets the number of worker threads which can use secondary command buffers. This call is blocking and will wait for all GPU work to complete before resizing.
count | The number of threads to support. |
Definition at line 143 of file context.hpp.
void MaliSDK::Context::submit | ( | VkCommandBuffer | cmdBuffer | ) |
Submit a command buffer to the queue.
cmdBuffer | The commandbuffer to submit. |
Definition at line 105 of file context.cpp.
void MaliSDK::Context::submitSwapchain | ( | VkCommandBuffer | cmdBuffer | ) |
Submit a command buffer to the queue which renders to the swapchain image.
The difference between this and submit is that extra semaphores might be added to the vkQueueSubmit
call depending on what was passed in to beginFrame by the platform.
cmdBuffer | The commandbuffer to submit. |
Definition at line 110 of file context.cpp.