Vulkan SDK for Android 1.1.1 Mali Developer Center
MaliSDK::Context Class Reference

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...
 
PlatformgetPlatform ()
 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...
 
FenceManagergetFenceManager ()
 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...
 

Detailed Description

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.

Member Function Documentation

◆ beginFrame()

VkSemaphore MaliSDK::Context::beginFrame ( unsigned  index,
VkSemaphore  acquireSemaphore 
)
inline

Called by the platform, begins a frame.

Parameters
indexThe swapchain index which will be rendered into this frame.
acquireSemaphoreWhen 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.
Returns
The old semaphore associated with this swapchain index.

Definition at line 131 of file context.hpp.

◆ getDevice()

VkDevice MaliSDK::Context::getDevice ( )
inline

Get the Vulkan device assigned to the context.

Returns
Vulkan device

Definition at line 49 of file context.hpp.

◆ getFenceManager()

FenceManager& MaliSDK::Context::getFenceManager ( )
inline

Gets the fence manager for the current swapchain image. Used by the platform internally.

Returns
FenceManager

Definition at line 154 of file context.hpp.

◆ getGraphicsQueue()

VkQueue MaliSDK::Context::getGraphicsQueue ( )
inline

Get the Vulkan graphics queue assigned to the context.

Returns
Vulkan queue

Definition at line 60 of file context.hpp.

◆ getPhysicalDevice()

VkPhysicalDevice MaliSDK::Context::getPhysicalDevice ( ) const

Gets the Vulkan physical device assigned to the context.

Returns
Vulkan physical device

Definition at line 44 of file context.cpp.

◆ getPlatform()

Platform& MaliSDK::Context::getPlatform ( )
inline

Gets the current platform.

Returns
A reference to the platform

Definition at line 67 of file context.hpp.

◆ getSwapchainAcquireSemaphore()

const VkSemaphore& MaliSDK::Context::getSwapchainAcquireSemaphore ( ) const
inline

Gets the acquire semaphore for the swapchain. Used by the platform internally.

Returns
Semaphore.

Definition at line 162 of file context.hpp.

◆ getSwapchainReleaseSemaphore()

const VkSemaphore& MaliSDK::Context::getSwapchainReleaseSemaphore ( ) const
inline

Gets the release semaphore for the swapchain. Used by the platform internally.

Returns
Semaphore.

Definition at line 170 of file context.hpp.

◆ onPlatformUpdate()

Result MaliSDK::Context::onPlatformUpdate ( Platform pPlatform)

Called by the platform internally when platform either initializes itself or the swapchain has been recreated.

Parameters
pPlatformThe underlying Vulkan platform.
Returns
Error code

Definition at line 84 of file context.cpp.

◆ requestPrimaryCommandBuffer()

VkCommandBuffer MaliSDK::Context::requestPrimaryCommandBuffer ( )
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.

Returns
A reset primary command buffer

Definition at line 79 of file context.hpp.

◆ requestSecondaryCommandBuffer()

VkCommandBuffer MaliSDK::Context::requestSecondaryCommandBuffer ( unsigned  threadIndex)
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.

Parameters
threadIndexThe 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.
Returns
A reset secondary command buffer

Definition at line 100 of file context.hpp.

◆ setRenderingThreadCount()

void MaliSDK::Context::setRenderingThreadCount ( unsigned  count)
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.

Parameters
countThe number of threads to support.

Definition at line 143 of file context.hpp.

◆ submit()

void MaliSDK::Context::submit ( VkCommandBuffer  cmdBuffer)

Submit a command buffer to the queue.

Parameters
cmdBufferThe commandbuffer to submit.

Definition at line 105 of file context.cpp.

◆ submitSwapchain()

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.

Parameters
cmdBufferThe commandbuffer to submit.

Definition at line 110 of file context.cpp.


The documentation for this class was generated from the following files: