PVRUtils Functions#

pvr::createEglContext#

Function Documentation#

std::unique_ptr<platform::EglContext_> pvr::createEglContext()#

Creates an instance of an EGL platform context.

Returns

A unique pointer to a pvr::platform::EglContext_ instance.

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::BlendFactor pvr::utils::convertToPVRVk(::pvr::BlendFactor item)#

pvr::utils::getTextureData#

Function Documentation#

inline pvr::Texture pvr::utils::getTextureData(const IAssetProvider &app, const char *file)#

pvr::utils::createOnScreenRenderPass#

Function Documentation#

pvrvk::RenderPass pvr::utils::createOnScreenRenderPass(const pvrvk::Swapchain &swapchain, bool hasDepthStencil, const pvrvk::Format depthStencilFormat = pvrvk::Format::e_UNDEFINED, pvrvk::ImageLayout initialSwapchainLayout = pvrvk::ImageLayout::e_UNDEFINED, pvrvk::ImageLayout initialDepthStencilLayout = pvrvk::ImageLayout::e_UNDEFINED, pvrvk::AttachmentLoadOp colorLoadOp = pvrvk::AttachmentLoadOp::e_CLEAR, pvrvk::AttachmentStoreOp colorStoreOp = pvrvk::AttachmentStoreOp::e_STORE, pvrvk::AttachmentLoadOp depthStencilLoadOp = pvrvk::AttachmentLoadOp::e_CLEAR, pvrvk::AttachmentStoreOp depthStencilStoreOp = pvrvk::AttachmentStoreOp::e_DONT_CARE, pvrvk::SampleCountFlags samples = pvrvk::SampleCountFlags::e_1_BIT)#

Create a renderpass for On-Screen (or other swapchain-based) rendering, based on the information contained in the swapchain. No other objects, (such as framebuffers and attachments) are created.

Parameters
  • swapchain – A swapchain object. The data of the swapchain object will be used to ensure the renderpass created is compatible with this swapchain object

  • hasDepthStencil – CHANGED API v5.5. Pass “true” if the renderpass will be used for a framebuffer with depth or stencil. To port from the 5.3 code, please pass “true” if the old depthStencilImages parameter would not have been null.

  • depthStencilFormat – CHANGED API v5.5. If “hasDepthStencil” is true, pass the depth stencil format here. To port from the 5.4 code, retrieve the format from the first member of the old depthStencilImages array

  • initialSwapchainLayout – This is the layout with which the swapchain images will be in, in the beginning the renderpass.

  • initialDepthStencilLayout – This is the layout with which the depth/stencil images, if present, will be in, in the beginning the renderpass.

  • colorLoadOp – This is the LOAD op for the swapchain images, the operation performed on them when beginning the renderpass. Strongly prefer e_CLEAR if possible as it improves performance considerably compared to e_LOAD. For a multisampled renderpass, this is actually the load op for the Color Attachment, as the Color Resolve attachment is automatically e_DONT_CARE since it is always completely overwritten.

  • colorStoreOp – This is the STORE op for the swapchain images, the operation performed on the swapchain images at the end of the renderpass. This normally has to be e_STORE in order to render the images on screen. For a multisampled renderpass, this is actually the load op for the Color Resolve Attachment, as the Color attachment is automatically e_DONT_CARE since it cannot be used elsewhere since it is multisampled.

  • depthStencilLoadOp – This is the LOAD op for the depth/stencil images, the operation performed on the depth/stencil images images when beginning the renderpass. Normally has to be (and should be preferred for performance) e_CLEAR For a multisampled renderpass, this is actually the load op for the Depth Attachment, as the Depth Resolve attachment is automatically e_DONT_CARE since it is always completely overwritten.

  • colorStoreOp – This is the STORE op for the depth/stencil images, the operation performed on the depth/stencil images at the end of the renderpass. Strongly prefer e_DONT_CARE as the depth buffer almost never needs to be preserved between frames, and this can have a strong performance impact as it could even elide memory allocation for it. For a multisampled renderpass, this is actually the store op for the Depth Resolve Attachment, as the Depth attachment is automatically e_DONT_CARE since it cannot be used elsewhere since it is multisampled.

  • samples – The number of samples (if greater then e_1_BIT, the renderpass will be multisampled, so correct color and depth resolve items will be assumed.

pvr::utils::setImageLayout#

Function Documentation#

inline void pvr::utils::setImageLayout(pvrvk::Image &image, pvrvk::ImageLayout oldLayout, pvrvk::ImageLayout newLayout, pvrvk::CommandBufferBase transitionCmdBuffer)#

Set image layout.

Parameters
  • image – The image to transition

  • oldLayout – An old image layout to transition from

  • newLayout – A new image layout to transition to

  • transitionCmdBuffer – A command buffer to add the pipelineBarrier for the image transition.

pvr::utils::createMultipleBuffersFromMesh#

Function Documentation#

inline void pvr::utils::createMultipleBuffersFromMesh(pvrvk::Device &device, const assets::Mesh &mesh, std::vector<pvrvk::Buffer> &outVbos, pvrvk::Buffer &outIbo, pvrvk::CommandBuffer &uploadCmdBuffer, bool &requiresCommandBufferSubmission, vma::Allocator bufferAllocator, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT)#

Auto generates a set of VBOs and a single IBO from all the vertex data of a mesh.

This utility function will read all vertex data from the mesh and create one pvrvk::Buffer for each data element (block of interleaved data) in the mesh. It is thus commonly used for for meshes containing multiple sets of interleaved data (for example, a VBO with static and a VBO with streaming data).

Parameters
  • device – The device where the buffers will be generated on

  • mesh – The mesh whose data will populate the buffers

  • outVbos – Reference to a std::vector of VBO handles where the data will be put. Buffers will be appended at the end.

  • outIbo – The IBO handle where the data will be put. No buffer needs to have been created on the handle. If no face data is present on the mesh, the handle will be null.

  • uploadCmdBuffer – A command buffer into which commands may be recorded for uploading mesh data to the created buffers. This command buffer will only be used when memory without e_HOST_VISIBLE_BIT memory property flags was allocated for the vbos or ibos.

  • requiresCommandBufferSubmission – Indicates whether commands have been recorded into the given command buffer.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

pvr::utils::createInputAssemblyFromMesh#

Function Documentation#

inline VertexConfiguration pvr::utils::createInputAssemblyFromMesh(const assets::Mesh &mesh, const VertexBindings_Name *bindingMap, uint16_t numBindings, uint16_t *outNumBuffers = NULL)#

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::CullModeFlags pvr::utils::convertToPVRVk(::pvr::Face item)#

pvr::utils::captureImageRegion#

Function Documentation#

std::vector<unsigned char> pvr::utils::captureImageRegion(pvrvk::Queue &queue, pvrvk::CommandPool &commandPool, pvrvk::Image &image, pvrvk::Offset3D srcOffset = pvrvk::Offset3D(0, 0, 0), pvrvk::Extent3D srcExtent = pvrvk::Extent3D(static_cast<uint32_t>(-1), static_cast<uint32_t>(-1), static_cast<uint32_t>(-1)), pvrvk::Format destinationImageFormat = pvrvk::Format::e_UNDEFINED, pvrvk::ImageLayout imageInitialLayout = pvrvk::ImageLayout::e_TRANSFER_SRC_OPTIMAL, pvrvk::ImageLayout imageFinalLayout = pvrvk::ImageLayout::e_TRANSFER_DST_OPTIMAL, vma::Allocator bufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr)#

Retrieves and returns the contents of a particular image region. Note that the image must have been created with the pvrvk::ImageUsageFlags::e_TRANSFER_SRC_BIT set.

SCREENSHOTS ////////////////////////

Parameters
  • queue – A queue to submit the generated command buffer to. This queue must be compatible with the command pool provided.

  • commandPool – A command pool from which to allocate a temporary command buffer to carry out the transfer operations.

  • image – The image from which the specified region will be retrieved.

  • srcOffset – The offset into the specified image from which to begin the region to capture.

  • srcExtent – The extent of the region to capture.

  • destinationImageFormat – The format to use for the saved image. Valid format conversions will be applied using vkCmdBlitImage.

  • imageInitialLayout – The initial layout of the image from which a transition will be made to pvrvk::ImageLayout::e_TRANSFER_SRC_OPTIMAL.

  • imageFinalLayout – The final layout of the image to which a transition will be made.

  • bufferAllocator – A VMA allocator used to allocate memory for the created the buffer used as the target of an imageToBufferCopy.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

Returns

A vector containing the retrieved image data

pvr::utils::takeScreenshot#

Function Documentation#

bool pvr::utils::takeScreenshot(pvrvk::Queue &queue, pvrvk::CommandPool &commandPool, pvrvk::Swapchain &swapchain, const uint32_t swapIndex, const std::string &screenshotFileName, vma::Allocator bufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, const uint32_t screenshotScale = 1)#

Saves a particular swapchain image corresponding to the swapchain image at index swapIndex for the swapchain.

Parameters
  • queue – A queue to submit the generated command buffer to. This queue must be compatible with the command pool provided.

  • commandPool – A command pool from which to allocate a temporary command buffer to carry out the transfer operations.

  • swapchain – The swapchain from which a particular image will be saved.

  • swapIndex – The swapchain image at index swapIndex will be saved as a TGA file.

  • screenshotFileName – The filename to use for the saved TGA image.

  • bufferAllocator – A VMA allocator used to allocate memory for the created the buffer used as the target of an imageToBufferCopy.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • screenshotScale – A scaling factor to use for increasing the size of the saved screenshot.

Returns

True if the screenshot could be taken successfully

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::ImageAspectFlags pvr::utils::convertToPVRVk(::pvr::ImageAspectFlags item)#

pvr::utils::updateImage#

Function Documentation#

void pvr::utils::updateImage(pvrvk::Device &device, pvrvk::CommandBufferBase transferCommandBuffer, ImageUpdateInfo *updateInfos, uint32_t numUpdateInfos, pvrvk::Format format, pvrvk::ImageLayout layout, bool isCubeMap, pvrvk::Image &image, vma::Allocator bufferAllocator = nullptr)#

Utility function to update an image’s data. This function will record the update of the image in the supplied command buffer but NOT submit the command buffer, hence allowing the user to submit it at his own time. IMPORTANT. Assumes image layout is pvrvk::ImageLayout::e_DST_OPTIMAL IMPORTANT. The cleanup object that is the return value of the function must be kept alive as long until the moment that the relevant command buffer submission is finished. Then it can be destroyed (or the cleanup function be called) to free any relevant resources.

Parameters
  • device – The device used to create the image

  • transferCommandBuffer – The command buffer into which the image update operations will be added.

  • updateInfos – This object is a c-style array of areas and the data to upload.

  • numUpdateInfos – The number of ImageUpdateInfo objects in

  • format – The format of the image.

  • layout – The final image layout for the image being updated.

  • isCubeMap – Is the image a cubemap

  • image – The image to update

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

Returns

Returns a pvrvk::Image update results structure - ImageUpdateResults

pvr::utils::appendSingleBuffersFromModel#

Function Documentation#

template<typename VboContainer_, typename IboContainer_>
inline void pvr::utils::appendSingleBuffersFromModel(pvrvk::Device &device, const assets::Model &model, VboContainer_ &vbos, IboContainer_ &ibos, pvrvk::CommandBuffer &uploadCmdBuffer, bool &requiresCommandBufferSubmission, vma::Allocator bufferAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of the meshes of a model and appends them at the end of containers provided by the user.

This utility function will read all vertex data from the VBO. It is usually preferred for meshes meshes containing a single set of interleaved data. If multiple data elements (i.e. sets of interleaved data), each block will be successively placed after the other.

Parameters
  • device – The device device where the buffers will be generated on

  • model – The model whose meshes will be used to generate the Buffers

  • vbos – A container of pvrvk::Buffer handles. The VBOs will be inserted at the end of this container.

  • ibos – A container of pvrvk::Buffer handles. The IBOs will be inserted at the end of this container.

  • uploadCmdBuffer – A command buffer into which commands may be recorded for uploading mesh data to the created buffers. This command buffer will only be used when memory without e_HOST_VISIBLE_BIT memory property flags was allocated for the vbos or ibos.

  • requiresCommandBufferSubmission – Indicates whether commands have been recorded into the given command buffer.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::Extent2D pvr::utils::convertToPVRVk(const Extent2D &extent)#

Convert to pvrvk Extent2D.

Parameters

extent – The pvr::Extent2D to convert

Returns

A pvrvk::Extent2D representing the Extent2D

pvr::utils::convertToPVRVkVertexInputFormat#

Function Documentation#

inline pvrvk::Format pvr::utils::convertToPVRVkVertexInputFormat(DataType dataType, uint8_t width)#

Convert to pvrvk format.

Parameters
  • dataType – Type of the data(Float32, Int32 etc)

  • width – The Width of the data type

Returns

A pvrvk::Format (pvrvk::Format::e_R32_SFLOAT, pvrvk::Format::e_R32G32_SFLOAT etc)

pvr::utils::generateCookTorranceBRDFLUT#

Function Documentation#

inline pvr::Texture pvr::utils::generateCookTorranceBRDFLUT(uint32_t mapDim = 256)#

Generates BRDF lookup table image.

Parameters

mapDim – Out put image size. Default 256

Returns

A generated texture containing a Cook Torrance BRDF Lookup table

pvr::utils::endCommandBufferDebugLabel#

Function Documentation#

inline void pvr::utils::endCommandBufferDebugLabel(pvrvk::CommandBufferBase commandBufferBase)#

Ends a label region of work submitted to this base command buffer.

Parameters

commandBufferBase – The command buffer base to which the debug label region should be ended

pvr::utils::loadAndUploadImage#

Function Documentation#

pvrvk::Image pvr::utils::loadAndUploadImage(pvrvk::Device &device, const char *fileName, bool allowDecompress, pvrvk::SecondaryCommandBuffer &commandBuffer, IAssetProvider &assetProvider, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, Texture *outAssetTexture = nullptr, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Load and upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • fileName – The filename of a source texture from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A secondary command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • assetProvider – Specifies an asset provider to use for loading the texture from system memory.

  • usageFlags – Specifies the usage flags for the image being created.

  • finalLayout – The final image layout the image will be transitioned to.

  • outAssetTexture – A pointer to a created pvr::texture.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The Image Object uploaded.

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(CompareOp func)#

Convert to opengl comparison mode.

Parameters

func – A ComparisonMode enum

Returns

A GLenum representing a ComparisonMode (GL_LESS, GL_EQUAL etc)

pvr::utils::setImageLayoutAndQueueFamilyOwnership#

Function Documentation#

void pvr::utils::setImageLayoutAndQueueFamilyOwnership(pvrvk::CommandBufferBase srccmd, pvrvk::CommandBufferBase dstcmd, uint32_t srcQueueFamily, uint32_t dstQueueFamily, pvrvk::ImageLayout oldLayout, pvrvk::ImageLayout newLayout, pvrvk::Image &image, uint32_t baseMipLevel, uint32_t numMipLevels, uint32_t baseArrayLayer, uint32_t numArrayLayers, pvrvk::ImageAspectFlags aspect)#

Set image layout and queue family ownership.

Parameters
  • srccmd – The source command buffer from which to transition the image from.

  • dstcmd – The destination command buffer from which to transition the image to.

  • srcQueueFamily – srcQueueFamily is the source queue family for a queue family ownership transfer.

  • dstQueueFamily – dstQueueFamily is the destination queue family for a queue family ownership transfer.

  • oldLayout – An old image layout to transition from

  • newLayout – A new image layout to transition to

  • image – The image to transition

  • baseMipLevel – The base mip level of the image to transition

  • numMipLevels – The number of mip levels of the image to transition

  • baseArrayLayer – The base array layer level of the image to transition

  • numArrayLayers – The number of array layers of the image to transition

  • aspect – The pvrvk::ImageAspectFlags of the image to transition

pvr::utils::createSwapchain#

Function Documentation#

pvrvk::Swapchain pvr::utils::createSwapchain(const pvrvk::Device &device, const pvrvk::Surface &surface, pvr::DisplayAttributes &displayAttributes, pvrvk::ImageUsageFlags swapchainImageUsageFlags = pvrvk::ImageUsageFlags::e_COLOR_ATTACHMENT_BIT, const std::vector<pvrvk::Format> &preferredColorFormats = std::vector<pvrvk::Format>())#

Create a pvrvk::Swapchain using a pre-initialised pvrvk::Device and pvrvk::Surface.

Parameters
  • device – A logical device to use for creating the pvrvk::Swapchain.

  • surface – A pvrvk::Surface from which surface capabilities, supported formats and presentation modes will be derived.

  • displayAttributes – A set of display attributes from which certain properties will be taken such as width, height, vsync mode and preferences for the number of pixels per channel.

  • swapchainImageUsageFlags – Specifies for what the swapchain images can be used for.

Returns

Return the created pvrvk::Swapchain

pvr::utils::getDepthStencilBits#

Function Documentation#

void pvr::utils::getDepthStencilBits(pvrvk::Format format, uint32_t &depthBits, uint32_t &stencilBits)#

Determines the number of depth and stencil bits per pixel for the given pvrvk::Format.

Parameters
  • format – A format to calculate the number of bits for

  • depthBits – The number of depth bits per pixel

  • stencilBits – The number of stencil bits per pixel

pvr::utils::insertSorted#

Function Documentation#

template<typename container, typename val>
size_t pvr::utils::insertSorted(container &cont, const val &item)#

Insert sorted element in to the container.

Parameters
  • cont – Container to insert the element into.

  • item – Item to insert in to the container

pvr::utils::populateViewportStateCreateInfo#

Function Documentation#

inline void pvr::utils::populateViewportStateCreateInfo(const pvrvk::Framebuffer &framebuffer, pvrvk::PipelineViewportStateCreateInfo &outCreateInfo)#

Fills out a pvrvk::ViewportStateCreateInfo structure setting parameters for a ‘default’ viewport and scissor based on the specified frame buffer dimensions.

Parameters
  • framebuffer – An input Framebuffer object from which to take dimensions used to initialise a pvrvk::ViewportStateCreateInfo structure.

  • outCreateInfo – A pvrvk::ViewportStateCreateInfo structure which will have its viewport and scissor members set based on the framebuffers dimensions.

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(BlendFactor blendFactor)#

Convert to opengl blend factor output.

Parameters

blendFactor – A BlendFactor enum

Returns

A GLenum representing a BlendFactor (GL_ZERO, GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA etc)

pvr::utils::loadAndUploadImageAndView#

Function Documentation#

pvrvk::ImageView pvr::utils::loadAndUploadImageAndView(pvrvk::Device &device, const char *fileName, bool allowDecompress, pvrvk::SecondaryCommandBuffer &commandBuffer, IAssetProvider &assetProvider, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, Texture *outAssetTexture = nullptr, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE, const void *pNext = nullptr)#

Load and upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • fileName – The filename of a source texture from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A secondary command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • assetProvider – Specifies an asset provider to use for loading the texture from system memory.

  • usageFlags – Specifies the usage flags for the image being created.

  • finalLayout – The final image layout the image will be transitioned to.

  • outAssetTexture – A pointer to a created pvr::texture.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The Image Object uploaded.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::Offset2D pvr::utils::convertToPVRVk(const Offset2D &offset)#

Convert to pvrvk Offset2D.

Parameters

offset – The pvr::Offset2D to convert

Returns

A pvrvk::Offset2D representing the Offset2D

pvr::utils::createShaderModule#

Function Documentation#

pvrvk::ShaderModule pvr::utils::createShaderModule(pvrvk::Device &device, const Stream &shaderSource, pvrvk::ShaderStageFlags shaderStageFlags, pvrvk::ShaderModuleCreateFlags flags = pvrvk::ShaderModuleCreateFlags::e_NONE, const char *const *defines = nullptr, uint32_t numDefines = 0)#

Load a ShaderModule from shader source using glslang.

Parameters
  • device – A device from which to create the ShaderModule

  • shaderSource – A stream containing the shader source text data

  • shaderStageFlags – The type (stage) of the shader (vertex, fragment…)

  • flags – A set of pvrvk::ShaderModuleCreateFlags controlling how the ShaderModule will be created

  • defines – A number of preprocessor definitions that will be passed to the shader

  • numDefines – The number of defines

Returns

The created ShaderModule object

pvr::utils::insertSorted#

Function Documentation#

template<typename container, typename val>
size_t pvr::utils::insertSorted(container &cont, typename container::iterator begin, typename container::iterator end, const val &item)#

Insert sorted element in to the container.

Parameters
  • cont – Container to insert the element into.

  • begin – Container range begin

  • end – Container range end

  • item – Item to insert in to the container

pvr::utils::getOpenGLFormat#

Function Documentation#

inline void pvr::utils::getOpenGLFormat(ImageStorageFormat storageFormat, uint32_t &glInternalFormat, uint32_t &glFormat, uint32_t &glType, uint32_t &glTypeSize, bool &isCompressedFormat)#

Retrieves the OpenGL ES texture formats for a texture with the provided ImageStorageFormat.

Parameters
  • storageFormat – The pvr::ImageStorageFormat to retrieve a corresponding set of OpenGL ES texture formats for.

  • glInternalFormat – The internal OpenGL ES format corresponding to the provided pvr::ImageStorageFormat storageFormat

  • glFormat – The OpenGL ES format corresponding to the provided pvr::ImageStorageFormat storageFormat

  • glType – The OpenGL ES type corresponding to the provided pvr::ImageStorageFormat storageFormat

  • glTypeSize – The OpenGL ES type size corresponding to the provided pvr::ImageStorageFormat storageFormat

  • isCompressedFormat – Specifies whether the OpenGL ES format retrieved is a compressed format.

pvr::utils::insertDebugUtilsLabel#

Function Documentation#

inline void pvr::utils::insertDebugUtilsLabel(pvrvk::SecondaryCommandBuffer &secondaryCommandBuffer, const pvrvk::DebugUtilsLabel &labelInfo)#

Inserts a single debug label any time.

Parameters
  • secondaryCommandBuffer – The secondary command buffer to which the debug label should be inserted

  • labelInfo – Specifies the parameters of the label region to insert

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(PolygonWindingOrder windingOrder)#

Convert to opengl winding-order.

Parameters

windingOrder – A PolygonWindingOrder enum

Returns

A GLenum representing a winding order (GL_CW, GL_CCW)

pvr::utils::endCommandBufferDebugLabel#

Function Documentation#

inline void pvr::utils::endCommandBufferDebugLabel(pvrvk::CommandBuffer &commandBuffer)#

Ends a label region of work submitted to this command buffer.

Parameters

commandBuffer – The command buffer to which the debug label region should be ended

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::Filter pvr::utils::convertToPVRVk(::pvr::Filter item)#

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::Format pvr::utils::convertToPVRVk(const ImageDataFormat &format)#

Convert to pvrvk pixel format.

Parameters

format – Image Data format

Returns

A pvrvk::Format representing the pixel format

pvr::utils::createSingleBuffersFromMesh#

Function Documentation#

inline void pvr::utils::createSingleBuffersFromMesh(const assets::Mesh &mesh, GLuint &outVbo, GLuint &outIbo)#

Auto generates a single VBO and a single IBO from all the vertex data of a mesh. RESETS GL STATE: GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER.

This utility function will read all vertex data from a mesh’s data elements and create a single VBO. It is commonly used for a single set of interleaved data. If data are not interleaved, they will be packed on the same VBO, each interleaved block (Data element on the mesh) will be appended at the end of the buffer, and the offsets will need to be calculated by the user when binding the buffer.

Parameters
  • context – The device context where the buffers will be generated on

  • mesh – The mesh whose data will populate the buffers

  • outVbo – The VBO handle where the data will be put. No buffer needs to have been created on the handle. IS ASSUMED TO NOT BE A VALID OPENGL OBJECT.

  • outIbo – The IBO handle where the data will be put. No buffer needs to have been created on the handle. If no face data is present on the mesh, the handle will be set to zero. IS ASSUMED TO NOT BE A VALID OPENGL OBJECT.

pvr::utils::createSwapchainAndDepthStencilImageAndViews#

Function Documentation#

void pvr::utils::createSwapchainAndDepthStencilImageAndViews(const pvrvk::Device &device, const pvrvk::Surface &surface, pvr::DisplayAttributes &displayAttributes, pvrvk::Swapchain &outSwapchain, Multi<pvrvk::ImageView> &outDepthStencilImages, const pvrvk::ImageUsageFlags &swapchainImageUsageFlags = pvrvk::ImageUsageFlags::e_COLOR_ATTACHMENT_BIT, const pvrvk::ImageUsageFlags &dsImageUsageFlags = pvrvk::ImageUsageFlags::e_DEPTH_STENCIL_ATTACHMENT_BIT | pvrvk::ImageUsageFlags::e_TRANSIENT_ATTACHMENT_BIT, const vma::Allocator &imageAllocator = nullptr, vma::AllocationCreateFlags dsImageAllocationCreateFlags = vma::AllocationCreateFlags::e_DEDICATED_MEMORY_BIT)#

DEPRECATED. Either use createSwapchainRenderpassFramebuffers, or createSwapchain and createAttachments.

Parameters
  • device – DEPRECATED

  • surface – DEPRECATED

  • displayAttributes – DEPRECATED

  • outSwapchain – DEPRECATED

  • outDepthStencilImages

  • swapchainImageUsageFlags – DEPRECATED

  • dsImageUsageFlags – DEPRECATED

  • dsImageAllocator – DEPRECATED

  • dsImageAllocationCreateFlags – DEPRECATED

pvr::utils::createDeviceAndQueues#

Function Documentation#

pvrvk::Device pvr::utils::createDeviceAndQueues(pvrvk::PhysicalDevice physicalDevice, const QueuePopulateInfo *queueCreateInfos, uint32_t numQueueCreateInfos, QueueAccessInfo *outAccessInfo, const DeviceExtensions &deviceExtensions = DeviceExtensions())#

Create the pvrvk::Device and the queues.

Parameters
  • physicalDevice – A physical device to use for creating the logical device.

  • queueCreateInfos – A pointer to a list of QueuePopulateInfo structures specifying the required properties for each of the queues retrieved.

  • numQueueCreateInfos – The number of QueuePopulateInfo structures provided.

  • outAccessInfo – A pointer to a list of QueueAccessInfo structures specifying the properties for each of the queues retrieved.

  • deviceExtensions – A DeviceExtensions structure which specifyies a list device extensions to try to enable.

Returns

Returns the created device

pvr::utils::createSurface#

Function Documentation#

pvrvk::Surface pvr::utils::createSurface(const pvrvk::Instance &instance, const pvrvk::PhysicalDevice &physicalDevice, void *window, void *display, void *connection)#

Creates an abstract vulkan native platform surface.

Parameters
  • instance – The instance from which to create the native platform surface.

  • physicalDevice – A physical device from which to create the native platform surface.

  • window – A pointer to a NativeWindow used to create the windowing surface.

  • display – A pointer to a NativeDisplay used to create the windowing surface.

  • connection – A pointer to a NativeConnection used to create the windowing surface.

Returns

A pointer to an abstract vulkan native platform surface.

pvr::utils::loadAndUploadImage#

Function Documentation#

pvrvk::Image pvr::utils::loadAndUploadImage(pvrvk::Device &device, const char *fileName, bool allowDecompress, pvrvk::CommandBuffer &commandBuffer, IAssetProvider &assetProvider, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, Texture *outAssetTexture = nullptr, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Load and upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • fileName – The filename of a source texture from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • assetProvider – Specifies an asset provider to use for loading the texture from system memory.

  • usageFlags – Specifies the usage flags for the image being created.

  • finalLayout – The final image layout the image will be transitioned to.

  • outAssetTexture – A pointer to a created pvr::texture.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The Image Object uploaded.

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(SamplerAddressMode addressMode)#

Convert to opengl sampler wrap.

Parameters

addressMode – A SamplerAddressMode enum

Returns

A GLenum representing a Sampler Wrap mode (GL_CLAMP_TO_EDGE, GL_REPEAT etc)

pvr::utils::createSingleBuffersFromMeshes#

Function Documentation#

template<typename MeshIterator_, typename VboInsertIterator_, typename IboInsertIterator_>
inline void pvr::utils::createSingleBuffersFromMeshes(MeshIterator_ meshIter, MeshIterator_ meshIterEnd, VboInsertIterator_ outVbos, IboInsertIterator_ outIbos)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of multiple meshes and uses std::inserter provided by the user to insert them to any container.

This utility function will read all vertex data from a mesh’s data elements and create a single VBO. It is commonly used for a single set of interleaved data (mesh.getNumDataElements() == 1). If more data elements are present (i.e. more than a single interleaved data element) , they will be packed in the sameVBO, with each interleaved block (Data element ) appended at the end of the buffer. It is then the user’s responsibility to use the buffer correctly with the API (for example use bindbufferbase and similar) with the correct offsets. The std::inserter this function requires can be created from any container with an insert() function with (for example, for insertion at the end of a vector) std::inserter(std::vector,

std::vector::end()) .

Parameters
  • context – The device context where the buffers will be generated on

  • meshIter – Iterator for a collection of meshes.

  • meshIterEnd – End Iterator for meshIter.

  • outVbos – std::inserter for a collection of api::Buffer handles. It will be used to insert one VBO per mesh.

  • outIbos – std::inserter for a collection of api::Buffer handles. It will be used to insert one IBO per mesh. If face data is not present on the mesh, a null handle will be inserted.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::Extent3D pvr::utils::convertToPVRVk(const Extent3D &extent)#

Convert to pvrvk Extent3D.

Parameters

extent – The pvr::Extent3D to convert

Returns

A pvrvk::Extent3D representing the Extent3D

pvr::utils::beginCommandBufferDebugLabel#

Function Documentation#

inline void pvr::utils::beginCommandBufferDebugLabel(pvrvk::CommandBufferBase commandBufferBase, const pvrvk::DebugUtilsLabel &labelInfo)#

Begins identifying a region of work submitted to this command buffer. The calls to beginDebugUtilsLabel and endDebugUtilsLabel must be matched and balanced.

Parameters
  • commandBufferBase – The command buffer base to which the debug label region should be opened

  • labelInfo – Specifies the parameters of the label region to open

pvr::utils::appendSingleBuffersFromModel#

Function Documentation#

template<typename VboContainer_, typename IboContainer_>
inline void pvr::utils::appendSingleBuffersFromModel(const assets::Model &model, VboContainer_ &vbos, IboContainer_ &ibos)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of the meshes of a model and appends them at the end of containers provided by the user.

This utility function will read all vertex data from the VBO. It is usually preferred for meshes meshes containing a single set of interleaved data. If multiple data elements (i.e. sets of interleaved data), each block will be successively placed after the other.

Parameters
  • context – The device context where the buffers will be generated on

  • model – The model whose meshes will be used to generate the Buffers

  • vbos – A container of api::Buffer handles. The VBOs will be inserted at the end of this container.

  • ibos – A container of api::Buffer handles. The IBOs will be inserted at the end of this container.

pvr::utils::beginCommandBufferDebugLabel#

Function Documentation#

inline void pvr::utils::beginCommandBufferDebugLabel(pvrvk::SecondaryCommandBuffer &secondaryCommandBuffer, const pvrvk::DebugUtilsLabel &labelInfo)#

Begins identifying a region of work submitted to this secondary command buffer. The calls to beginDebugUtilsLabel and endDebugUtilsLabel must be matched and balanced.

Parameters
  • secondaryCommandBuffer – The secondary command buffer to which the debug label region should be opened

  • labelInfo – Specifies the parameters of the label region to open

pvr::utils::operator&#

Function Documentation#

inline ModelGles::Flags pvr::utils::operator&(ModelGles::Flags lhs, ModelGles::Flags rhs)#

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(PrimitiveTopology primitiveType)#

Convert to opengl priitive type.

Parameters

primitiveType – a PrimitiveTopology enum

Returns

A GLenum representing a primitive type (GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_POINTS etc)

pvr::utils::deleteTexturesAndZero#

Function Documentation#

template<typename ...Args>
inline void pvr::utils::deleteTexturesAndZero(GLuint &first, Args&... rest)#

pvr::utils::createBuffer#

Function Documentation#

pvrvk::Buffer pvr::utils::createBuffer(const pvrvk::Device &device, const pvrvk::BufferCreateInfo &createInfo, pvrvk::MemoryPropertyFlags requiredMemoryFlags, pvrvk::MemoryPropertyFlags optimalMemoryFlags = pvrvk::MemoryPropertyFlags::e_NONE, const vma::Allocator &bufferAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT, pvrvk::MemoryAllocateFlags memoryAllocateFlags = pvrvk::MemoryAllocateFlags::e_NONE)#

Create a new buffer object and (optionally) allocate and bind memory for it.

.

Parameters
  • device – The device on which to create the buffer

  • createInfo – A pvrvk::BufferCreateInfo structure controlling how the buffer will be created.

  • requiredMemoryFlags – The minimal set of memory property flags which are required for the PVRVk buffer to be created. If pvrvk::MemoryPropertyFlags::e_NONE is passed, no memory will be allocated for this buffer.

  • optimalMemoryFlags – The most optimal set of memory property flags which could be used by the memory backing the returned PVRVk buffer. If pvrvk::MemoryPropertyFlags::e_NONE is passed optimalMemoryFlags will be set to match requiredMemoryFlags.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

  • memoryAllocateFlags – A bitmask of pvrvk::MemoryAllocateFlagBits controlling the allocation.

Returns

Return a valid object if success

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::SamplerAddressMode pvr::utils::convertToPVRVk(::pvr::SamplerAddressMode item)#

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::BlendOp pvr::utils::convertToPVRVk(::pvr::BlendOp item)#

pvr::utils::createShaderModule#

Function Documentation#

pvrvk::ShaderModule pvr::utils::createShaderModule(pvrvk::Device &device, std::string &shaderSource, pvrvk::ShaderStageFlags shaderStageFlags, pvrvk::ShaderModuleCreateFlags flags = pvrvk::ShaderModuleCreateFlags::e_NONE, const char *const *defines = nullptr, uint32_t numDefines = 0)#

Load a ShaderModule from shader source using glslang.

Parameters
  • device – A device from which to create the ShaderModule

  • shaderSource – A string containing the shader source text data

  • shaderStageFlags – The type (stage) of the shader (vertex, fragment…)

  • flags – A set of pvrvk::ShaderModuleCreateFlags controlling how the ShaderModule will be created

  • defines – A number of preprocessor definitions that will be passed to the shader

  • numDefines – The number of defines

Returns

The created ShaderModule object

pvr::utils::getColorBits#

Function Documentation#

void pvr::utils::getColorBits(pvrvk::Format format, uint32_t &redBits, uint32_t &greenBits, uint32_t &blueBits, uint32_t &alphaBits)#

Determines the number of color bits per pixel for the given pvrvk::Format.

Parameters
  • format – A format to calculate the number of bits for

  • redBits – The number of red bits per pixel

  • greenBits – The number of green bits per pixel

  • blueBits – The number of blue bits per pixel

  • alphaBits – The number of alpha channel bits per pixel

pvr::utils::isSupportedFormat#

Function Documentation#

bool pvr::utils::isSupportedFormat(const pvrvk::PhysicalDevice &pdev, pvrvk::Format fmt)#

Test whether the given texture format is supported by the physical device given as parameter.

IMAGES LAYOUTS AND QUEUES /////////////////

Parameters
  • pdev – Physical device to test whether a format is supported.

  • fmt – Format to support.

pvr::utils::isImageUsageSupportedBySurface#

Function Documentation#

inline bool pvr::utils::isImageUsageSupportedBySurface(const pvrvk::SurfaceCapabilitiesKHR &surfaceCapabilities, pvrvk::ImageUsageFlags imageUsage)#

Utility function used to determine whether the SurfaceCapabilitiesKHR supportedUsageFlags member contains the specified image usage and therefore can be used in the intended way.

Parameters
  • surfaceCapabilities – A SurfaceCapabilitiesKHR structure returned via a call to PhysicalDevice->getSurfaceCapabilities().

  • imageUsage – A set of image usage flags which should be checked for support.

Returns

“true” if the supportedUsageFlags member of the SurfaceCapabilitiesKHR structure contains the specified imageUsage flag bits.

pvr::utils::convertToPVRVkPixelFormat#

Function Documentation#

inline pvrvk::Format pvr::utils::convertToPVRVkPixelFormat(PixelFormat format, ColorSpace colorSpace, VariableType dataType, bool &outIsCompressedFormat)#

Convert to pvrvk pixel format.

Parameters
  • format – Pixel format

  • colorSpace – Color space of the format (lRGB, sRGB)

  • dataType – TYpe of the data (SignedByte, SignedInteger etc)

  • outIsCompressedFormat – Return if its a compressed format

Returns

A pvrvk::Format representing the pixel format

pvr::utils::endQueueDebugLabel#

Function Documentation#

inline void pvr::utils::endQueueDebugLabel(pvrvk::Queue queue)#

Ends a label region of work submitted to this queue.

Parameters

queue – The queue to which the debug label region should be ended

pvr::utils::checkFboStatus#

Function Documentation#

inline bool pvr::utils::checkFboStatus()#

Check the currently bound GL_DRAW_FRAMEBUFFER status. On success, return true. On error, log the actual error log and return false.

Returns

True on GL_FRAMEBUFFER_COMPLETE, otherwise false. Additionally logs the error on false

pvr::utils::updateHostVisibleBuffer#

Function Documentation#

inline void pvr::utils::updateHostVisibleBuffer(pvrvk::Buffer &buffer, const void *data, VkDeviceSize offset = 0, VkDeviceSize size = VK_WHOLE_SIZE, bool flushMemory = false)#

Utility function to update a buffer’s data. This function maps and unmap the buffer only if the buffer is not already mapped.

Parameters
  • buffer – The buffer to map -> update -> unmap.

  • data – The data to use in the update

  • offset – The offset to use for the map -> update -> unmap

  • size – The size of the data to be updated

  • flushMemory – Boolean flag determining whether to flush the memory prior to the unmap

pvr::utils::getCurrentGlesVersion#

Function Documentation#

inline Api pvr::utils::getCurrentGlesVersion()#

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(ImageAspectFlags type)#

Convert to an opengl image aspect type.

Parameters

type – An ImageAspectFlags enum

Returns

A GLenum representing the ImageAspectFlags

pvr::utils::getGlErrorString#

Function Documentation#

const char *pvr::utils::getGlErrorString(GLuint apiError)#

Retrieves a string representation of an OpenGLES error code.

Parameters

apiError – The OpenGLES error code to stringify.

Returns

The string representation of the given OpenGLES error code.

pvr::utils::getMemoryTypeIndex#

Function Documentation#

void pvr::utils::getMemoryTypeIndex(const pvrvk::PhysicalDevice &physicalDevice, const uint32_t allowedMemoryTypeBits, const pvrvk::MemoryPropertyFlags requiredMemoryProperties, const pvrvk::MemoryPropertyFlags optimalMemoryProperties, uint32_t &outMemoryTypeIndex, pvrvk::MemoryPropertyFlags &outMemoryPropertyFlags)#

Utility function for retrieving a memory type index for a suitable memory type which supports the memory type bits specified. If the optimal set of memory properties are supported then return the corresponding memory type index otherwise check for availablility of the required set of memory properties. This allows for implementations to optionally request the use of a more optimal set of memory properties whilst still preserving the ability to retrieve the required set of memory properties as a fallback.

Parameters
  • physicalDevice – The physical device whose set of pvrvk::PhysicalDeviceMemoryProperties will be used to determine support for the requested memory properties.

  • allowedMemoryTypeBits – The memory type bits allowed. The required memory type chosen must be one of those allowed.

  • optimalMemoryProperties – A set of optimal memory properties which may be preferred by the application.

  • requiredMemoryProperties – The set of memory properties which must be present.

  • outMemoryTypeIndex – The returned memory type index.

  • outMemoryPropertyFlags – The returned set of memory property flags.

pvr::utils::createDepthStencilImageAndViews#

Function Documentation#

inline std::vector<pvrvk::ImageView> pvr::utils::createDepthStencilImageAndViews(const pvrvk::Device &device, int32_t imageCount, pvrvk::Format depthFormat, const pvrvk::Extent2D &imageExtent, const pvrvk::ImageUsageFlags &imageUsageFlags = pvrvk::ImageUsageFlags::e_DEPTH_STENCIL_ATTACHMENT_BIT | pvrvk::ImageUsageFlags::e_TRANSIENT_ATTACHMENT_BIT, pvrvk::SampleCountFlags sampleCount = pvrvk::SampleCountFlags::e_1_BIT, vma::Allocator dsImageAllocator = nullptr, vma::AllocationCreateFlags dsImageAllocationCreateFlags = vma::AllocationCreateFlags::e_DEDICATED_MEMORY_BIT)#

DEPRECATED. Use createAttachmentImages instead.

Parameters
  • device – DEPRECATED.

  • imageCount – DEPRECATED.

  • depthFormat – DEPRECATED.

  • imageExtent – DEPRECATED.

  • imageUsageFlags – DEPRECATED.

  • sampleCount – DEPRECATED.

  • dsImageAllocator – DEPRECATED.

  • dsImageAllocationCreateFlags – DEPRECATED.

Returns

DEPRECATED.</return>

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::IndexType pvr::utils::convertToPVRVk(IndexType type)#

Convert a pvr::IndexType to its Native, Vulkan representation.

Parameters

type – A pvr::IndexType to convert to its Vulkan representation

Returns

A pvrvk::IndexType corresponding to the pvr::IndexType

pvr::utils::operator&=#

Function Documentation#

inline ModelGles::Flags &pvr::utils::operator&=(ModelGles::Flags &lhs, ModelGles::Flags rhs)#

pvr::utils::isFormatDepthStencil#

Function Documentation#

inline bool pvr::utils::isFormatDepthStencil(pvrvk::Format format)#

Return true if the format is a depth stencil format.

SIMPLE CALCULATIONS ///////////////////

Parameters

format – Format to querry

Returns

True if the pvrvk::Format specified is a depth or stencil format

pvr::utils::getOpenGLStorageFormat#

Function Documentation#

inline void pvr::utils::getOpenGLStorageFormat(ImageStorageFormat storageFormat, GLenum &glInternalFormat)#

Retrieves the internal OpenGL ES texture formats for a texture with the provided ImageStorageFormat.

Parameters
  • storageFormat – The pvr::ImageStorageFormat to retrieve a the internal OpenGL ES texture format for.

  • glInternalFormat – The internal OpenGL ES format corresponding to the provided pvr::ImageStorageFormat storageFormat

Returns

Returns ‘True’ if the utility function was able to successfully determin the internal OpenGL ES format corresponding to the provided pvr::ImageStorageFormat storageFormat.

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::ImageType pvr::utils::convertToPVRVk(::pvr::ImageType item)#

pvr::utils::convertToPVRVkMipmapMode#

Function Documentation#

inline pvrvk::SamplerMipmapMode pvr::utils::convertToPVRVkMipmapMode(Filter filter)#

Convert to pvrvk sampler mip-map mode.

Parameters

filter – Mip map sampler filter

Returns

A pvrvk::SamplerMipmapMode (pvrvk::SamplerMipmapMode::e_NEAREST, pvrvk::SamplerMipmapMode::e_LINEAR)

pvr::utils::inferAspectFromFormat#

Function Documentation#

pvrvk::ImageAspectFlags pvr::utils::inferAspectFromFormat(pvrvk::Format format, uint32_t planeIndex = 0)#

Infers the pvrvk::ImageAspectFlags from the pvrvk::Format.

Parameters

format – A format to infer pvrvk::ImageAspectFlags from

Returns

pvrvk::ImageAspectFlags inferred based on the pvrvk::Format provided

pvr::utils::createSingleBuffersFromModel#

Function Documentation#

template<typename VboInsertIterator_, typename IboInsertIterator_>
inline void pvr::utils::createSingleBuffersFromModel(pvrvk::Device &device, const assets::Model &model, VboInsertIterator_ vbos, IboInsertIterator_ ibos, pvrvk::CommandBuffer &uploadCmdBuffer, bool &requiresCommandBufferSubmission, vma::Allocator bufferAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of the meshes of a model and inserts them into containers provided by the user using std::inserters.

This utility function will read all vertex data from the VBO. It is usually preferred for meshes meshes containing a single set of interleaved data. If multiple data elements (i.e. sets of interleaved data), each block will be successively placed after the other. The std::inserter this function requires can be created from any container with an insert() function with (for example, for insertion at the end of a vector) std::inserter(std::vector, std::vector::end()) .

Parameters
  • device – The device device where the buffers will be generated on

  • model – The model whose meshes will be used to generate the Buffers

  • vbos – An insert iterator to a std::pvrvk::Buffer container for the VBOs. Vbos will be inserted using this iterator.

  • ibos – An insert iterator to an std::pvrvk::Buffer container for the IBOs. Ibos will be inserted using this iterator.

  • uploadCmdBuffer – A command buffer into which commands may be recorded for uploading mesh data to the created buffers. This command buffer will only be used when memory without e_HOST_VISIBLE_BIT memory property flags was allocated for the vbos or ibos.

  • requiresCommandBufferSubmission – Indicates whether commands have been recorded into the given command buffer.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::Offset3D pvr::utils::convertToPVRVk(const Offset3D &offset)#

Convert to pvrvk Offset3D.

Parameters

offset – The pvr::Offset3D to convert

Returns

A pvrvk::Offset3D representing the Offset3D

pvr::utils::createComputeShaderProgram#

Function Documentation#

inline GLuint pvr::utils::createComputeShaderProgram(IAssetProvider &app, const char *compShaderFilename, const char *const *defines = 0, uint32_t numDefines = 0)#

Create a native shader program from a compute shader.

Parameters
  • app – An AssetProvider to use for loading shaders from memory

  • compShaderFilename – The filename of a compute shader

  • defines – A list of defines to be added to the shaders

  • numDefines – The number of defines to be added to the shaders

Returns

The program object

pvr::utils::getNumSamplesFromSampleCountFlags#

Function Documentation#

inline uint8_t pvr::utils::getNumSamplesFromSampleCountFlags(pvrvk::SampleCountFlags sampleCountFlags)#

Convert pvrvk sample count to the number of samples it is equivalent to.

Parameters

sampleCountFlags – The pvrvk sample count to determine the number of samples for

Returns

The number of samples equivalent to the pvrvk sample count flags

pvr::utils::convertToGles#

Function Documentation#

inline GLenum pvr::utils::convertToGles(IndexType type)#

Converts from a pvr::IndexType to its OpenGL ES GLenum counterpart.

Parameters

type – The pvr::IndexType to convert.

Returns

The OpenGL ES GLenum counterpart to a pvr::IndexType.

pvr::utils::createSingleBuffersFromMeshes#

Function Documentation#

template<typename MeshIterator_, typename VboInsertIterator_, typename IboInsertIterator_>
inline void pvr::utils::createSingleBuffersFromMeshes(pvrvk::Device &device, MeshIterator_ meshIter, MeshIterator_ meshIterEnd, VboInsertIterator_ outVbos, IboInsertIterator_ outIbos, pvrvk::CommandBuffer &uploadCmdBuffer, bool &requiresCommandBufferSubmission, vma::Allocator bufferAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of multiple meshes and uses std::inserter provided by the user to insert them to any container.

This utility function will read all vertex data from a mesh’s data elements and create a single VBO. It is commonly used for a single set of interleaved data (mesh.getNumDataElements() == 1). If more data elements are present (i.e. more than a single interleaved data element) , they will be packed in the sameVBO, with each interleaved block (Data element ) appended at the end of the buffer. It is then the user’s responsibility to use the buffer correctly with the API (for example use bindbufferbase and similar) with the correct offsets. The std::inserter this function requires can be created from any container with an insert() function with (for example, for insertion at the end of a vector) std::inserter(std::vector, std::vector::end()) .

Parameters
  • device – The device where the buffers will be generated on

  • meshIter – Iterator for a collection of meshes.

  • meshIterEnd – End Iterator for meshIter.

  • outVbos – std::inserter for a collection of pvrvk::Buffer handles. It will be used to insert one VBO per mesh.

  • outIbos – std::inserter for a collection of pvrvk::Buffer handles. It will be used to insert one IBO per mesh. If face data is not present on the mesh, a null handle will be inserted.

  • uploadCmdBuffer – A command buffer into which commands may be recorded for uploading mesh data to the created buffers. This command buffer will only be used when memory without e_HOST_VISIBLE_BIT memory property flags was allocated for the vbos or ibos.

  • requiresCommandBufferSubmission – Indicates whether commands have been recorded into the given command buffer.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(ImageViewType texType)#

Convert to opengl texture type.

Parameters

texType – A TextureDimension enum

Returns

A GLenum representing a texture dimension (GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_2D_ARRAY)

pvr::utils::convertToPVRVkPixelFormat#

Function Documentation#

inline pvrvk::Format pvr::utils::convertToPVRVkPixelFormat(PixelFormat format, ColorSpace colorSpace, VariableType dataType)#

Convert to pvrvk pixel format.

Parameters
  • format – Pixel format

  • colorSpace – Color space of the format (lRGB, sRGB)

  • dataType – Type of the data (SignedByte, SignedInteger etc)

Returns

A pvrvk::Format representing the pixel format

pvr::utils::beginQueueDebugLabel#

Function Documentation#

inline void pvr::utils::beginQueueDebugLabel(pvrvk::Queue queue, const pvrvk::DebugUtilsLabel &labelInfo)#

Begins identifying a region of work submitted to this queue. The calls to beginDebugUtilsLabel and endDebugUtilsLabel must be matched and balanced.

Parameters
  • queue – The queue to which the debug label region should be opened

  • labelInfo – Specifies the parameters of the label region to open

pvr::utils::uploadImageAndView#

Function Documentation#

pvrvk::ImageView pvr::utils::uploadImageAndView(pvrvk::Device &device, const Texture &texture, bool allowDecompress, pvrvk::SecondaryCommandBuffer &commandBuffer, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Uploads an image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • texture – The source pvr::Texture object from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A secondary command buffer to which the upload operations are be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • usageFlags – A command buffer to add the pipelineBarrier for the image transition.

  • finalLayout – The final image layout the image will be transitioned to.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The loaded image object.

pvr::utils::textureUpload#

Function Documentation#

inline GLuint pvr::utils::textureUpload(const IAssetProvider &app, const std::string &file, pvr::Texture &outTexture, bool isEs2 = false)#

pvr::utils::createSwapchainRenderpassFramebuffers#

Function Documentation#

OnScreenObjects pvr::utils::createSwapchainRenderpassFramebuffers(const pvrvk::Device &device, const pvrvk::Surface &surface, pvr::DisplayAttributes &displayAttributes, const CreateSwapchainParameters &params = CreateSwapchainParameters())#

Create a pvrvk::Framebuffer and RenderPass to use for ‘default’ rendering to the ‘onscreen’ color images. Default configuration is as follows. Formats and other configurations can be tweaked through displayAttributes and params. RenderPass: Attachment0: ColorAttachment swapchain image, finalLayout - PresentSrcKHR LoadOp - Clear StoreOp - Store Attachment1: DepthStencilAttachment finalLayout - DepthStencilAttachmentOptimal LoadOp - Clear StoreOp - Store If displayAttributes.aaSamples>1 Multisampling will be enabled and the correct resolve attachments for multisampling will be created.

Parameters
  • device – The device

  • surface – The surface for which the swapchain will be created.

  • displayAttributes – A configuration object for the requested objects. Can be retrieved from pvr::Shell, or just as easily populated manually.

  • params – A parameter object containing various different configurations to request for the created framebuffers etc. See the CreateSwapchainParameters struct documentation

Returns

An object containing the Swapchain, the Renderpass, the collection of created Framebuffers, and all the created attachments (depth/stencil/resolve).

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::VertexInputBindingDescription pvr::utils::convertToPVRVk(const VertexInputBindingInfo &info)#

Convert to pvrvk VertexInputBindingDescription.

Parameters

info – The pvr::VertexInputBindingInfo to convert

Returns

A pvrvk::VertexInputBindingDescription representing the VertexInputBindingInfo

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::SamplerMipmapMode pvr::utils::convertToPVRVk(::pvr::SamplerMipmapMode item)#

pvr::utils::createSingleBuffersFromMeshes#

Function Documentation#

template<typename MeshIterator_, typename VboContainer_, typename IboContainer_>
inline void pvr::utils::createSingleBuffersFromMeshes(pvrvk::Device &device, MeshIterator_ meshIter, MeshIterator_ meshIterEnd, VboContainer_ &outVbos, typename VboContainer_::iterator vbos_where, IboContainer_ &outIbos, typename IboContainer_::iterator ibos_where, pvrvk::CommandBuffer &uploadCmdBuffer, bool &requiresCommandBufferSubmission, vma::Allocator bufferAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of multiple meshes and insert them at the specified spot in a user-provided container.

This utility function will read all vertex data from a mesh’s data elements and create a single VBO. It is commonly used for a single set of interleaved data (mesh.getNumDataElements() == 1). If more data elements are present (i.e. more than a single interleaved data element) , they will be packed in the sameVBO, with each interleaved block (Data element ) appended at the end of the buffer. It is then the user’s responsibility to use the buffer correctly with the API (for example use bindbufferbase and similar) with the correct offsets.

Parameters
  • device – The device where the buffers will be generated on

  • meshIter – Iterator for a collection of meshes.

  • meshIterEnd – End Iterator for meshIter.

  • outVbos – Collection of pvrvk::Buffer handles. It will be used to insert one VBO per mesh.

  • outIbos – Collection of pvrvk::Buffer handles. It will be used to insert one IBO per mesh. If face data is not present on the mesh, a null handle will be inserted.

  • vbos_where – Iterator on outVbos - the position where the insertion will happen.

  • ibos_where – Iterator on outIbos - the position where the insertion will happen.

  • uploadCmdBuffer – A command buffer into which commands may be recorded for uploading mesh data to the created buffers. This command buffer will only be used when memory without e_HOST_VISIBLE_BIT memory property flags was allocated for the vbos or ibos.

  • requiresCommandBufferSubmission – Indicates whether commands have been recorded into the given command buffer.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

pvr::utils::generatePreFilteredMapMipmapStyle#

Function Documentation#

Texture pvr::utils::generatePreFilteredMapMipmapStyle(pvrvk::Queue queue, pvrvk::ImageView environmentMap, pvr::PixelFormat outputPixelFormat, pvr::VariableType outputVariableType, uint32_t mapSize, bool zeroRoughnessIsExternal, int numMipLevelsToDiscard, uint32_t mapNumSamples = 65536)#

Generate specular irradiance map. Each level of the specular mip map gets blurred corresponding to a roughness value from 0 to 1.0.

Parameters
  • queue – A queue to which command buffers containing commands for generating the diffuse irradiance map will be added.

  • environmentMap – The source environment map to use in the generation

  • outputPixelFormat – The format to use for the diffuse irradiance map generated using this function.

  • outputVariableType – The variable type to use for the generated irradiance map generated using this function

  • mapSize – The size of the map to generate

  • zeroRoughnessIsExternal – Denotes that the source environment map itself will be used for the prefiltered environment map mip map level corresponding to a roughness of 0.

  • numMipLevelsToDiscard – Denotes the number of mip map levels to discard from the bottom of the chain. Generally using the last n mip maps may introduce artifacts.

  • mapNumSamples – The number of samples to use when generating the prefiltered environment map

Returns

The pvr::Texture generated

pvr::utils::insertSorted_overwrite#

Function Documentation#

template<typename container, typename val>
size_t pvr::utils::insertSorted_overwrite(container &cont, const val &item)#

Insert sorted element, Overwrite if element exist in the container.

Parameters
  • cont – Container to insert the element into.

  • item – Item to insert in to the container

pvr::utils::loadShader#

Function Documentation#

GLuint pvr::utils::loadShader(const std::string &shaderSource, ShaderType shaderType, const char *const *defines, uint32_t numDefines)#

Load shader from shader source. Will implicitly load on the current context.

Parameters
  • shaderSource – A string containing the shader source text data

  • shaderType – The type (stage) of the shader (vertex, fragment…)

  • defines – A number of preprocessor definitions that will be passed to the shader

  • numDefines – The number of defines

Returns

The shader object

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::DescriptorType pvr::utils::convertToPVRVk(::pvr::DescriptorType item)#

pvr::utils::validatePhysicalDeviceExtensions#

Function Documentation#

std::vector<int> pvr::utils::validatePhysicalDeviceExtensions(const pvrvk::Instance instance, const std::vector<std::string> &vectorExtensionNames)#

Tests if any of the physical devices available through the instance given as parameter supports all the requested device extensions in vectorExtensionNames.

Parameters
  • instance – Instance to validate the extension names in vectorExtensionNames for each of the available physical devices.

  • vectorExtensionName – The physical device extensions to test availability

Returns

Vector with the indices of the physical devices that support all the extensions given in vectorExtensionNames.

pvr::utils::createDebugUtilsCallbacks#

Function Documentation#

DebugUtilsCallbacks pvr::utils::createDebugUtilsCallbacks(pvrvk::Instance &instance, void *pUserData = nullptr)#

Creates a default set of debug utils messengers or debug callbacks using either VK_EXT_debug_utils or VK_EXT_debug_report respectively. The first callback will trigger an exception to be thrown when an error message is returned. The second callback will Log a message for errors and warnings.

Parameters
  • instance

    The instance from which the debug utils messengers or debug callbacks will be created depending on support for VK_EXT_debug_utils or

    VK_EXT_debug_report respectively.

  • pUserData – Pointer to the user data supplied for the callback.

Returns

A pvr::utils::DebugUtilsCallbacks structure which keeps alive the debug utils callbacks created.

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::FrontFace pvr::utils::convertToPVRVk(::pvr::PolygonWindingOrder item)#

pvr::utils::insertSorted#

Function Documentation#

template<typename container, typename val, typename cmp>
size_t pvr::utils::insertSorted(container &cont, const val &item, const cmp &compare)#

Insert sorted element in to the container.

Parameters
  • item – Item to insert in to the container

  • compare – Comparison operator used for sorting

pvr::utils::textureUpload#

Function Documentation#

inline GLuint pvr::utils::textureUpload(const IAssetProvider &app, const char *file, pvr::Texture &outTexture, bool isEs2 = false)#

Reads a block of pixel data from the frame buffer using the dimensions width and height as the dimensions of the pixel rectangle saved. The function will save the pixel data as a TGA file with the name specified by screenshotFileName. The function can be used to take screenshots of the current frame buffer or frame when called prior to presenting the backbuffer i.e. swapping buffers.

Parameters
  • screenshotFileName – The name used as the filename for the saved TGA screenshot.

  • width – The width of the pixel rectangle retrieved.

  • height – The width of the pixel rectangle retrieved.

  • screenshotScale – A scaling factor to use for increasing the size of the saved screenshot.

Returns

A scaling factor to use for increasing the size of the saved screenshot.

pvr::utils::takeScreenshot#

Function Documentation#

inline void pvr::utils::takeScreenshot(const std::string &screenshotFileName, const uint32_t width, const uint32_t height, const uint32_t screenshotScale = 1)#

Reads a block of pixel data from the frame buffer using the dimensions width and height as the dimensions of the pixel rectangle saved. The function will save the pixel data as a TGA file with the name specified by screenshotFileName. The function can be used to take screenshots of the current frame buffer or frame when called prior to presenting the backbuffer i.e. swapping buffers.

Parameters
  • screenshotFileName – The name used as the filename for the saved TGA screenshot.

  • width – The width of the pixel rectangle retrieved.

  • height – The width of the pixel rectangle retrieved.

  • screenshotScale – A scaling factor to use for increasing the size of the saved screenshot.

pvr::utils::populateInputAssemblyFromMesh#

Function Documentation#

inline void pvr::utils::populateInputAssemblyFromMesh(const assets::Mesh &mesh, const VertexBindings_Name *bindingMap, uint32_t numBindings, pvrvk::PipelineVertexInputStateCreateInfo &vertexCreateInfo, pvrvk::PipelineInputAssemblerStateCreateInfo &inputAssemblerCreateInfo, uint32_t *numOutBuffers = nullptr)#

Fills out input assembly and vertex input state structures using a mesh and a list of corresponding VertexBindings_Name.

Parameters
  • mesh – A mesh from which to retrieve vertex attributes, vertex buffer strides and primitive topology information from.

  • bindingMap – A pointer to an array of VertexBindings_Name structures which specify the semantic and binding names of any vertex attributes to retrieve.

  • numBindings – Specifies the number of VertexBindings structures in the array pointed to by bindingMap.

  • vertexCreateInfo – A pvrvk::PipelineVertexInputStateCreateInfo structure which will be filled by this utility function.

  • inputAssemblerCreateInfo – A pvrvk::InputAssemblerStateCreateInfo structure which will be filled by this utility function.

  • numOutBuffers – A pointer to an unsigned integer which will set to specify the number of buffers required to create buffers for to use the mesh vertex attributes.

pvr::utils::getSupportedDepthStencilFormat#

Function Documentation#

pvrvk::Format pvr::utils::getSupportedDepthStencilFormat(const pvrvk::Device &device, std::vector<pvrvk::Format> preferredDepthFormats = {})#

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::VertexInputAttributeDescription pvr::utils::convertToPVRVk(const VertexAttributeInfo &info, uint32_t binding)#

Convert to pvrvk VertexInputAttributeDescription.

Parameters
  • info – The pvr::VertexAttributeInfo to convert

  • binding – The binding index to use as part of the pvrvk::VertexInputAttributeDescription

Returns

A pvrvk::VertexInputAttributeDescription representing the VertexAttributeInfo with corresponding binding index

pvr::utils::populateClearValues#

Function Documentation#

inline void pvr::utils::populateClearValues(const pvrvk::RenderPass &renderpass, const pvrvk::ClearValue &clearColor, const pvrvk::ClearValue &clearDepthStencilValue, pvrvk::ClearValue *outClearValues)#

Populate color and depthstencil clear values.

Parameters
  • renderpass – The renderpass is used to determine the number of attachments and their formats from which a decision will be as to whether the provided clearColor or clearDepthStencilValue will be used for the corresponding pvrvk::ClearValue structure for each attachment.

  • clearColor – A pvrvk::ClearValue which will be used as the clear color value for the renderpass attachments with color formats

  • clearDepthStencilValue – A pvrvk::ClearValue which will be used as the depth stencil value for the renderpass attachments with depth stencil formats

  • outClearValues – A pointer to an array of pvrvk::ClearValue structures which should have size greater than or equal to the number of renderpass attachments.

pvr::utils::generateTextureAtlas#

Function Documentation#

void pvr::utils::generateTextureAtlas(pvrvk::Device &device, const pvrvk::Image *inputImages, pvrvk::Rect2Df *outUVs, uint32_t numImages, pvrvk::ImageLayout inputImageLayout, pvrvk::ImageView *outImageView, TextureHeader *outDescriptor, pvrvk::CommandBufferBase cmdBuffer, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Utility function for generating a texture atlas based on a set of images.

Parameters
  • device – The device used to create the texture atlas.

  • inputImages – A list of input images used to generate the texture atlas from.

  • outUVs – A pointer to a set of UVs corresponding to the position of the images within the generated texture atlas.

  • numImages – The number of textures used for generating the texture atlas.

  • inputImageLayout – The current layout of the input images. All input images must be in the layout specified.

  • outImageView – The generated texture atlas returned by the function

  • outDescriptor – The texture header for the generated texture atlas

  • cmdBuffer – A previously constructured command buffer which will be used by the utility function for various operations such as creating images.

  • finalLayout – The final image layout the image will be transitioned to.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

Return true if success

pvr::utils::createAttachmentImages#

Function Documentation#

template<typename ImageContainer>
static inline void pvr::utils::createAttachmentImages(ImageContainer &outImages, const pvrvk::Device &device, int32_t imageCount, pvrvk::Format format, const pvrvk::Extent2D &imageExtent, const pvrvk::ImageUsageFlags &imageUsageFlags, pvrvk::SampleCountFlags sampleCount, const vma::Allocator &imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_DEDICATED_MEMORY_BIT, const std::string &objectName = std::string())#

Helper function to create a collection of images intended to be used as attachments, e.g. Depth/Stencil images, resolve attachments etc.

<tparam name=”ImageContainer”>The type of container that will be returned. Must have an indexing[] function and a resize() function, making std::vector and pvr::multi common candidates</tparam>

Parameters
  • outImages – The container to use for the images. Must support resize() and indexing[]

  • device – The device for which the attachment images will be created

  • imageCount – The swapchain backbuffer image count (double, triple buffering etc).

  • format – The format of the attachments. If creating multisample color attachments, ensure format matches the swapchain image formats.

  • imageExtent – The size of the images. For each framebuffer, ensure imageExtent matches for all attachments.

  • imageUsageFlags – The usage flags for the images.

  • imageAllocator – An optional Vulkan Memory Allocator object that will be used to allocate memory for the images.

  • imageAllocationCreateFlags – The vma allocation flags to pass to VMA when constructing the objects.

  • objectName – The name to use for each created image. An index will be appended to each according to its swapchain index.

pvr::utils::packSamplerFilter#

Function Documentation#

inline PackedSamplerFilter pvr::utils::packSamplerFilter(pvrvk::Filter mini, pvrvk::Filter magni, pvrvk::SamplerMipmapMode mip)#

Created a packed sampler filter.

Parameters
  • mini – The minification filter

  • magni – The magnification filter

  • mip – The sampler mipmap mode

Returns

The packed sampler filter

pvr::utils::insertSorted_overwrite#

Function Documentation#

template<typename container, typename val>
size_t pvr::utils::insertSorted_overwrite(container &cont, typename container::iterator begin, typename container::iterator end, const val &item)#

Insert sorted element, Overwrite if element exist in the container.

Parameters
  • cont – Container to insert the element into.

  • begin – Container range begin

  • end – Container range end

  • item – Item to insert in to the container

pvr::utils::getOpenGLStorageFormat#

Function Documentation#

void pvr::utils::getOpenGLStorageFormat(PixelFormat pixelFormat, ColorSpace colorSpace, VariableType dataType, GLenum &glInternalFormat)#

Retrieves the internal OpenGL ES texture format for a texture with pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType.

Parameters
  • pixelFormat – The pvr::PixelFormat to retrieve a corresponding internal OpenGL ES texture format for.

  • colorSpace – The pvr::ColorSpace to retrieve a corresponding internal OpenGL ES texture format for.

  • dataType – The pvr::VariableTypeto retrieve a corresponding internal OpenGL ES texture format for.

  • glInternalFormat – The internal OpenGL ES format corresponding to the provided pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType

pvr::utils::textureUploadWithResults#

Function Documentation#

inline TextureUploadResults pvr::utils::textureUploadWithResults(const IAssetProvider &app, const char *file, bool isEs2 = false)#

pvr::utils::generateTextureAtlas#

Function Documentation#

inline void pvr::utils::generateTextureAtlas(const IAssetProvider &app, const StringHash *fileNames, Rectanglef *outUVs, uint32_t numTextures, GLuint *outTexture, TextureHeader *outDescriptor, bool isEs2 = false)#

pvr::utils::createOnscreenFramebuffers#

Function Documentation#

template<typename ContainerType>
inline ContainerType pvr::utils::createOnscreenFramebuffers(const pvrvk::Swapchain &swapchain, const pvrvk::RenderPass &renderPass, const pvrvk::ImageView *depthStencilImages, pvrvk::ImageView *colorMultisampledImages, pvrvk::ImageView *depthStencilMultisampledImages)#

<sumary>Creates a collection of Framebuffer objects, the same number of images as the Swapchain images. Will take into consideration properties of the swapchain and the renderpass to infer sizes, formats, multisampling etc., and also ensure all parameters are consistently passed. <tparam name=”ContainerType”> The type of container to create the framebuffers. Must support resize() and indexing [].</tparam>

Parameters
  • swapchain – The swapchain for which framebuffers will be created. The swapchain images will used as Color attachments. If multisampled, they will be used as Color Resolve attachments instead.

  • renderPass – The renderpass for which the framebuffers will be created. Must of course be compatible with the swapchain images.

  • depthStencilImages – If the renderPass requires a depth buffer, MUST contain an array of Images compatible with the RenderPass definition. Will be used as Depth attachments. If multisampled, will be used as Depth Resolve attachments instead.

  • colorMultisampledImages – If the renderPass is multisampled, MUST contain an array of Multisampling Images to be used as Color attachments. Otherwise, MUST be null

  • depthMultisampledImages – If the renderPass is multisampled AND depthStencilImages is not null, MUST contain an array of Multisampling Images to be used as Depth attachments. Otherwise, MUST be null.

Returns

A ContainerType containing the framebuffer objects created.

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(Face face)#

Convert to opengl face.

Parameters

face – A Face enum

Returns

A GLenum representing a face (GL_FRONT, GL_BACK, GL_FRONT_AND_BACK, GL_NONE)

pvr::utils::createMultipleBuffersFromMesh#

Function Documentation#

inline void pvr::utils::createMultipleBuffersFromMesh(const assets::Mesh &mesh, std::vector<GLuint> &outVbos, GLuint &outIbo)#

Auto generates a set of VBOs and a single IBO from all the vertex data of a mesh, respecting the Mesh’s vertex layout configuration: Each Data Element of the mesh will produce another VBO.

This utility function will read all vertex data from the mesh and create one Buffer for each data element (block of interleaved data) in the mesh. It is thus commonly used for for meshes containing multiple sets of interleaved data (for example, a VBO with static and a VBO with streaming data).

Parameters
  • context – The device context where the buffers will be generated on

  • mesh – The mesh whose data will populate the buffers

  • outVbos – Reference to a std::vector of VBO handles where the data will be put. Buffers will be appended at the end.

  • outIbo – The IBO handle where the data will be put. No buffer needs to have been created on the handle. If no face data is present on the mesh, the handle will be null.

pvr::utils::operator|#

Function Documentation#

inline ModelGles::Flags pvr::utils::operator|(ModelGles::Flags lhs, ModelGles::Flags rhs)#

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::CompareOp pvr::utils::convertToPVRVk(::pvr::CompareOp item)#

pvr::utils::checkApiError#

Function Documentation#

int pvr::utils::checkApiError(std::string *errOutStr = NULL)#

Checks and returns api error if appropriate.

Parameters

errOutStr – error std::string to be output.

Returns

api error code

pvr::utils::generateIrradianceMap#

Function Documentation#

Texture pvr::utils::generateIrradianceMap(pvrvk::Queue queue, pvrvk::ImageView environmentMap, pvr::PixelFormat outputPixelFormat, pvr::VariableType outputVariableType, uint32_t mapSize = 64, uint32_t mapNumSamples = 16384)#

Generates a mipmapped diffuse irradiance map.

Parameters
  • queue – A queue to which command buffers containing commands for generating the diffuse irradiance map will be added.

  • environmentMap – The source environment map to use in the generation

  • outputPixelFormat – The format to use for the diffuse irradiance map generated using this function.

  • outputVariableType – The variable type to use for the generated irradiance map generated using this function.

  • mapSize – The size of the map to generate

  • mapNumSamples – The number of samples to use when generating the diffuse irradiance map

Returns

The pvr::Texture generated

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::ColorComponentFlags pvr::utils::convertToPVRVk(::pvr::ColorChannelFlags item)#

pvr::utils::deleteTexturesAndZero#

Function Documentation#

inline void pvr::utils::deleteTexturesAndZero(GLuint &texture)#

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::PrimitiveTopology pvr::utils::convertToPVRVk(::pvr::PrimitiveTopology item)#

pvr::utils::beginCommandBufferDebugLabel#

Function Documentation#

inline void pvr::utils::beginCommandBufferDebugLabel(pvrvk::CommandBuffer &commandBuffer, const pvrvk::DebugUtilsLabel &labelInfo)#

Begins identifying a region of work submitted to this command buffer. The calls to beginDebugUtilsLabel and endDebugUtilsLabel must be matched and balanced.

Parameters
  • commandBuffer – The command buffer to which the debug label region should be opened

  • labelInfo – Specifies the parameters of the label region to open

pvr::utils::loadShader#

Function Documentation#

GLuint pvr::utils::loadShader(const Stream &shaderSource, ShaderType shaderType, const char *const *defines, uint32_t numDefines)#

Load shader from shader source. Will implicitly load on the current context.

Parameters
  • shaderSource – A stream containing the shader source text data

  • shaderType – The type (stage) of the shader (vertex, fragment…)

  • defines – A number of preprocessor definitions that will be passed to the shader

  • numDefines – The number of defines

Returns

The shader object

pvr::utils::textureUploadWithResults#

Function Documentation#

inline TextureUploadResults pvr::utils::textureUploadWithResults(const IAssetProvider &app, const char *file, pvr::Texture &outTexture, bool isEs2 = false)#

pvr::utils::isSupportedDepthStencilFormat#

Function Documentation#

bool pvr::utils::isSupportedDepthStencilFormat(const pvrvk::Device &device, pvrvk::Format format)#

pvr::utils::insertDebugUtilsLabel#

Function Documentation#

inline void pvr::utils::insertDebugUtilsLabel(pvrvk::CommandBuffer &commandBuffer, const pvrvk::DebugUtilsLabel &labelInfo)#

Inserts a single debug label any time.

Parameters
  • commandBuffer – The command buffer to which the debug label should be inserted

  • labelInfo – Specifies the parameters of the label region to insert

pvr::utils::operator|=#

Function Documentation#

inline ModelGles::Flags &pvr::utils::operator|=(ModelGles::Flags &lhs, ModelGles::Flags rhs)#

pvr::utils::mapDebugUtilsMessageSeverityFlagsToLogLevel#

Function Documentation#

inline LogLevel pvr::utils::mapDebugUtilsMessageSeverityFlagsToLogLevel(pvrvk::DebugUtilsMessageSeverityFlagsEXT flags)#

Maps a set of DebugUtilsMessageSeverityFlagsEXT to a particular type of log message.

Parameters

flags – The DebugUtilsMessageSeverityFlagsEXT to map to a LogLevel.

Returns

Returns a LogLevel deemed to correspond to the given pvrvk::DebugUtilsMessageSeverityFlagsEXT.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::PipelineColorBlendAttachmentState pvr::utils::convertToPVRVk(const BlendingConfig &config)#

Convert to pvrvk PipelineColorBlendAttachmentState.

Parameters

config – The pvr::BlendingConfig to convert

Returns

A pvrvk::PipelineColorBlendAttachmentState representing the BlendingConfig

pvr::utils::unpackSamplerFilter#

Function Documentation#

inline void pvr::utils::unpackSamplerFilter(PackedSamplerFilter packed, pvrvk::Filter &mini, pvrvk::Filter &magni, pvrvk::SamplerMipmapMode &mip)#

Unpack a packed sampler filter.

Parameters
  • packed – The packed sampler filter

  • mini – The minification filter

  • magni – The magnification filter

  • mip – The sampler mipmap mode

pvr::utils::uploadImageAndViewSubmit#

Function Documentation#

pvrvk::ImageView pvr::utils::uploadImageAndViewSubmit(pvrvk::Device &device, const Texture &texture, bool allowDecompress, pvrvk::CommandPool &commandPool, pvrvk::Queue &queue, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Uploads an image to GPU memory and returns the created image view and associated image.

Parameters
  • device – The device to use to create the image and image view.

  • texture – The source pvr::Texture object from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandPool – A command pool from which to allocate a temporary command buffer to carry out the upload operations.

  • queue – A queue to which the upload operations should be submitted to.

  • usageFlags – A set of image usage flags for which the created image can be used for.

  • finalLayout – The final image layout the image will be transitioned to.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The result of the image upload will be a created image view with its associated pvrvk::Image.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::ImageViewType pvr::utils::convertToPVRVk(ImageViewType texDimemsion)#

Convert to pvrvk image view type.

Parameters

texDimemsion – Texture dimension

Returns

A pvrvk::ImageViewType (pvrvk::ImageViewType::e_1D, pvrvk::ImageViewType::e_2D etc)

pvr::utils::updateBufferUsingStagingBuffer#

Function Documentation#

inline void pvr::utils::updateBufferUsingStagingBuffer(pvrvk::Device &device, pvrvk::Buffer &buffer, pvrvk::CommandBufferBase uploadCmdBuffer, const void *data, VkDeviceSize offset = 0, VkDeviceSize size = VK_WHOLE_SIZE, vma::Allocator stagingBufferAllocator = nullptr)#

Utility function to update a buffer’s data via an indirect copy from a temporary staging buffer. Updating memory via the use of a staging buffer is necessary when using memory without e_HOST_VISIBLE_BIT memory property flags meaning the buffer itself cannot be mapped to host memory.

Parameters
  • device – The device used to create the staging buffer

  • buffer – The destination buffer.

  • uploadCmdBuffer – A command buffer into which commands will be recorded for carrying out the buffer copy

  • data – The data to use in the update

  • offset – The offset to use for the map -> update -> unmap

  • size – The size of the data to be updated

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

pvr::utils::uploadImageAndView#

Function Documentation#

pvrvk::ImageView pvr::utils::uploadImageAndView(pvrvk::Device &device, const Texture &texture, bool allowDecompress, pvrvk::CommandBuffer &commandBuffer, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • texture – The source pvr::Texture object from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • usageFlags – A command buffer to add the pipelineBarrier for the image transition.

  • finalLayout – The final image layout the image will be transitioned to.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The image object.

pvr::utils::convertToPVRVkNumSamples#

Function Documentation#

inline pvrvk::SampleCountFlags pvr::utils::convertToPVRVkNumSamples(uint8_t numSamples)#

Convert to pvrvk sample count.

Parameters

numSamples – Number of samples

Returns

A pvrvk::SampleCountFlags (pvrvk::SampleCountFlags::e_1_BIT, pvrvk::SampleCountFlags::e_2_BIT, etc)

pvr::utils::create3dPlaneMesh#

Function Documentation#

inline void pvr::utils::create3dPlaneMesh(uint32_t width, uint32_t depth, bool generateTexCoords, bool generateNormalCoords, assets::Mesh &outMesh)#

Creates a 3d plane mesh based on the width and depth specified. Texture coordinates and normal coordinates can also optionally be generated based on the generateTexCoords and generateNormalCoords flags respectively. The generated mesh will be returned as a pvr::assets::Mesh.

Parameters
  • width – The width of the plane to generate.

  • depth – The depth of the plane to generate.

  • generateTexCoords – Specifies whether to generate texture coordinates for the plane.

  • generateNormalCoords – Specifies whether to generate normal coordinates for the plane.

  • outMesh – The generated pvr::assets::Mesh.

pvr::utils::getOpenGLFormat#

Function Documentation#

void pvr::utils::getOpenGLFormat(PixelFormat pixelFormat, ColorSpace colorSpace, VariableType dataType, uint32_t &glInternalFormat, uint32_t &glFormat, uint32_t &glType, uint32_t &glTypeSize, bool &isCompressedFormat)#

Retrieves the OpenGL ES texture formats for a texture with pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType.

Parameters
  • pixelFormat – The pvr::PixelFormat to retrieve a corresponding set of OpenGL ES texture formats for.

  • colorSpace – The pvr::ColorSpace to retrieve a corresponding set of OpenGL ES texture formats for.

  • dataType – The pvr::VariableTypeto retrieve a corresponding set of OpenGL ES texture formats for.

  • glInternalFormat – The internal OpenGL ES format corresponding to the provided pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType.

  • glFormat – The OpenGL ES format corresponding to the provided pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType.

  • glType – The OpenGL ES type corresponding to the provided pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType.

  • glTypeSize – The OpenGL ES type size corresponding to the provided pvr::PixelFormat pixelFormat, pvr::ColorSpace colorSpace and pvr::VariableType dataType.

  • isCompressedFormat – Specifies whether the OpenGL ES format retrieved is a compressed format.

pvr::utils::getSupportedDepthStencilFormat#

Function Documentation#

pvrvk::Format pvr::utils::getSupportedDepthStencilFormat(const pvrvk::Device &device, pvr::DisplayAttributes &displayAttributes, std::vector<pvrvk::Format> preferredDepthFormats = {})#

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(DataType dataType)#

Convert to opengl data type.

Parameters

dataType – A DataType enum

Returns

A GLenum representing a DataType (GL_FLOAT, GL_UNSIGNED_BYTE etc)

pvr::utils::loadAndUploadImageAndView#

Function Documentation#

pvrvk::ImageView pvr::utils::loadAndUploadImageAndView(pvrvk::Device &device, const char *fileName, bool allowDecompress, pvrvk::CommandBuffer &commandBuffer, IAssetProvider &assetProvider, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, Texture *outAssetTexture = nullptr, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE, const void *pNext = nullptr)#

Load and upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • fileName – The filename of a source texture from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • assetProvider – Specifies an asset provider to use for loading the texture from system memory.

  • usageFlags – Specifies the usage flags for the image being created.

  • finalLayout – The final image layout the image will be transitioned to.

  • outAssetTexture – A pointer to a created pvr::texture.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The Image Object uploaded.

pvr::utils::textureUpload#

Function Documentation#

inline GLuint pvr::utils::textureUpload(const IAssetProvider &app, const char *file, bool isEs2 = false)#

pvr::utils::createOnscreenFramebufferAndRenderPass#

Function Documentation#

inline pvrvk::RenderPass pvr::utils::createOnscreenFramebufferAndRenderPass(const pvrvk::Swapchain &swapchain, pvrvk::ImageView *depthStencilImages, Multi<pvrvk::Framebuffer> &outFramebuffers, pvrvk::ImageLayout initialSwapchainLayout = pvrvk::ImageLayout::e_UNDEFINED, pvrvk::ImageLayout initialDepthStencilLayout = pvrvk::ImageLayout::e_UNDEFINED, pvrvk::AttachmentLoadOp colorLoadOp = pvrvk::AttachmentLoadOp::e_CLEAR, pvrvk::AttachmentStoreOp colorStoreOp = pvrvk::AttachmentStoreOp::e_STORE, pvrvk::AttachmentLoadOp depthStencilLoadOp = pvrvk::AttachmentLoadOp::e_CLEAR, pvrvk::AttachmentStoreOp depthStencilStoreOp = pvrvk::AttachmentStoreOp::e_DONT_CARE)#

DEPRECATED.

Parameters
  • outFramebuffers – DEPRECATED

  • swapchain – DEPRECATED

  • depthStencilImages – DEPRECATED

  • outRenderPass – DEPRECATED

  • initialSwapchainLayout – DEPRECATED

  • initialDepthStencilLayout – DEPRECATED

  • colorLoadOp – DEPRECATED

  • colorStoreOp – DEPRECATED

  • depthStencilLoadOp – DEPRECATED

  • depthStencilStoreOp – DEPRECATED

pvr::utils::createInstance#

Function Documentation#

pvrvk::Instance pvr::utils::createInstance(const std::string &applicationName, VulkanVersion apiVersion = VulkanVersion(), const InstanceExtensions &instanceExtensions = InstanceExtensions(), const InstanceLayers &instanceLayers = InstanceLayers(), const pvrvk::DebugUtilsMessageSeverityFlagsEXT InstanceValidationFlags = pvrvk::DebugUtilsMessageSeverityFlagsEXT::e_WARNING_BIT_EXT | pvrvk::DebugUtilsMessageSeverityFlagsEXT::e_ERROR_BIT_EXT)#

Utility function for creating a Vulkan instance and supported physical devices using the appropriately set parameters.

Parameters
  • applicationName – Used for setting the pApplicationName of the pvrvk::ApplicationInfo structure used when calling vkCreateInstance.

  • apiVersion – A VulkanVersion structure used for setting the apiVersion of the pvrvk::ApplicationInfo structure used when creating the Vulkan instance.

  • instanceExtensions – An InstanceExtensions structure which holds a list of instance extensions which will be checked for compatibility with the current Vulkan implementation before setting as the ppEnabledExtensionNames member of the pvrvk::InstanceCreateInfo used when creating the Vulkan instance.

  • instanceLayers – An InstanceLayers structure which holds a list of instance layers which will be checked for compatibility with the current Vulkan implementation before setting as the ppEnabledLayerNames member of the pvrvk::InstanceCreateInfo used when creating the Vulkan instance.

  • InstanceValidationFlags – The flags required for the debug callback to log a message during instance creation and destruction

Returns

A pointer to the created Instance.

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::DataType pvr::utils::convertToPVRVk(DataType dataType)#

Convert to pvrvk Data type.

Parameters

dataType – The pvr::DataType to convert to Vulkan type

Returns

A pvrvk::DataType

pvr::utils::textureUpload#

Function Documentation#

TextureUploadResults pvr::utils::textureUpload(const Texture &texture, bool isEs2, bool allowDecompress)#

Upload a texture to the GPU on the current context, and return it as part of the TextureUploadResults structure.

Parameters
  • texture – The pvr::Texture to upload to the GPU

  • isEs2 – Signifies whether the current context being used for the texture upload is ES2 only. If the context is ES2 only then the texture upload should not use ES3+ functionality as it will be unsupported via this context.

  • allowDecompress – Set to true to allow to attempt to de-compress unsupported compressed textures. The textures will be decompressed if ALL of the following are true: The texture is in a compressed format that can be decompressed by the framework (PVRTC), the platform does NOT support this format (if it is hardware supported, it will never be decompressed), and this flag is set to true. Default:true.

Returns

A TextureUploadResults object containing the uploaded texture and all necessary information (size, formats, whether it was actually decompressed. The “result” field will contain Result::Success on success, errorcode otherwise. See the Texture

pvr::utils::endCommandBufferDebugLabel#

Function Documentation#

inline void pvr::utils::endCommandBufferDebugLabel(pvrvk::SecondaryCommandBuffer &secondaryCommandBuffer)#

Ends a label region of work submitted to this secondary command buffer.

Parameters

secondaryCommandBuffer – The secondary command buffer to which the debug label region should be ended

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::VertexInputRate pvr::utils::convertToPVRVk(StepRate stepRate)#

Convert to pvrvk vertex input rate.

Parameters

stepRate – The step rate of the vertex input(Vertex, Instance)

Returns

A pvrvk::VertexInputRate (pvrvk::VertexInputRate::e_VERTEX, pvrvk::VertexInputRate::e_INSTANCE)

pvr::utils::populateInputAssemblyFromMesh#

Function Documentation#

inline void pvr::utils::populateInputAssemblyFromMesh(const assets::Mesh &mesh, const VertexBindings *bindingMap, uint16_t numBindings, pvrvk::PipelineVertexInputStateCreateInfo &vertexCreateInfo, pvrvk::PipelineInputAssemblerStateCreateInfo &inputAssemblerCreateInfo, uint16_t *numOutBuffers = nullptr)#

Fills out input assembly and vertex input state structures using a mesh and a list of corresponding VertexBindings.

Parameters
  • mesh – A mesh from which to retrieve vertex attributes, vertex buffer strides and primitive topology information from.

  • bindingMap – A pointer to an array of VertexBindings structures which specify the semantic names and binding indices of any vertex attributes to retrieve.

  • numBindings – Specifies the number of VertexBindings structures in the array pointed to by bindingMap.

  • vertexCreateInfo – A pvrvk::PipelineVertexInputStateCreateInfo structure which will be filled by this utility function.

  • inputAssemblerCreateInfo – A pvrvk::InputAssemblerStateCreateInfo structure which will be filled by this utility function.

  • numOutBuffers – A pointer to an unsigned integer which will set to specify the number of buffers required to create buffers for to use the mesh vertex attributes.

pvr::utils::insertSorted#

Function Documentation#

template<typename container, typename val, typename cmp>
size_t pvr::utils::insertSorted(container &cont, typename container::iterator begin, typename container::iterator end, const val &item, const cmp &compare)#

Insert sorted element in to the container.

Parameters
  • cont – Container to insert the element into.

  • begin – Container range begin

  • end – Container range end

  • item – Item to insert in to the container

  • compare – Comparison operator used for sorting

pvr::utils::insertDebugUtilsLabel#

Function Documentation#

inline void pvr::utils::insertDebugUtilsLabel(pvrvk::CommandBufferBase commandBufferBase, const pvrvk::DebugUtilsLabel &labelInfo)#

Inserts a single debug label any time.

Parameters
  • commandBufferBase – The base command buffer to which the debug label should be inserted

  • labelInfo – Specifies the parameters of the label region to insert

pvr::utils::loadAndUploadImage#

Function Documentation#

pvrvk::Image pvr::utils::loadAndUploadImage(pvrvk::Device &device, const std::string &fileName, bool allowDecompress, pvrvk::CommandBuffer &commandBuffer, IAssetProvider &assetProvider, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, Texture *outAssetTexture = nullptr, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Load and upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image and image view.

  • fileName – The filename of a source texture from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • assetProvider – Specifies an asset provider to use for loading the texture from system memory.

  • usageFlags – Specifies the usage flags for the image being created.

  • finalLayout – The final image layout the image will be transitioned to.

  • outAssetTexture – A pointer to a created pvr::texture.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The Image Object uploaded.

pvr::utils::createImage#

Function Documentation#

pvrvk::Image pvr::utils::createImage(const pvrvk::Device &device, const pvrvk::ImageCreateInfo &createInfo, pvrvk::MemoryPropertyFlags requiredMemoryFlags = pvrvk::MemoryPropertyFlags::e_DEVICE_LOCAL_BIT, pvrvk::MemoryPropertyFlags optimalMemoryFlags = pvrvk::MemoryPropertyFlags::e_NONE, const vma::Allocator &imageAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

create a new Image(sparse or with memory backing, depending on flags . The user should not call bindMemory on the image if sparse flags are used. requiredMemoryFlags is ignored if flags contains sparse binding flags.

Parameters
  • device – The device on which to create the image

  • createInfo – A pvrvk::ImageCreateInfo structure controlling how the image will be created.

  • requiredMemoryFlags – The minimal set of memory property flags which are required for the PVRVk Image to be created. If pvrvk::MemoryPropertyFlags::e_NONE is passed, no memory will be allocated for this Image.

  • optimalMemoryFlags – The most optimal set of memory property flags which could be used by the memory backing the returned PVRVk Image. If pvrvk::MemoryPropertyFlags::e_NONE is passed optimalMemoryFlags will be set to match requiredMemoryFlags.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

Returns

The created Imageobject on success, null Image on failure

pvr::utils::imageUploadAsyncWorker#

Function Documentation#

inline void pvr::utils::imageUploadAsyncWorker(ImageUploadFuture uploadFuture)#

Provides a mechanism for kicking an asynchronous image upload worker.

Parameters

uploadFuture – An image upload future to be uploaded on a separate thread.

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::StencilOp pvr::utils::convertToPVRVk(::pvr::StencilOp item)#

pvr::utils::convertToPVRVk#

Function Documentation#

inline ::pvrvk::BufferUsageFlags pvr::utils::convertToPVRVk(::pvr::BufferUsageFlags item)#

pvr::utils::mapDebugReportFlagsToLogLevel#

Function Documentation#

inline LogLevel pvr::utils::mapDebugReportFlagsToLogLevel(pvrvk::DebugReportFlagsEXT flags)#

Maps a set of DebugReportFlagsEXT to a particular type of log message.

Parameters

flags – The DebugReportFlagsEXT to map to a LogLevel.

Returns

Returns a LogLevel deemed to correspond to the given pvrvk::DebugReportFlagsEXT.

pvr::utils::saveImage#

Function Documentation#

void pvr::utils::saveImage(pvrvk::Queue &queue, pvrvk::CommandPool &commandPool, pvrvk::Image &image, const pvrvk::ImageLayout imageInitialLayout, const pvrvk::ImageLayout imageFinalLayout, const std::string &filename, vma::Allocator bufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, const uint32_t screenshotScale = 1)#

Saves the input image as a TGA file with the filename specified. Note that the image must have been created with the pvrvk::ImageUsageFlags::e_TRANSFER_SRC_BIT set.

Parameters
  • queue – A queue to submit the generated command buffer to. This queue must be compatible with the command pool provided.

  • commandPool – A command pool from which to allocate a temporary command buffer to carry out the transfer operations.

  • image – The image to save as a TGA file.

  • imageInitialLayout – The initial layout of the image from which a transition will be made to pvrvk::ImageLayout::e_TRANSFER_SRC_OPTIMAL.

  • imageFinalLayout – The final layout of the image to which a transition will be made.

  • filename – The filename to use for the saved TGA image.

  • bufferAllocator – A VMA allocator used to allocate memory for the created the buffer used as the target of an imageToBufferCopy.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • screenshotScale – A scaling factor to use for increasing the size of the saved screenshot.

pvr::utils::createSingleBuffersFromModel#

Function Documentation#

template<typename VboInsertIterator_, typename IboInsertIterator_>
inline void pvr::utils::createSingleBuffersFromModel(const assets::Model &model, VboInsertIterator_ vbos, IboInsertIterator_ ibos)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of the meshes of a model and inserts them into containers provided by the user using std::inserters.

This utility function will read all vertex data from the VBO. It is usually preferred for meshes meshes containing a single set of interleaved data. If multiple data elements (i.e. sets of interleaved data), each block will be successively placed after the other. The std::inserter this function requires can be created from any container with an insert() function with (for example, for insertion at the end of a vector) std::inserter(std::vector, std::vector::end()) .

Parameters
  • context – The device context where the buffers will be generated on

  • model – The model whose meshes will be used to generate the Buffers

  • vbos – An insert iterator to a std::Buffer container for the VBOs. Vbos will be inserted using this iterator.

  • ibos – An insert iterator to an std::Buffer container for the IBOs. Ibos will be inserted using this iterator.

pvr::utils::createSingleBuffersFromMesh#

Function Documentation#

inline void pvr::utils::createSingleBuffersFromMesh(pvrvk::Device &device, const assets::Mesh &mesh, pvrvk::Buffer &outVbo, pvrvk::Buffer &outIbo, pvrvk::CommandBuffer &uploadCmdBuffer, bool &requiresCommandBufferSubmission, vma::Allocator bufferAllocator = nullptr, vma::AllocationCreateFlags vmaAllocationCreateFlags = vma::AllocationCreateFlags::e_MAPPED_BIT)#

Auto generates a single VBO and a single IBO from all the vertex data of a mesh.

This utility function will read all vertex data from a mesh’s data elements and create a single VBO. It is commonly used for a single set of interleaved data. If data are not interleaved, they will be packed on the same VBO, each interleaved block (Data element on the mesh) will be appended at the end of the buffer, and the offsets will need to be calculated by the user when binding the buffer.

Parameters
  • device – The device where the buffers will be generated on

  • mesh – The mesh whose data will populate the buffers

  • outVbo – The VBO handle where the data will be put.

  • outIbo – The IBO handle where the data will be put. If no face data is present on the mesh, the handle will be null.

  • uploadCmdBuffer – A command buffer into which commands may be recorded for uploading mesh data to the created buffers. This command buffer will only be used when memory without e_HOST_VISIBLE_BIT memory property flags was allocated for the vbos or ibos.

  • requiresCommandBufferSubmission – Indicates whether commands have been recorded into the given command buffer.

  • bufferAllocator – A VMA allocator used to allocate memory for the created buffer.

  • vmaAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively. The default vma::AllocationCreateFlags::e_MAPPED_BIT is valid even if HOST_VISIBLE is not used - these flags will be ignored in this case.

pvr::utils::textureUpload#

Function Documentation#

inline GLuint pvr::utils::textureUpload(const IAssetProvider &app, const std::string &file, bool isEs2 = false)#

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(StencilOp stencilOp)#

Convert to opengl stencil op output.

Parameters

stencilOp – A StencilOp enum

Returns

A GLenum representing a Stencil Operation (GL_INC_WRAP, GL_ZERO etc)

pvr::utils::formatWithTilingSupportsFeatureFlags#

Function Documentation#

bool pvr::utils::formatWithTilingSupportsFeatureFlags(pvrvk::Format imageFormat, pvrvk::ImageTiling imageTiling, pvrvk::FormatFeatureFlags formatFeatureFlags, const pvrvk::Instance instance, pvrvk::PhysicalDevice physicalDevice)#

Analyse if the image format provided with the image tiling option provided supports the format features provided as parameter.

Parameters
  • imageFormat – Image format to analyse.

  • imageTiling – Image tiling option to use when querying the format feature flags to query, currently implemented for tiling linear and tiling optimal options.

  • formatFeatureFlags – Format feature flags to query for the provided format and image tiling option.

  • instance – Vulkan instance.

  • physicalDevice – Physical device used for the test.

Returns

True if the image format given covers the requirements, false otherwise.

pvr::utils::generateIrradianceMap#

Function Documentation#

void pvr::utils::generateIrradianceMap(GLuint environmentMap, pvr::Texture &outTexture, GLuint &outTextureGles, uint32_t mapSize = 64, uint32_t mapNumSamples = 128)#

Generates a mipmapped diffuse irradiance map.

Parameters
  • environmentMap – The OpenGL ES texture to use as the source for the diffuse irradiance map.

  • outTexture – a pvr::Texture to use for the output diffuse irradiance map.

  • outTextureGles – An OpenGL ES texture to use as the output for the diffuse irradiance map.

  • mapSize – The size of the prefiltered environment map

  • mapNumSamples – The number of samples to use when generating the diffuse irradiance map

pvr::utils::createSingleBuffersFromMeshes#

Function Documentation#

template<typename MeshIterator_, typename VboContainer_, typename IboContainer_>
inline void pvr::utils::createSingleBuffersFromMeshes(MeshIterator_ meshIter, MeshIterator_ meshIterEnd, VboContainer_ &outVbos, typename VboContainer_::iterator vbos_where, IboContainer_ &outIbos, typename IboContainer_::iterator ibos_where)#

Auto generates a set of VBOs and a set of IBOs from the vertex data of multiple meshes and insert them at the specified spot in a user-provided container.

This utility function will read all vertex data from a mesh’s data elements and create a single VBO. It is commonly used for a single set of interleaved data (mesh.getNumDataElements() == 1). If more data elements are present (i.e. more than a single interleaved data element) , they will be packed in the sameVBO, with each interleaved block (Data element ) appended at the end of the buffer. It is then the user’s responsibility to use the buffer correctly with the API (for example use bindbufferbase and similar) with the correct offsets.

Parameters
  • context – The device context where the buffers will be generated on

  • meshIter – Iterator for a collection of meshes.

  • meshIterEnd – End Iterator for meshIter.

  • outVbos – Collection of api::Buffer handles. It will be used to insert one VBO per mesh.

  • outIbos – Collection of api::Buffer handles. It will be used to insert one IBO per mesh. If face data is not present on the mesh, a null handle will be inserted.

  • vbos_where – Iterator on outVbos - the position where the insertion will happen.

  • ibos_where – Iterator on outIbos - the position where the insertion will happen.

pvr::utils::insertSorted_overwrite#

Function Documentation#

template<typename container, typename val, typename cmp>
size_t pvr::utils::insertSorted_overwrite(container &cont, const val &item, const cmp &compare)#

Insert sorted element, Overwrite if element exist in the container.

Parameters
  • cont – Container to insert the element into.

  • item – Item to insert in to the container

  • compare – Comparison operator used for sorting

pvr::utils::insertSorted_overwrite#

Function Documentation#

template<typename container, typename val, typename cmp>
size_t pvr::utils::insertSorted_overwrite(container &cont, typename container::iterator begin, typename container::iterator end, const val &item, const cmp &compare)#

Insert sorted element, Overwrite if element exist in the container.

Parameters
  • cont – Container to insert the element into.

  • begin – Container range begin

  • end – Container range end

  • item – Item to insert in to the container

  • compare – Comparison operator used for sorting

pvr::utils::convertToPVRVk#

Function Documentation#

inline pvrvk::StencilOpState pvr::utils::convertToPVRVk(const StencilState &op)#

Convert to pvrvk StencilOpState.

Parameters

op – The pvr::StencilState to convert

Returns

A pvrvk::StencilOpState representing the StencilState

pvr::utils::createInputAssemblyFromMesh#

Function Documentation#

inline VertexConfiguration pvr::utils::createInputAssemblyFromMesh(const assets::Mesh &mesh, const VertexBindings *bindingMap, uint16_t numBindings, uint16_t *outNumBuffers = NULL)#

pvr::utils::generatePreFilteredMapMipMapStyle#

Function Documentation#

void pvr::utils::generatePreFilteredMapMipMapStyle(GLuint environmentMap, pvr::Texture &outTexture, GLuint &outTextureGles, uint32_t mapSize, bool zeroRoughnessIsExternal, int numMipLevelsToDiscard, uint32_t mapNumSamples = 65536)#

Generate specular irradiance map. Each level of the specular mip map gets blurred corresponding to a roughness value from 0 to 1.0.

Parameters
  • environmentMap – The OpenGL ES texture to use as the source for the prefiltered environment map.

  • outTexture – a pvr::Texture to use for the output prefiltered environment map.

  • outTextureGles – An OpenGL ES texture to use as the output for the prefiltered environment map.

  • mapSize – The size of the prefiltered environment map

  • zeroRoughnessIsExternal – Denotes that the source environment map itself will be used for the prefiltered environment map mip map level corresponding to a roughness of 0.

  • numMipLevelsToDiscard – Denotes the number of mip map levels to discard from the bottom of the chain. Generally using the last n mip maps may introduce artifacts.

  • mapNumSamples – The number of samples to use when generating the prefiltered environment map

pvr::utils::throwOnGlError#

Function Documentation#

void pvr::utils::throwOnGlError(const char *note)#

Checks and logs api errors if appropriate.

Parameters

note – A c-style std::string that will be prepended to the error description if an error is found.

pvr::utils::convertToGles#

Function Documentation#

GLenum pvr::utils::convertToGles(BlendOp blendOp)#

Convert to opengl blend op output.

Parameters

blendOp – A BlendOp enum

Returns

A GLenum representing a Blend Operation (GL_FUNC_ADD, GL_MIN etc)

pvr::utils::uploadImage#

Function Documentation#

pvrvk::Image pvr::utils::uploadImage(pvrvk::Device &device, const Texture &texture, bool allowDecompress, pvrvk::CommandBuffer &commandBuffer, pvrvk::ImageUsageFlags usageFlags = pvrvk::ImageUsageFlags::e_SAMPLED_BIT, pvrvk::ImageLayout finalLayout = pvrvk::ImageLayout::e_SHADER_READ_ONLY_OPTIMAL, vma::Allocator stagingBufferAllocator = nullptr, vma::Allocator imageAllocator = nullptr, vma::AllocationCreateFlags imageAllocationCreateFlags = vma::AllocationCreateFlags::e_NONE)#

Upload image to gpu. The upload command and staging buffers are recorded in the commandbuffer.

Parameters
  • device – The device to use to create the image.

  • texture – The source pvr::Texture object from which to take the texture data.

  • allowDecompress – Specifies whether the texture can be decompressed as part of the image upload.

  • commandBuffer – A command buffer to which the upload operations should be added. Note that the upload will not be guranteed to be complete until the command buffer is submitted to a queue with appropriate synchronisation.

  • usageFlags – A command buffer to add the pipelineBarrier for the image transition.

  • finalLayout – The final image layout the image will be transitioned to.

  • stagingBufferAllocator – A VMA allocator used to allocate memory for the created staging buffer.

  • imageAllocator – A VMA allocator used to allocate memory for the created image.

  • imageAllocationCreateFlags – VMA Allocation creation flags. These flags can be used to control how and where the memory is allocated from. Valid flags include e_DEDICATED_MEMORY_BIT and e_MAPPED_BIT. e_DEDICATED_MEMORY_BIT indicates that the allocation should have its own memory block. e_MAPPED_BIT indicates memory will be persistently mapped respectively.

Returns

The image object.

pvr::utils::details::assignAttachmentIndexes#

Function Documentation#

inline void pvr::utils::details::assignAttachmentIndexes(bool hasDepth, bool isMultisampled, int &outColorIdx, int &outDepthIdx, int &outColorResolveIdx, int &outDepthResolveIdx)#

pvr::utils::vma::createAllocator#

Function Documentation#

Allocator pvr::utils::vma::createAllocator(const AllocatorCreateInfo &createInfo)#

Creates a device memory allocator.

Parameters

createInfo – Specifies how the created device memory allocator will function

Returns

The created device memory allocator.

clutils::convertChannelContent#

Function Documentation#

inline cl_channel_type clutils::convertChannelContent(int bits0, int bits1, int bits2, int bits3, pvr::VariableType type)#

clutils::convertChannelOrder#

Function Documentation#

inline cl_channel_order clutils::convertChannelOrder(char ch0, char ch1, char ch2, char ch3)#

clutils::isExtensionSupported#

Function Documentation#

inline bool clutils::isExtensionSupported(cl_platform_id platform, const char *extension)#

Determines whether the given OpenCL extension is supported.

Parameters
  • platform – The OpenCL platform.

  • extension – The OpenCL extension to check support for.

Returns

True if the given OpenCL extension is supported.

clutils::throwOnFailure#

Function Documentation#

inline void clutils::throwOnFailure(cl_int err, const std::string &str)#

clutils::throwOnFailure#

Function Documentation#

inline void clutils::throwOnFailure(cl_int err)#

clutils::loadKernelProgram#

Function Documentation#

cl_program clutils::loadKernelProgram(const cl_context &ctx, const cl_device_id &device, const pvr::Stream &kernelSource, const char *compilerOptions = 0, const char *const *defines = 0, uint32_t defineCount = 0)#

Loads a kernel program.

Parameters
  • ctx – The OpenCL context.

  • device – The OpenCL device

  • kernelSource – The kernel source code

  • compilerOptions – A set of compiler option to use

  • defines – A list of defineCount defines to use in the shader

  • defineCount – The number of defines to use in the shader

Returns

The created kernel program

clutils::convertToOpenCLFormat#

Function Documentation#

inline cl_image_format clutils::convertToOpenCLFormat(const pvr::PixelFormat &format, pvr::VariableType variableType, pvr::ColorSpace colorSpace)#

clutils::createOpenCLContext#

Function Documentation#

inline void clutils::createOpenCLContext(cl_platform_id &outPlatform, cl_device_id &outDevice, cl_context &outContext, cl_command_queue &outQueue, cl_command_queue_properties queue_properties = 0, cl_device_type device_type = CL_DEVICE_TYPE_ALL, const char *const platformName = NULL, cl_int *err = 0)#

Creates an OpenCL context.

Parameters
  • outPlatform – The OpenCL platform to be created.

  • outDevice – The OpenCL device to be created.

  • outContext – The OpenCL context to be created.

  • outQueue – The OpenCL queue to be created.

  • queue_properties – The OpenCL queue properties

  • device_type – The OpenCL device type.

  • platformName – The OpenCL platform name to use.

  • err – The OpenCL error.

clutils::getOpenCLError#

Function Documentation#

inline const char *clutils::getOpenCLError(cl_int error)#

Get a string representation of an OpenCL error code.

Parameters
  • error – The OpenCL error code

  • error – The OpenCL error code

Returns

The string representation of the OpenCL error code.