PVRUtils Classes#

OpenCLError#

Inheritance Relationships#

Base Type#

  • public pvr::PvrError

Class Documentation#

class OpenCLError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when receiving OpenCL errors.

Public Functions

inline OpenCLError(cl_int errorCode)#

Constructor.

Parameters:

errorCode – The OpenCL error code to stringify.

inline OpenCLError(cl_int errorCode, const std::string &message)#

Constructor.

Parameters:
  • errorCode – The OpenCL error code to stringify.

  • message – A message to log alongside the OpenCL error.

OpenCLFormatConversionError#

Inheritance Relationships#

Base Type#

  • public std::runtime_error

Class Documentation#

class OpenCLFormatConversionError : public std::runtime_error#

Public Functions

inline OpenCLFormatConversionError(const pvr::PixelFormat &fmt, const std::string &message)#
inline OpenCLFormatConversionError(const pvr::PixelFormat &fmt, const pvr::VariableType type, const pvr::ColorSpace colorspace, const std::string &message)#
inline OpenCLFormatConversionError(const pvr::ImageDataFormat &fmt, const std::string &message)#

EglContext_#

Class Documentation#

class EglContext_#

The EglContext context is the class wrapping all platform-specific objects required to power an OpenGL implementation (Displays, windows, configurations etc.).

Public Functions

inline EglContext_()#
inline virtual ~EglContext_()#
void release()#

Release this object.

Api getMaxApiVersion()#

Get maximum api version supported.

Returns:

The maximum api version supported

bool isApiSupported(Api api)#

Return true if the specified api is supported.

Parameters:

api – The api to check for support

Returns:

True if supported, otherwse false

void swapBuffers()#

Present back buffer.

void makeCurrent()#

Make this platform context current. In non-binding contexts(e.g. vulkan) does nothing.

inline const NativePlatformHandles_ &getNativePlatformHandles() const#

Get native platform handles (const)

Returns:

A platform/api specific object containing the platform handles (surface, window etc.)

inline NativePlatformHandles_ &getNativePlatformHandles()#

Get native platform handles (const)

Returns:

A platform/api specific object containing the platform handles (context, queues, fences/semaphores etc.)

std::string getInfo()#

Get information on this object.

Returns:

Information on this object, typically device name etc.

inline bool isInitialized() const#

Return true if this object is initialized.

Returns:

true if this object is initialized

Api getApiVersion()#

Getter for the Api version of the EGL platform context created.

Returns:

Returns the pvr::Api version of the EGL platform context created.

void init(OSWindow window, OSDisplay display, DisplayAttributes &attributes, Api minVersion = Api::Unspecified, Api maxVersion = Api::Unspecified)#

Initialize the EglPlatform Context object.

Parameters:
  • window – The window specifies an EGLNativeWindowType which is used to create the windowing surface used by the EGL platform context

  • display – The display specifies an EGLDisplay which is used to create the windowing surface used by the EGL platform context

  • attributes – The DisplayAttributes structure specifies the configuration with which to use when initialising the EGL platform context

  • minVersion – The minimum version of EGL platform context which must be supported for initialisation to be successful

  • maxVersion – The maximum version of EGL platform context which must be initialised

Returns:

Returns ‘true’ on success ‘false’ in all other cases.

uint32_t getOnScreenFbo()#

Getter for the on screen frame buffer object. The default or on screen frame buffer is not guaranteed to be zero on all platforms.

Returns:

Returns the OpenGL ES handle for the on screen frame buffer object.

std::unique_ptr<EglContext_> createSharedContextFromEGLContext()#

Creates an instance of a shared platform context.

Returns:

A unique pointer to a EglContext_ instance.

Font_#

Nested Relationships#

Nested Types#

Class Documentation#

class Font_#

Use this class through the reference counted Framework Object pvr::ui::Font. Is an Image_ containing font characters along with the metadata necessary for rendering text with them. Although it can be used like an Image_, this does not make some sense since it would just display the characters as a texture atlas. Text objects will contain a reference to a Font to render with.

Public Types

enum [anonymous]#

Enumeration values useful for text rendering. PVRTexTool uses these values when creating fonts.

Values:

enumerator InvalidChar#
enumerator FontHeader#
enumerator FontCharList#
enumerator FontRects#
enumerator FontMetrics#
enumerator FontYoffset#
enumerator FontKerning#
enumerator MaxRenderableLetters#
enumerator FontElement#
enum [anonymous]#

Enumeration values useful for text rendering. PVRTexTool uses these values when creating fonts.

Values:

enumerator InvalidChar#
enumerator FontHeader#
enumerator FontCharList#
enumerator FontRects#
enumerator FontMetrics#
enumerator FontYoffset#
enumerator FontKerning#
enumerator MaxRenderableLetters#
enumerator FontElement#

Public Functions

void loadFontData(const Texture &texture)#

Load the font data from the font texture.

Parameters:

texture – The pvr::Texture texture to load font data from.

uint32_t findCharacter(uint32_t character) const#

Find the index of a character inside the internal font character list. Only useful for custom font use.

Parameters:

character – The value of a character. Accepts ASCII through to UTF32 characters.

Returns:

The index of the character inside the internal font list.

void applyKerning(uint32_t charA, uint32_t charB, float &offset)#

Apply kerning to two characters (give the offset required by the specific pair).

Parameters:
  • charA – The first (left) character of the pair.

  • charB – The second (right) character of the pair.

  • offset – Output parameter, the offset that must be applied to the second character due to kerning.

inline const CharMetrics &getCharMetrics(uint32_t index) const#

Get the character metrix of this font.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

A CharMetrics object representing the character metrics of the character with that index.

inline const CharacterUV &getCharacterUV(uint32_t index) const#

Get the UVs of the characters of this font.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

A CharMetrics object representing the character metrics of the character with that index.

inline const Rectanglei &getRectangle(uint32_t index) const#

Get the rectangle for a specific character.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

The rectangle where this character exists in the font texture.

inline int16_t getFontLineSpacing() const#

Get the spacing between baseline to baseline of this font, in pixels.

Returns:

The spacing between baseline to baseline of this font, in pixels.

inline int16_t getAscent() const#

Get the distance between baseline to Ascent of this font, in pixels.

Returns:

The distance from Baseline to Ascent of this font, in pixels.

inline uint8_t getSpaceWidth() const#

Get the width, in pixels, of the Space character.

Returns:

The width, in pixels, of the Space character.

inline int32_t getYOffset(uint32_t index) const#

Get the Y offset of the font.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

The Y offset of the font.

inline bool isAlphaRendering() const#

Get whether the font uses alpha rendering mode.

Returns:

True if alpha rendering mode is being used. False otherwise.

inline GLuint getSampler() const#

Get the sampler being used by the font.

Returns:

The sampler in use by the font.

inline GLuint getTexture() const#

Get the texture being used by the font.

Returns:

The texture in use by the font.

void loadFontData(const Texture &texture)

Load the font data from the font texture.

Parameters:

texture – The pvr::Texture texture to load font data from.

Returns:

Returns ‘True’ if the font was loaded successfully.

uint32_t findCharacter(uint32_t character) const

Find the index of a character inside the internal font character list. Only useful for custom font use.

Parameters:

character – The value of a character. Accepts ASCII through to UTF32 characters.

Returns:

The index of the character inside the internal font list.

void applyKerning(uint32_t charA, uint32_t charB, float &offset)

Apply kerning to two characters (give the offset required by the specific pair).

Parameters:
  • charA – The first (left) character of the pair.

  • charB – The second (right) character of the pair.

  • offset – Output parameter, the offset that must be applied to the second character due to kerning.

inline const CharMetrics &getCharMetrics(uint32_t index) const

Get the character metrix of this font.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

A CharMetrics object representing the character metrics of the character with that index.

inline const CharacterUV &getCharacterUV(uint32_t index) const

Get the UVs of the characters of this font.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

A CharMetrics object representing the character metrics of the character with that index.

inline const pvrvk::Rect2D &getRectangle(uint32_t index) const

Get the rectangle for a specific character.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

The rectangle where this character exists in the font texture.

inline int16_t getFontLineSpacing() const

Get the spacing between baseline to baseline of this font, in pixels.

Returns:

The spacing between baseline to baseline of this font, in pixels.

inline int16_t getAscent() const

Get the distance between baseline to Ascent of this font, in pixels.

Returns:

The distance from Baseline to Ascent of this font, in pixels.

inline uint8_t getSpaceWidth() const

Get the width, in pixels, of the Space character.

Returns:

The width, in pixels, of the Space character.

inline int32_t getYOffset(uint32_t index) const

Get the Y offset of the font.

Parameters:

index – The internal index of the character. Use findCharacter to get the index of a specific known character.

Returns:

The Y offset of the font.

inline bool isAlphaRendering() const

Get whether the font uses alpha rendering mode.

Returns:

True if alpha rendering mode is being used. False otherwise.

inline const pvrvk::DescriptorSet &getTexDescriptorSet() const#

Retrieve the descriptorSet containing this Font’s texture.

Returns:

The descriptorSet containing this Font’s texture.

inline const pvrvk::ImageView &getImageView() const#

Retrieve the image view containing this font’s texture.

Returns:

This Font’s texture.

Friends

friend class ::pvr::ui::UIRenderer
friend class pvr::ui::UIRenderer
struct CharacterUV#

struct containing the UV’s corresponding to the UV coordinates of a character of a Font.

Public Members

float ul#

The ul coordinate.

float vt#

The vt coordinate.

float ur#

The ur coordinate.

float vb#

The vb coordinate.

struct CharMetrics#

struct representing the metrics of a character of a Font.

Public Members

int16_t xOff#

Prefix offset.

uint16_t characterWidth#

The width of the character.

Font_::make_shared_enabler#

Nested Relationships#

This class is a nested type of Font_.

Class Documentation#

class make_shared_enabler#

Protected Functions

inline make_shared_enabler()#
inline make_shared_enabler()

Friends

friend class Font_

Group_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public pvr::ui::impl::Sprite_ (Sprite_)

Derived Types#

Class Documentation#

class Group_ : public pvr::ui::impl::Sprite_#

Abstract container for sprites. See MatrixGroup or PixelGroup. A group contains references to a number of sprites, allowing hierarchical transformations to be applied to them.

A very complex transformation using the “id” member is used to optimize the group transformations, as each child needs to hold the transformations

Subclassed by pvr::ui::impl::MatrixGroup_, pvr::ui::impl::PixelGroup_

Public Functions

Group_ *add(const Sprite &sprite)#

Add a Sprite (Text, Image etc.) to this Group. All sprites in the group will be transformed together when calling Render on the group. NOTE: Adding Sprites in to group requires re-recording the commandbuffer.

Parameters:

sprite – The Sprite to add.

Returns:

Pointer to this object, in order to easily chan add commands.

inline void add(const Sprite *sprites, uint32_t numSprites)#

Adds number of Sprites (Text, Image etc.) to this Group. All sprites in the group will be transformed together when calling Render on the group. NOTE: Adding Sprites in to group requires re-recording the commandbuffer.

Parameters:
  • sprites – A pointer to an array of Sprites to add.

  • numSprites – The number of sprites to add from the array pointed to by sprites.

Returns:

Pointer to this object, in order to easily chan add commands.

inline void remove(const Sprite &sprite)#

Remove a Sprite from this Group. Removing a sprite from this group involves a linear search to find and remove the sprite as well as a reconstruction of the groups bounding box from the remaining sprites in the group (Complexity O(2n))

Parameters:

sprite – The Sprite to remove.

inline void removeAll()#

Remove all sprites in this group. Requires commandbuffer re-recording inorder to take affect

inline virtual glm::vec2 getScaledDimension() const#

Retrieves the groups scaled dimension based on each childs current scaling factor.

Returns:

The groups scaled dimension.

Group_ *add(const Sprite &sprite)

Add a Sprite (Text, Image etc.) to this Group. All sprites in the group will be transformed together when calling Render on the group. NOTE: Adding Sprites in to group requires re-recording the commandbuffer.

Parameters:

sprite – The Sprite to add.

Returns:

Pointer to this object, in order to easily chan add commands.

inline void add(const Sprite *sprites, uint32_t numSprites)

Adds number of Sprites (Text, Image etc.) to this Group. All sprites in the group will be transformed together when calling Render on the group. NOTE: Adding Sprites in to group requires re-recording the commandbuffer.

Parameters:
  • sprites – A pointer to an array of Sprites to add.

  • numSprites – The number of sprites to add from the array pointed to by sprites.

Returns:

Pointer to this object, in order to easily chan add commands.

inline void remove(const Sprite &sprite)

Remove a Sprite from this Group. Linear search (Complexity O(n) )

Parameters:

sprite – The Sprite to remove.

inline void removeAll()

Remove all sprites in this group. Requires commandbuffer re-recording inorder to take affect

inline virtual glm::vec2 getScaledDimension() const

Retrieves the groups scaled dimension based on each childs current scaling factor.

Returns:

The groups scaled dimension.

Protected Types

typedef std::vector<Sprite> ChildContainer#

A ChildContainer typedef is a vector of Sprites.

typedef std::vector<Sprite> ChildContainer

A ChildContainer typedef is a vector of Sprites.

Protected Functions

inline uint64_t packId(uint64_t parentIds, uint64_t id) const#

Packs this Groups Id with its parents id to create a new packed id.

Parameters:
  • parentIds – The groups’ parent id.

  • id – This group’s id.

Returns:

A new packed id consisting of combination of the groups id with its parent’s id.

Protected Attributes

mutable ChildContainer _children#

The child Sprites which this group maintains.

uint64_t _id#

This groups id.

Friends

friend class ::pvr::ui::impl::PixelGroup_
friend class ::pvr::ui::impl::MatrixGroup_
friend class pvr::ui::impl::PixelGroup_
friend class pvr::ui::impl::MatrixGroup_

I2dComponent#

Inheritance Relationships#

Derived Types#

  • public pvr::ui::impl::Image_ (Image_)

  • public pvr::ui::impl::PixelGroup_ (PixelGroup_)

  • public pvr::ui::impl::Text_ (Text_)

Class Documentation#

class I2dComponent#

A component that can be positioned in 2D using 2d position, scale, rotation and anchored using its center or corners.

Subclassed by pvr::ui::impl::Image_, pvr::ui::impl::PixelGroup_, pvr::ui::impl::Text_

Public Functions

inline virtual ~I2dComponent()#

Virtual Descructor for a I2dComponent.

inline I2dComponent const *setAnchor(Anchor anchor, const glm::vec2 &ndcPos)#

Set the anchor and position (“centerpoint”) of this component. The anchor is the point around which all operations (e.g. scales, rotations) will happen.

Parameters:
  • anchor – The anchor point

  • ndcPos – The normalized device coordinates (-1..1) where the anchor should be in its group.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setAnchor(Anchor anchor, float ndcPosX = -1.f, float ndcPosY = -1.f) const#

Set the anchor and position (“centerpoint”) of this component. The anchor is the point around which all operations (e.g. scales, rotations) will happen.

Parameters:
  • anchor – The anchor point

  • ndcPosX – The normalized (-1..1) horizontal coordinate where the anchor should be in its group.

  • ndcPosY – The normalized (-1..1) vertical coordinate where the anchor should be in its group.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setPixelOffset(float offsetX, float offsetY) const#

Set the pixel offset of this object. Pixel offset is applied after every other calculation, so it always moves the final (transformed) sprite by the specified number of pixels in each direction.

Parameters:
  • offsetX – Number of pixels to move the sprite right (negative for left)

  • offsetY – Number of pixels to move the sprite up (negative for down)

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setPixelOffset(glm::vec2 offset) const#

Set the pixel offset of this object. Pixel offset is applied after every other calculation, so it always moves the final (transformed) sprite by the specified number of pixels in each direction.

Parameters:

offset – Number of pixels to move the sprite right/up (negative for down/left)

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setScale(glm::vec2 const &scale) const#

Set the scale of this object.

Parameters:

scale – The scale of this object. (1,1) is natural scale.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setScale(float scaleX, float scaleY) const#

Set the scale of this object.

Parameters:
  • scaleX – The scale of this object in the X direction. 1 is natural scale.

  • scaleY – The scale of this object in the Y direction. 1 is natural scale.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setRotation(float radians) const#

Set the rotation of this object on the screen (in fact, its parent group’s) plane.

Parameters:

radians – The Counter Clockwise rotation of this object, in radians, around its Z axis.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setUV(const pvr::Rectanglef &uv) const#

Set the uv coordinates for this object.

Parameters:

uv – The UV coordinate to use for this object.

Returns:

this object (allow chaining commands with ->)

inline virtual ~I2dComponent()

Virtual Descructor for a I2dComponent.

inline I2dComponent const *setAnchor(Anchor anchor, const glm::vec2 &ndcPos)

Set the anchor and position (“centerpoint”) of this component. The anchor is the point around which all operations (e.g. scales, rotations) will happen.

Parameters:
  • anchor – The anchor point

  • ndcPos – The normalized device coordinates (-1..1) where the anchor should be in its group

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setAnchor(Anchor anchor, float ndcPosX = -1.f, float ndcPosY = -1.f) const

Set the anchor and position (“centerpoint”) of this component. The anchor is the point around which all operations (e.g. scales, rotations) will happen.

Parameters:
  • anchor – The anchor point

  • ndcPosX – The normalized (-1..1) horizontal coordinate where the anchor should be in its group

  • ndcPosY – The normalized (-1..1) vertical coordinate where the anchor should be in its group

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setPixelOffset(float offsetX, float offsetY) const

Set the pixel offset of this object. Pixel offset is applied after every other calculation, so it always moves the final (transformed) sprite by the specified number of pixels in each direction.

Parameters:
  • offsetX – Number of pixels to move the sprite right (negative for left)

  • offsetY – Number of pixels to move the sprite up (negative for down)

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setPixelOffset(glm::vec2 offset) const

Set the pixel offset of this object. Pixel offset is applied after every other calculation, so it always moves the final (transformed) sprite by the specified number of pixels in each direction.

Parameters:

offset – Number of pixels to move the sprite right/up (negative for down/left)

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setScale(glm::vec2 const &scale) const

Set the scale of this object.

Parameters:

scale – The scale of this object. (1,1) is natural scale.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setScale(float scaleX, float scaleY) const

Set the scale of this object.

Parameters:
  • scaleX – The scale of this object in the X direction. 1 is natural scale.

  • scaleY – The scale of this object in the Y direction. 1 is natural scale.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setRotation(float radians) const

Set the rotation of this object on the screen (in fact, its parent group’s) plane.

Parameters:

radians – The Counter Clockwise rotation of this object, in radians, around its Z axis.

Returns:

this object (allow chaining commands with ->)

inline I2dComponent const *setUV(const pvrvk::Rect2Df &uv) const#

Set the uv coordinates for this object.

Parameters:

uv – The UV coordinate to use for this object.

Returns:

this object (allow chaining commands with ->)

Protected Attributes

mutable Anchor _anchor#

The position in the sprite relative to which all positioning calculations are done.

mutable glm::vec2 _position#

Position of the sprite relative to its UIRenderer area.

mutable glm::vec2 _scale#

Scale of the sprite. A scale of 1 means natural size (1:1 mapping of sprite to screen pixels).

mutable float _rotation#

Rotation of the sprite, in radians.

mutable bool _isPositioningDirty#

Used to avoid unnecessary expensive calculations if commitUpdate is called unnecessarily.

mutable glm::vec2 _pixelOffset#

The pixel offset used by this I2dComponent.

mutable Rectanglef _uv#

UV coordinates for the I2dComponent.

mutable bool _isUVDirty#

Used to avoid unnecessary expensive calculations if commitUpdate is called unnecessarily.

mutable pvrvk::Rect2Df _uv

UV coordinates for the I2dComponent.

Friends

friend class ::pvr::ui::UIRenderer
friend class ::pvr::ui::impl::PixelGroup_
friend class ::pvr::ui::impl::Text_
friend class ::pvr::ui::impl::Image_
friend class pvr::ui::UIRenderer
friend class pvr::ui::impl::PixelGroup_
friend class pvr::ui::impl::Text_
friend class pvr::ui::impl::Image_

Image_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

Class Documentation#

class Image_ : public pvr::ui::impl::Sprite_, public pvr::ui::impl::I2dComponent#

Use this class through the reference counted Framework Object pvr::ui::Image. Represents a 2D Image (aka Texture). Can be used like all Sprites and additionally contains methods required for working with Images.

Public Functions

inline uint32_t getWidth() const#

Get the width of this image width in pixels.

Returns:

Image width in pixels.

inline uint32_t getHeight() const#

Get the height of this image width in pixels.

Returns:

Image width in pixels.

inline const GLuint &getTexture() const#

Retrieve the pvr::api::Texture2D object that this Image wraps.

Returns:

The pvr::api::Texture2D object that this Image wraps.

inline GLuint &getTexture()#

Retrieve the pvr::api::Texture2D object that this Image wraps.

Returns:

The pvr::api::Texture2D object that this Image wraps.

inline const GLuint &getSampler() const#

Retrieve the pvr::api::Sampler that this Image will use for sampling the texture. Const overload.

Returns:

The pvr::api::Sampler that this Image will use for sampling the texture. Const overload.

inline GLuint &getSampler()#

Retrieve the pvr::api::Sampler that this Image will use for sampling the texture.

Returns:

The pvr::api::Sampler that this Image will use for sampling the texture.

inline virtual glm::vec2 getScaledDimension() const#

Get the size of this texture after applying scale.

Returns:

The size of this texture after applying scale

inline virtual ~Image_()#

Virtual Descructor for a Image_.

inline uint32_t getWidth() const

Get the width of this image width in pixels.

Returns:

Image width in pixels.

inline uint32_t getHeight() const

Get the height of this image width in pixels.

Returns:

Image width in pixels.

inline const pvrvk::ImageView &getImageView() const#

Retrieve the Texture2D object that this Image wraps.

Returns:

The Texture2D object that this Image wraps.

inline pvrvk::ImageView &getImageView()#

Retrieve the Texture2D object that this Image wraps.

Returns:

The Texture2D object that this Image wraps.

inline const pvrvk::Sampler &getSampler() const

Retrieve the Sampler that this Image will use for sampling the texture. Const overload.

Returns:

The Sampler that this Image will use for sampling the texture. Const overload.

inline pvrvk::Sampler &getSampler()

Retrieve the Sampler that this Image will use for sampling the texture.

Returns:

The Sampler that this Image will use for sampling the texture.

inline const pvrvk::DescriptorSet &getTexDescriptorSet() const#

Retrieve the descriptorSet containing this Image’s texture.

Returns:

The descriptorSet containing this Image’s texture.

inline virtual glm::vec2 getScaledDimension() const

Get the size of this texture after applying scale.

Returns:

The size of this texture after applying scale

inline virtual const std::string &getSpriteName()#

Get the sprite name.

Returns:

The sprites’s name

Protected Attributes

uint32_t _texW#

Width of the image.

uint32_t _texH#

Height of the image.

GLuint _texture#

The texture object of this image.

GLuint _sampler#

The sampler used by this image.

mutable std::map<uint64_t, MvpData> _mvpData#

A map containing the model view projection data for all paths for this Image.

mutable bool _isTextureDirty#

Used to avoid unnecessary expensive calculations if commitUpdate is called unnecessarily.

MaterialUboData _materialData#

Holds data specific to rendering a particular sprite in particular its color and alpha mode.

mutable pvrvk::DescriptorSet _texDescSet#

The descriptor set containing the texture of this object.

pvrvk::ImageView _imageView#

The texture object of this image.

pvrvk::Sampler _sampler

The sampler used by this image.

mutable std::map<uint64_t, MvpUboData> _mvpData

A map containing the model view projection data for all paths for this Image.

Friends

friend class pvr::ui::UIRenderer
struct MaterialUboData#

Holds data specific to rendering a particular sprite in particular its color and alpha mode.

Public Functions

inline MaterialUboData()#

Default constructor for the MaterialUboData structure.

Public Members

glm::vec4 color#

Rendering color.

uint32_t isAlphaMode#

Specifies whether alpha rendering mode is being used.

mutable int32_t bufferArrayId#

A buffer array identifier.

struct MvpData#

Holds data specific to rendering a particular sprite in particular its model view project matrix.

Public Functions

inline MvpData()#

Default constructor for the MvpData structure.

Public Members

glm::mat4 mvp#

Model view project matrix.

struct MvpUboData#

Holds data specific to rendering a particular sprite in particular its model view project matrix.

Public Functions

inline MvpUboData()#

Default constructor for the MvpUboData structure.

Public Members

glm::mat4 mvp#

Model view project matrix.

mutable int32_t bufferArrayId#

A buffer array identifier.

Image_::make_shared_enabler#

Nested Relationships#

This class is a nested type of Image_.

Class Documentation#

class make_shared_enabler#

Protected Functions

inline make_shared_enabler()#
inline make_shared_enabler()

Friends

friend class Image_

MatrixGroup_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public pvr::ui::impl::Group_ (Group_)

Class Documentation#

class MatrixGroup_ : public pvr::ui::impl::Group_#

This class is wrapped into the pvr::ui::Group reference counted Framework Object. Use to apply a transformation to several Sprites and render them together (for example, layout some sprites to form a UI and then apply translation or rotation effects to all of them to change the page).

Public Functions

inline void setScaleRotateTranslate(const glm::mat4 &srt)#

Set the scale/rotation/translation matrix of this group. If other transformations are added to this matrix, unexpected results may occur when rendering the sprites.

Parameters:

srt – The scale/rotation/translation matrix of this group

inline void setViewProjection(const glm::mat4 &viewProj)#

Set the projection matrix of this group.

Parameters:

viewProj – A projection matrix which will be used to render all members of this group

virtual void commitUpdates() const#

Call this method when you are finished updating the sprites (text, matrices, positioning etc.), and BEFORE the beginRendering command, to commit any changes you have done to the sprites. This function must not be called during rendering.

inline void setScaleRotateTranslate(const glm::mat4 &srt)

Set the scale/rotation/translation matrix of this group. If other transformations are added to this matrix, unexpected results may occur when rendering the sprites.

Parameters:

srt – The scale/rotation/translation matrix of this group

inline void setViewProjection(const glm::mat4 &viewProj)

Set the projection matrix of this group.

Parameters:

viewProj – A projection matrix which will be used to render all members of this group

virtual void commitUpdates() const

Call this method when you are finished updating the sprites (text, matrices, positioning etc.), and BEFORE the beginRendering command, to commit any changes you have done to the sprites. This function must not be called during rendering.

Friends

friend class pvr::ui::UIRenderer

MatrixGroup_::make_shared_enabler#

Nested Relationships#

This class is a nested type of MatrixGroup_.

Class Documentation#

class make_shared_enabler#

Protected Functions

inline make_shared_enabler()#
inline make_shared_enabler()

Friends

friend class MatrixGroup_

PixelGroup_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

Class Documentation#

class PixelGroup_ : public pvr::ui::impl::Group_, public pvr::ui::impl::I2dComponent#

This class is wrapped into the pvr::ui::Group reference counted Framework Object. Use to apply a transformation to several Sprites and render them together (for example, layout some sprites to form a UI and then apply translation or rotation effects to all of them to change the page).

Public Functions

inline PixelGroup_ *setSize(glm::vec2 const &size)#

Set the size (extent) of this pixel group.

Parameters:

size – The size of this pixel group, used to position the items it contains. It DOES NOT perform clipping - items can very well be placed outside the size of the group, and they will be rendered correctly as long as they are within the screen/viewport.

Returns:

Pointer to this item

inline PixelGroup_ *setSize(glm::vec2 const &size)

Set the size (extent) of this pixel group.

Parameters:

size – The size of this pixel group, used to position the items it contains. It DOES NOT perform clipping - items can very well be placed outside the size of the group, and they will be rendered correctly as long as they are within the screen/viewport.

Returns:

Pointer to this item

Friends

friend class pvr::ui::UIRenderer

PixelGroup_::make_shared_enabler#

Nested Relationships#

This class is a nested type of PixelGroup_.

Class Documentation#

class make_shared_enabler#

Protected Functions

inline make_shared_enabler()#
inline make_shared_enabler()

Friends

friend class PixelGroup_

Sprite_#

Inheritance Relationships#

Derived Types#

  • public pvr::ui::impl::Group_ (Group_)

  • public pvr::ui::impl::Image_ (Image_)

  • public pvr::ui::impl::Text_ (Text_)

Class Documentation#

class Sprite_#

Base sprite class. Use through the Sprite framework object. Represents something that can be rendered with the UIRenderer. Texts, Images, Groups are all sprites (Fonts too although it would only be used as a sprite to display the entire font’s glyphs).

Subclassed by pvr::ui::impl::Group_, pvr::ui::impl::Image_, pvr::ui::impl::Text_

Public Functions

virtual void commitUpdates() const#

Call this function after changing the sprite in any way, in order to update its internal information. This function should be called before any rendering commands are submitted and before calling functions such as getDimensions, in order to actually process all the changes to the sprite.

inline virtual ~Sprite_()#

Virtual Descructor for a Sprite.

inline glm::vec2 getDimensions() const#

Get the Sprite’s bounding box. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box.

void render() const#

Render is the normal function to call to render a sprite. Before calling this function, call beginRendering on the uiRenderer this sprite belongs to to set up the commandBuffer to render to. In general try to group as many render commands as possible between the beginRendering and endRendering. This overload does not apply any transformations to the sprite.

inline void setAlphaRenderingMode(bool isAlphaOnly) const#

Use this to use this sprite as Alpha channel only, setting its color to 1,1,1,a. Otherwise, an Alpha texture would render black. Always use this setting to render Fonts that have been generated with PVRTexTool as Alpha textures.

Parameters:

isAlphaOnly – Pass “true” to flush all color channels to 1.0 and keep the alpha channel. Pass false (default state) to render with texture colors unchanged.

inline void setColor(glm::vec4 color) const#

Set a modulation (multiplicative) color to the sprite, as a vector of normalised 32 bit float values. Range of values must be 0..1.

Parameters:

color – A glm::vec4 that contains color and alpha values in the range of 0..1. Initial value (1.0,1.0,1.0,1.0)

inline void setColor(uint32_t r, uint32_t g, uint32_t b, uint32_t a) const#

Set a modulation (multiplicative) color to the sprite, as bytes (0..255).

Parameters:
  • r – Red channel. Initial value 255.

  • g – Green channel. Initial value 255.

  • b – Blue channel. Initial value 255.

  • a – Alpha channel. Initial value 255.

inline void setColor(float r, float g, float b, float a) const#

Set a modulation (multiplicative) color to the sprite, as normalised floating point values. Values must be in the range of 0..1.

Parameters:
  • r – Red channel. Initial value 1.

  • g – Green channel. Initial value 1.

  • b – Blue channel. Initial value 1.

  • a – Alpha channel. Initial value 1.

inline void setColor(uint32_t rgba) const#

Set a modulation (multiplicative) color to the sprite, as bytes packed into an integer.

Parameters:

rgba – 8 bit groups, least significant bits: Red, then Green, then Blue, then most significant bits is Alpha.

inline const glm::vec4 &getColor() const#

Get the modulation (multiplicative) color of the sprite, as a glm::vec4.

Returns:

The sprites’s modulation color. Values are normalised in the range of 0..1

inline bool getAlphaRenderingMode() const#

This setting queries if this is set to render as Alpha channel only, (setting its color to 1,1,1,a). Otherwise, an Alpha texture would render black. This setting is typically used to render Text with Fonts that have been generated with PVRTexTool as Alpha textures.

Returns:

“true” if set to render as Alpha, false otherwise.

inline const glm::mat4 &getMatrix() const#

Get the sprite’s own transformation matrix. Does not contain hierarchical transformations from groups etc. This function is valid only after any changes to the sprite have been commited with commitUpdates as it is normally calculated in commitUpdates.

Returns:

The sprite’s final transformation matrix. If the sprite is rendered on its own, this is the matrix that will be uploaded to the shader.

inline math::AxisAlignedBox const &getBoundingBox() const#

Get the Sprite’s bounding box. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box.

virtual glm::vec2 getScaledDimension() const = 0#

Retrieves the groups scaled dimension based on each childs current scaling factor.

Returns:

The groups scaled dimension.

virtual void commitUpdates() const

Call this function after changing the sprite in any way, in order to update its internal information. This function should be called before any rendering commands are submitted and before calling functions such as getDimensions, in order to actually process all the changes to the sprite.

inline virtual ~Sprite_()

Virtual Descructor for a Sprite.

inline glm::vec2 getDimensions() const

Get the Sprite’s bounding box. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box.

void render()#

Render is the normal function to call to render a sprite. Before calling this function, call beginRendering on the uiRenderer this sprite belongs to to set up the commandBuffer to render to. In general try to group as many render commands as possible between the beginRendering and endRendering. This overload does not apply any transformations to the sprite.

inline void setAlphaRenderingMode(bool isAlphaOnly) const

Use this to use this sprite as Alpha channel only, setting its color to 1,1,1,a. Otherwise, an Alpha texture would render black. Always use this setting to render Fonts that have been generated with PVRTexTool as Alpha textures.

Parameters:

isAlphaOnly – Pass “true” to flush all color channels to 1.0 and keep the alpha channel. Pass false (default state) to render with texture colors unchanged.

inline void setColor(glm::vec4 color) const

Set a modulation (multiplicative) color to the sprite, as a vector of normalised 32 bit float values. Range of values must be 0..1.

Parameters:

color – A glm::vec4 that contains color and alpha values in the range of 0..1. Initial value (1.0,1.0,1.0,1.0)

inline void setColor(uint32_t r, uint32_t g, uint32_t b, uint32_t a) const

Set a modulation (multiplicative) color to the sprite, as bytes (0..255).

Parameters:
  • r – Red channel. Initial value 255.

  • g – Green channel. Initial value 255.

  • b – Blue channel. Initial value 255.

  • a – Alpha channel. Initial value 255.

inline void setColor(float r, float g, float b, float a) const

Set a modulation (multiplicative) color to the sprite, as normalised floating point values. Values must be in the range of 0..1.

Parameters:
  • r – Red channel. Initial value 1.

  • g – Green channel. Initial value 1.

  • b – Blue channel. Initial value 1.

  • a – Alpha channel. Initial value 1.

inline void setColor(uint32_t rgba) const

Set a modulation (multiplicative) color to the sprite, as bytes packed into an integer.

Parameters:

rgba – 8 bit groups, least significant bits: Red, then Green, then Blue, then most significant bits is Alpha.

inline const glm::vec4 &getColor() const

Get the modulation (multiplicative) color of the sprite, as a glm::vec4.

Returns:

The sprites’s modulation color. Values are normalised in the range of 0..1

inline virtual const std::string &getSpriteName()#

Get the sprite name.

Returns:

The sprites’s name

inline bool getAlphaRenderingMode() const

This setting queries if this is set to render as Alpha channel only, (setting its color to 1,1,1,a). Otherwise, an Alpha texture would render black. This setting is typically used to render Text with Fonts that have been generated with PVRTexTool as Alpha textures.

Returns:

“true” if set to render as Alpha, false otherwise.

inline const glm::mat4 &getMatrix() const

Get the sprite’s own transformation matrix. Does not contain hierarchical transformations from groups etc. This function is valid only after any changes to the sprite have been commited with commitUpdates as it is normally calculated in commitUpdates.

Returns:

The sprite’s final transformation matrix. If the sprite is rendered on its own, this is the matrix that will be uploaded to the shader.

inline math::AxisAlignedBox const &getBoundingBox() const

Get the Sprite’s bounding box. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box.

virtual glm::vec2 getScaledDimension() const = 0

Retrieves the groups scaled dimension based on each childs current scaling factor.

Returns:

The groups scaled dimension.

Protected Functions

inline void setUIRenderer(UIRenderer *uiRenderer)#

Setter for the current UIRenderer being used for the Sprite.

Parameters:

uiRenderer – The new UIRenderer to use for rendering this sprite.

inline void setUIRenderer(UIRenderer *uiRenderer)

Setter for the current UIRenderer being used for the Sprite.

Parameters:

uiRenderer – The new UIRenderer to use for rendering this sprite.

inline bool isSpriteNameDirty() const#

Determines whether the sprite name should be updated.

Returns:

Returns true if the sprite name is dirty and the cached string must be updated.

Protected Attributes

mutable math::AxisAlignedBox _boundingRect#

Bounding rectangle of the sprite.

mutable glm::vec4 _color#

Modulation color (multiplicative).

mutable int32_t _alphaMode#

Set the shader to render alpha-only.

UIRenderer *_uiRenderer#

UIRenderer this sprite belongs to.

mutable glm::mat4 _cachedMatrix#

The cached transformation matrix.

glm::mat4 _viewProj#

View projection matrix.

std::string _spriteName#

A cached sprite name.

Friends

friend class pvr::ui::UIRenderer
friend class pvr::ui::impl::Group_
friend class pvr::ui::impl::Font_
friend class pvr::ui::impl::PixelGroup_
friend class pvr::ui::impl::MatrixGroup_
friend class pvr::ui::impl::Image_
friend class pvr::ui::impl::TextElement_
friend class pvr::ui::impl::Text_

TextElement_#

Nested Relationships#

Nested Types#

Class Documentation#

class TextElement_#

The TextElement class should be used through the reference counted Framework Object pvr::ui::TextElement. The TextElement_ class handles the implementation specifics for creating, managing and rendering text elements to the screen including buffer creation, updates and deletion as well as the rendering of the text element.

Public Types

enum [anonymous]#

The maximum number of letters supported by a TextElement.

Values:

enumerator MaxLetters#
enum [anonymous]#

The maximum number of letters supported by a TextElement.

Values:

enumerator MaxLetters#

Public Functions

inline glm::vec2 getDimensions() const#

Get the Sprite’s bounding box dimensions. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box dimensions.

inline math::AxisAlignedBox const &getBoundingBox() const#

Get the Sprite’s bounding box. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box.

TextElement_ &setText(const std::string &str)#

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

TextElement_ &setText(std::string &&str)#

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

TextElement_ &setText(const std::wstring &str)#

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

TextElement_ &setText(std::wstring &&str)#

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline const std::string &getString() const#

Gets the text element current text string.

Returns:

The text element current text string

inline const std::wstring &getWString() const#

Gets the text element current text wstring.

Returns:

The text element current text wstring

inline const Font &getFont() const#

Gets the text element current font.

Returns:

The text element current font

inline glm::vec2 getDimensions() const

Get the Sprite’s bounding box dimensions. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box dimensions.

inline math::AxisAlignedBox const &getBoundingBox() const

Get the Sprite’s bounding box. If the sprite has changed, the value returned is only valid after calling the commitUpdates function.

Returns:

The Sprite’s bounding box.

TextElement_ &setText(const std::string &str)

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

TextElement_ &setText(std::string &&str)

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

TextElement_ &setText(const std::wstring &str)

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

TextElement_ &setText(std::wstring &&str)

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline const std::string &getString() const

Gets the text element current text string.

Returns:

The text element current text string

inline const std::wstring &getWString() const

Gets the text element current text wstring.

Returns:

The text element current text wstring

inline const Font &getFont() const

Gets the text element current font.

Returns:

The text element current font

Friends

friend class ::pvr::ui::impl::Text_
friend class ::pvr::ui::UIRenderer
friend class pvr::ui::impl::Text_
friend class pvr::ui::UIRenderer

TextElement_::make_shared_enabler#

Nested Relationships#

This class is a nested type of TextElement_.

Class Documentation#

class make_shared_enabler#

Protected Functions

inline make_shared_enabler()#
inline make_shared_enabler()

Friends

friend class TextElement_

Text_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

Class Documentation#

class Text_ : public pvr::ui::impl::Sprite_, public pvr::ui::impl::I2dComponent#

Use this class through the reference counted Framework Object pvr::ui::Text. Represents some text that can be rendered as a normal Sprite_ and additionally contains the necessary text manipulation functions.

Public Functions

inline virtual ~Text_()#

Virtual Descructor for a Text_.

inline const Font getFont() const#

Gets the text objects current font.

Returns:

The text objects current font

inline TextElement getTextElement()#

Gets the text objects current text element.

Returns:

The text objects current text element

inline const TextElement getTextElement() const#

Gets the text objects current text element.

Returns:

The text objects current text element

inline virtual glm::vec2 getScaledDimension() const#

Get the size of this texture after applying scale.

Returns:

The size of this texture after applying scale

inline Text_ &setText(const std::string &str)#

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline Text_ &setText(std::string &&str)#

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline Text_ &setText(const std::wstring &str)#

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline Text_ &setText(std::wstring &&str)#

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline virtual ~Text_()

Virtual Descructor for a Text_.

inline const Font getFont() const

Gets the text objects current font.

Returns:

The text objects current font

inline TextElement getTextElement()

Gets the text objects current text element.

Returns:

The text objects current text element

inline const TextElement getTextElement() const

Gets the text objects current text element.

Returns:

The text objects current text element

inline virtual glm::vec2 getScaledDimension() const

Get the size of this texture after applying scale.

Returns:

The size of this texture after applying scale

inline Text_ &setText(const std::string &str)

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline Text_ &setText(std::string &&str)

Sets the text element text from a std::string.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline Text_ &setText(const std::wstring &str)

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline Text_ &setText(std::wstring &&str)

Sets the text element text from a std::wstring.

Parameters:

str – The new text value to use for the text element.

Returns:

this object (allow chaining commands with ->)

inline bool isSpriteNameDirty() const#

Determines whether the sprite name should be updated.

Returns:

Returns true if the sprite name is dirty and the cached string must be updated.

inline virtual const std::string &getSpriteName()#

Get the sprite name.

Returns:

The sprites’s name

Friends

friend class pvr::ui::UIRenderer

Text_::make_shared_enabler#

Nested Relationships#

This class is a nested type of Text_.

Class Documentation#

class make_shared_enabler#

Protected Functions

inline make_shared_enabler()#
inline make_shared_enabler()

Friends

friend class Text_

UIRenderer#

Nested Relationships#

Nested Types#

Class Documentation#

class UIRenderer#

Manages and render the sprites.

Public Functions

inline const GLuint &getFontIbo()#

Retrieves the Font index buffer.

Returns:

The OpenGL ES handle for the Font index buffer.

inline const GLuint &getImageVbo()#

Retrieves the Image vertex buffer.

Returns:

The OpenGL ES handle for the Image vertex buffer.

inline UIRenderer()#

Constructor. Does not produce a ready-to-use object, use the init function before use.

inline UIRenderer(UIRenderer &&rhs)#

Move Constructor. Does not produce a ready-to-use object, use the init function before use.

Parameters:

rhs – Another UIRenderer to initiialise from.

inline UIRenderer &operator=(UIRenderer &&rhs)#

Assignment Operator overload. Does not produce a ready-to-use object, use the init function before use.

Parameters:

rhs – Another UIRenderer to initiialise from.

Returns:

this object (allow chaining commands with ->)

inline ~UIRenderer()#

Destructor for the UIRenderer which will release all resources currently in use.

inline const ProgramData &getProgramData()#

Returns the ProgramData used by this UIRenderer.

Returns:

The ProgramData structure used by the UIRenderer.

void init(uint32_t width, uint32_t height, bool fullscreen, bool isFrameBufferSRGB)#

Initialize the UIRenderer with window dimensions. MUST BE called exactly once before use, after a valid graphics context is available (usually, during initView).

Parameters:
  • width – The width of the screen used for rendering.

  • height – The height of the screen used for rendering

  • fullscreen – Indicates whether the rendering is occuring in full screen mode.

  • isFrameBufferSRGB – Indicates whether the rendering in to SRGB

Returns:

True indicating the result of initialising the UIRenderer was successful otherwise False.

inline void release()#

Release the UIRenderer and its resources. Must be called once after we are done with the UIRenderer. (usually, during releaseView).

inline TextElement createTextElement(const std::string &text = "")#

Create a Text sprite. Initialize with std::string. Uses default font.

Parameters:

text – std::string object that this Text object will be initialized with

Returns:

Text Element framework object, Null framework object if failed.

TextElement createTextElement(const std::string &text, const Font &font)#

Create Text sprite from std::string and pvr::ui::Font.

Parameters:
  • text – String object that this Text object will be initialized with

  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

Returns:

Text framework object, Null framework object if failed.

inline TextElement createTextElement(const Font &font)#

Create a Text Element sprite from a pvr::ui::Font. A default string will be used.

Parameters:

font – The font that the text element will be using. The font must belong to the same UIrenderer object.

Returns:

Text framework object, Null framework object if failed.

inline TextElement createTextElement(const std::wstring &text)#

Create Text sprite from wide std::string. Uses the Default Font.

Parameters:

text – Wide std::string that this Text object will be initialized with. Will use the Default Font.

Returns:

Text framework object, Null framework object if failed.

TextElement createTextElement(const std::wstring &text, const Font &font)#

Create Text sprite from wide std::wstring and a pvr::ui::Font.

Parameters:
  • text – text to be rendered.

  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

Returns:

Text framework object, Null framework object if failed.

Text createText(const TextElement &textElement)#

Create a Text sprite from a TextElement.

Parameters:

textElement – text element to initialise a Text framework object from.

Returns:

Text framework object, Null framework object if failed.

inline Text createText(const std::string &text = "")#

Create a Text sprite. Initialize with std::string. Uses default font.

Parameters:

text – std::string object that this Text object will be initialized with

Returns:

Text framework object, Null framework object if failed.

inline Text createText(const std::string &text, const Font &font)#

Create Text sprite from std::string.

Parameters:
  • text – String object that this Text object will be initialized with

  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

Returns:

Text framework object, Null framework object if failed.

inline Text createText(const Font &font)#

Create a Text sprite from a pvr::ui::Font. Uses a default text string.

Parameters:

font – The font that the text will be using. The font must belong to the same UIrenderer object.

Returns:

Text framework object, Null framework object if failed.

inline Text createText(const std::wstring &text)#

Create Text sprite from wide std::wstring. Uses the Default Font.

Parameters:

text – Wide std::string that this Text object will be initialized with. Will use the Default Font.

Returns:

Text framework object, Null framework object if failed.

inline Text createText(const std::wstring &text, const Font &font)#

Create Text sprite from wide std::string.

Parameters:
  • text – text to be rendered.

  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

Returns:

Text framework object, Null framework object if failed.

inline float getRenderingDimX() const#

Get the X dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Width.

Returns:

Render width of the rectangle the UIRenderer is using for rendering.

inline float getRenderingDimY() const#

Get the Y dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Height.

Returns:

Render height of the rectangle the UIRenderer is using for rendering.

inline glm::vec2 getRenderingDim() const#

Get the rendering dimensions of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Width and Screen Height.

Returns:

Render width and height of the rectangle the UIRenderer is using for rendering.

inline Rectanglei getViewport() const#

Get the viewport of the rectangle the UIRenderer is rendering to. Initial value is the Screen Width and Screen Height.

Returns:

Viewport width and height of the rectangle the UIRenderer is using for rendering.

inline void setRenderingDimX(float value)#

Set the X dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Width.

Parameters:

value – The new rendering width.

inline void setRenderingDimY(float value)#

Set the Y dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Height.

Parameters:

value – The new rendering height.

Font createFont(GLuint texture, const TextureHeader &textureHeader, GLuint sampler = 0)#

Create a font from a given texture (use PVRTexTool to create the font texture from a font file).

Use PVRTexTool to create textures suitable for Font use. You can then use any of the createFont function overloads to create a pvr::ui::Font object to render your sprites. This overload requires that you have already created a Texture2D object from the file and is suitable for sharing a texture between different UIRenderer objects.

Parameters:
  • texture – An OpenGL ES texture handle. Must be 2D. It will be used directly.

  • textureHeader – A pvr::TextureHeader of the same object. Necessary for the texture metadata.

  • sampler – (Optional) A specific sampler object to use for this font.

Returns:

A new Font object. Null object if failed.

Font createFont(const Texture &texture, GLuint sampler = 0)#

Create a font from a given texture (use PVRTexTool to create the font texture from a font file).

Use PVRTexTool to create textures suitable for Font use. You can then use any of the createFont function overloads to create a pvr::ui::Font object to render your sprites. This overload directly uses a pvr::Texture for both data and metadata, but will create a new Texture2D so if using multiple UIRenderes using the same font, might not be the most efficient version.

Parameters:
  • texture – An OpenGL ES texture handle. Must be 2D. It will be used directly.

  • sampler – (Optional) A specific sampler object to use for this font.

Returns:

A new Font object. Null object if failed.

Image createImage(GLuint texture, int32_t width, int32_t height, bool useMipmaps, GLuint sampler = 0)#

Create a pvr::ui::Image from an API texture. NOTE: Creating new image requires re-recording the commandbuffer.

Parameters:
  • texture – An OpenGL ES texture handle. Must be 2D. It will be used directly.

  • width – The width of the texture.

  • height – The height of the texture.

  • useMipmaps – Specifies whether the image should use mip maps

  • sampler – (Optional) A specific sampler object to use for this font.

Returns:

A new Image object of the specified texture. Null object if failed.

Image createImage(const Texture &texture, GLuint sampler = 0)#

Create a pvr::ui::Image from a Texture asset. NOTE: Creating new image requires re-recording the commandbuffer.

Parameters:
  • texture – A pvr::Texture object. Will be internally used to create an api::Texture2D to use.

  • sampler – (Optional) A specific sampler object to use for this font.

Returns:

A new Image object of the specified texture. Null object if failed.

Image createImageFromAtlas(GLuint texture, const Rectanglef &uv, uint32_t width, uint32_t height, bool useMipmaps = false, GLuint sampler = 0)#

Create a pvr::ui::Image from a Texture Atlas asset. NOTE: Creating new image requires re-recording the commandbuffer.

Parameters:
  • texture – An OpenGL ES texture handle. Must be 2D. It will be used directly.

  • uv – Texture UV coordinate

  • width – Texture Atlas width.

  • height – Texture Atlas height

  • useMipmaps – Specifies whether the image should use mip maps

  • sampler – A sampler used for this Image (Optional)

Returns:

A new Image object of the specified texture. Null object if failed.

MatrixGroup createMatrixGroup()#

Create a pvr::ui::MatrixGroup.

Returns:

A new Group to display different sprites together. Null object if failed.

PixelGroup createPixelGroup()#

Create a pvr::ui::PixelGroup.

Returns:

A new Group to display different sprites together. Null object if failed.

inline void beginRendering()#

Begins direct rendering for the UIRenderer.

inline void beginRendering(const GLStateTracker &stateTracker)#

Begins direct rendering for the UIRenderer. A GLStateTracker structure is used for more efficient state tracking management. Note that for correct state tracking and management this structure must have been fully managed and updated by the caller. If certain states and their tracker are not updated appropriately then certain states may not be tracked or set correctly resulting in incorrect rendering.

Parameters:

stateTracker – A GLStateTracker structure storing the current OpenGL ES state as well as indicating which states have been changed since the last time UIRenderer was used.

inline void endRendering()#

Ends rendering and resets the state.

inline void endRendering(GLStateTracker &stateTracker)#

Ends rendering and fills out the GLStateTracker structure which can be used by the caller for more efficient state tracking management.

Parameters:

stateTracker – A GLStateTracker structure which stores the current OpenGL ES state as well as indicating which states have been changed since the last time the caller called beginRendering. The Caller has the responsibility of restoring and managing the OpenGL ES state.

inline const Font &getDefaultFont() const#

The UIRenderer has a built-in default pvr::ui::Font that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

The default font. Constant overload.

inline Font &getDefaultFont()#

The UIRenderer has a built-in default pvr::ui::Font that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

A pvr::ui::Font object of the default font.

inline const Image &getSdkLogo() const#

The UIRenderer has a built-in pvr::ui::Image of the PowerVR SDK logo that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

The PowerVR SDK pvr::ui::Image. Constant overload.

inline Image &getSdkLogo()#

The UIRenderer has a built-in pvr::ui::Image of the PowerVR SDK logo that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

The PowerVR SDK pvr::ui::Image.

inline const Text &getDefaultTitle() const#

The UIRenderer has a built-in pvr::ui::Text positioned and sized for used as a title (top-left, large) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default title pvr::ui::Text. Originally empty (use setText on it). Constant overload.

inline Text &getDefaultTitle()#

The UIRenderer has a built-in pvr::ui::Text positioned and sized for used as a title (top-left, large) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default title pvr::ui::Text. Originally empty (use setText on it).

inline const Text &getDefaultDescription() const#

The UIRenderer has a built-in pvr::ui::Text positioned and sized for use as a description (subtitle) (top-left, below DefaultTitle, small)) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default descritption pvr::ui::Text. Originally empty (use setText on it). Constant overload.

inline Text &getDefaultDescription()#

The UIRenderer has a built-in pvr::ui::Text positioned and sized for used as a description (subtitle (top-left, below DefaultTitle, small)) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default descritption pvr::ui::Text. Originally empty (use setText on it).

inline const Text &getDefaultControls() const#

The UIRenderer has a built-in pvr::ui::Text positioned and sized for use as a controls display (bottom-left, small text) for convenience. You can set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default Controls pvr::ui::Text. Originally empty (use setText on it). Constant overload.

inline Text &getDefaultControls()#

The UIRenderer has a built-in pvr::ui::Text positioned and sized for use as a controls display (bottom-left, small text) for convenience. You can set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default Controls pvr::ui::Text. Originally empty (use setText on it).

inline glm::mat4 getProjection() const#

Returns the projection matrix.

Returns:

The UIRenderer projection matrix

inline void rotateScreen90degreeCCW()#

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const api::DescriptorSetLayout&

inline void rotateScreen90degreeCW()#

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const api::DescriptorSetLayout&

inline glm::mat4 getScreenRotation() const#

Return the default DescriptorSetLayout. ONLY to be used by the Sprites.

Returns:

const api::DescriptorSetLayout&

inline GLStateTracker getStateTracker() const#

Return the state tracker used by the ui renderer for tracking changed states.

Returns:

pvr::ui::GLStateTracker

inline Api getApiVersion()#

Return the OpenGL ES version assumed by the UIRenderer (the bound context version from when it was created)

Returns:

The API version assumed by the UIRenderer.

inline const pvrvk::Buffer &getFontIbo()

Retrieves the Font index buffer.

Returns:

The pvrvk::Buffer corresponding to the Font index buffer.

inline const pvrvk::Buffer &getImageVbo()

Retrieves the Image vertex buffer.

Returns:

The pvrvk::Buffer corresponding to the Image vertex buffer.

inline UIRenderer()

Constructor. Does not produce a ready-to-use object, use the init function before use.

inline UIRenderer(UIRenderer &&rhs)

Move Constructor. Does not produce a ready-to-use object, use the init function before use.

Parameters:

rhs – Another UIRenderer to initiialise from.

inline UIRenderer &operator=(UIRenderer &&rhs)

Assignment Operator overload. Does not produce a ready-to-use object, use the init function before use.

Parameters:

rhs – Another UIRenderer to initiialise from.

Returns:

this object (allow chaining commands with ->)

inline pvrvk::DeviceWeakPtr &getDevice()#

Return thedevice the UIRenderer was initialized with. If the UIrenderer was not initialized, behaviour is undefined.

Returns:

The pvrvk::Device which was used to initialise the UIRenderer.

inline const pvrvk::DeviceWeakPtr &getDevice() const#

Return the device the UIRenderer was initialized with. If the UIrenderer was not initialized, behaviour is undefined.

Returns:

The pvrvk::Device which was used to initialise the UIRenderer.

inline const ProgramData &getProgramData()

Returns the ProgramData used by this UIRenderer.

Returns:

The ProgramData structure used by the UIRenderer.

inline pvrvk::GraphicsPipeline getPipeline()#

Returns the GraphicsPipeline object used by this UIRenderer.

Returns:

The graphics pipeline being used by the UIRenderer.

inline pvr::utils::vma::Allocator &getMemoryAllocator()#

Returns the VMA allocator object used by this UIRenderer.

Returns:

The VMA allocator being used by the UIRenderer.

inline const pvr::utils::vma::Allocator &getMemoryAllocator() const#

Returns the VMA allocator object used by this UIRenderer.

Returns:

The VMA allocator being used by the UIRenderer.

inline bool isRendering()#

Check that we have called beginRendering() and not called endRendering. See the beginRendering() method.

Returns:

True if the command buffer is currently recording.

void init(uint32_t width, uint32_t height, bool fullscreen, const pvrvk::RenderPass &renderpass, uint32_t subpass, bool isFrameBufferSrgb, pvrvk::CommandPool &commandPool, pvrvk::Queue &queue, bool createDefaultLogo = true, bool createDefaultTitle = true, bool createDefaultFont = true, uint32_t maxNumInstances = 64, uint32_t maxNumSprites = 64)#

Initialize the UIRenderer with a graphics context. MUST BE called exactly once before use, after a valid graphics context is available (usually, during initView). Initialising creates its Default Text Font and PowerVR SDK logo. Therefore the calle must handle the texture uploads via assetLoader.

Parameters:
  • width – The width of the screen used for rendering.

  • height – The height of the screen used for rendering

  • fullscreen – Indicates whether the rendering is occuring in full screen mode.

  • renderpass – A renderpass to use for this UIRenderer

  • subpass – The subpass to use for this UIRenderer

  • isFrameBufferSrgb – Specifies whether the render target is sRGB format. If not then a gamma correction is performed

  • commandPool – The pvrvk::CommandPool object to use for allocating command buffers

  • queue – The pvrvk::Queue object to use for submitting command buffers

  • createDefaultLogo – Specifies whether a default logo should be initialised

  • createDefaultTitle – Specifies whether a default title should be initialised

  • createDefaultFont – Specifies whether a default font should be initialised

  • maxNumInstances – maximum number of sprite instances to be allocated from this uirenderer. it must be atleast maxNumSprites becasue each sprites is an instance on its own.

  • maxNumSprites – maximum number of renderable sprites (Text and Images) to be allocated from this uirenderer

void init(uint32_t width, uint32_t height, bool fullscreen, const pvrvk::RenderPass &renderpass, uint32_t subpass, bool isFrameBufferSrgb, pvrvk::CommandPool &commandPool, pvrvk::Queue &queue, const pvrvk::ImageView &fontView, const pvr::TextureHeader &textureHeader, const pvrvk::Sampler &fontSampler = pvrvk::Sampler(), bool createDefaultLogo = true, bool createDefaultTitle = true, uint32_t maxNumInstances = 64, uint32_t maxNumSprites = 64)#

Initialize the UIRenderer with a graphics context. MUST BE called exactly once before use, after a valid graphics context is available (usually, during initView). Allows the user to override the default dont easily.

Parameters:
  • width – The width of the screen used for rendering.

  • height – The height of the screen used for rendering

  • fullscreen – Indicates whether the rendering is occuring in full screen mode.

  • renderpass – A renderpass to use for this UIRenderer

  • subpass – The subpass to use for this UIRenderer

  • isFrameBufferSrgb – Specifies whether the render target is sRGB format. If not then a gamma correction is performed

  • commandPool – The pvrvk::CommandPool object to use for allocating command buffers

  • queue – The pvrvk::Queue object to use for submitting command buffers

  • fontView – Valid Image view for the default font’s texture atlas

  • fontView – The texture header in a pvr style format

  • fontSampler – Valid sampler for the default font

  • createDefaultLogo – Specifies whether a default logo should be initialised

  • createDefaultTitle – Specifies whether a default title should be initialised

  • maxNumInstances – maximum number of sprite instances to be allocated from this uirenderer. it must be atleast maxNumSprites becasue each sprites is an instance on its own.

  • maxNumSprites – maximum number of renderable sprites (Text and Images) to be allocated from this uirenderer

inline ~UIRenderer()

Destructor for the UIRenderer which will release all resources currently in use.

inline TextElement createTextElement(const std::string &text, uint32_t maxLength)#

Create a Text sprite. Initialize with std::string. Uses default font.

Parameters:
  • text – std::string object that this Text object will be initialized with

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

TextElement createTextElement(const std::string &text, const Font &font, uint32_t maxLength)#

Create Text sprite from std::string.

Parameters:
  • text – String object that this Text object will be initialized with

  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline TextElement createTextElement(const Font &font, uint32_t maxLength)#

Create a Text Element sprite from a pvr::ui::Font. A default string will be used.

Parameters:
  • font – The font that the text element will be using. The font must belong to the same UIrenderer object.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline TextElement createTextElement(const std::wstring &text, uint32_t maxLength)#

Create Text sprite from wide std::wstring. Uses the Default Font.

Parameters:
  • text – Wide std::string that this Text object will be initialized with. Will use the Default Font.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

TextElement createTextElement(const std::wstring &text, const Font &font, uint32_t maxLength)#

Create Text sprite from wide std::string.

Parameters:
  • text – text to be rendered.

  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

Text createText(const TextElement &textElement)

Create a Text sprite from a TextElement.

Parameters:

textElement – text element to initialise a Text framework object from.

Returns:

Text framework object

inline Text createText(uint32_t maxLength = 255)#

Create an empty Text sprite. Initialize with std::string. Uses default font.

Parameters:

maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline Text createText(const std::string &text, uint32_t maxLength = 0)#

Create a Text sprite. Initialize with std::string. Uses default font.

Parameters:
  • text – std::string object that this Text object will be initialized with

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline Text createText(const Font &font, const std::string &text, uint32_t maxLength = 0)#

Create Text sprite from std::string.

Parameters:
  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

  • text – String object that this Text object will be initialized with

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline Text createText(const Font &font, uint32_t maxLength = 255)#

Create Text sprite from std::string.

Parameters:
  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline Text createText(const std::wstring &text, uint32_t maxLength = 0)#

Create Text sprite from wide std::string. Uses the Default Font.

Parameters:
  • text – Wide std::string that this Text object will be initialized with. Will use the Default Font.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline Text createText(const Font &font, const std::wstring &text)#

Create Text sprite from wide std::string.

Parameters:
  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

  • text – text to be rendered.

Returns:

Text framework object.

inline Text createText(const Font &font, const std::wstring &text, uint32_t maxLength = 0)#

Create Text sprite from wide std::string.

Parameters:
  • font – The font that the text will be using. The font must belong to the same UIrenderer object.

  • text – text to be rendered.

  • maxLength – The maximum length of characters for the text element.

Returns:

Text framework object.

inline float getRenderingDimX() const

Get the X dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Width.

Returns:

Render width of the rectangle the UIRenderer is using for rendering.

inline float getRenderingDimY() const

Get the Y dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Height.

Returns:

Render height of the rectangle the UIRenderer is using for rendering.

inline glm::vec2 getRenderingDim() const

Get the rendering dimensions of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Width and Screen Height.

Returns:

Render width and height of the rectangle the UIRenderer is using for rendering.

inline pvrvk::Rect2D getViewport() const

Get the viewport of the rectangle the UIRenderer is rendering to. Initial value is the Screen Width and Screen Height.

Returns:

Viewport width and height of the rectangle the UIRenderer is using for rendering.

inline void setRenderingDimX(float value)

Set the X dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Width.

Parameters:

value – The new rendering width.

inline void setRenderingDimY(float value)

Set the Y dimension of the rectangle the UIRenderer is rendering to in order to scale UI elements. Initial value is the Screen Height.

Parameters:

value – The new rendering height.

Font createFont(const pvrvk::ImageView &image, const TextureHeader &textureHeader, const pvrvk::Sampler &sampler = pvrvk::Sampler())#

Create a font from a given texture (use PVRTexTool to create the font texture from a font file).

Use PVRTexTool to create textures suitable for Font use. You can then use any of the createFont function overloads to create a pvr::ui::Font object to render your sprites. This overload requires that you have already created a Texture2D object from the file and is suitable for sharing a texture between different UIRenderer objects.

Parameters:
  • image – An ImageView object of the font texture file, which will be used directly.

  • textureHeader – A pvr::TextureHeader of the same object. Necessary for the texture metadata.

  • sampler – (Optional) A specific sampler object to use for this font.

Returns:

A new Font object. Null object if failed.

Image createImage(const pvrvk::ImageView &image, const pvrvk::Sampler &sampler = pvrvk::Sampler())#

Create a pvr::ui::Image from a pvrvk::ImageView image. NOTE: Creating new image requires re-recording the commandbuffer.

Parameters:
  • image – A TextureView object of the texture file. Must be 2D. It will be used directly.

  • sampler – (Optional) A specific sampler object to use for this font.

Returns:

A new Image object of the specified texture. Null object if failed.

Image createImageFromAtlas(const pvrvk::ImageView &image, const pvrvk::Rect2Df &uv, const pvrvk::Sampler &sampler = pvrvk::Sampler())#

Create a pvr::ui::Image from a Texture Atlas asset. NOTE: Creating new image requires re-recording the commandbuffer.

Parameters:
  • image – A pvrvk::ImageView object. Will be internally used to create an pvrvk::Texture2D to use.

  • uv – Texture UV coordinate

  • sampler – A sampler used for this Image (Optional)

Returns:

A new Image object of the specified texture. Null object if failed.

MatrixGroup createMatrixGroup()

Create a pvr::ui::MatrixGroup.

Returns:

A new Group to display different sprites together. Null object if failed.

PixelGroup createPixelGroup()

Create a pvr::ui::PixelGroup.

Returns:

A new Group to display different sprites together. Null object if failed.

inline void beginRendering(pvrvk::SecondaryCommandBuffer &commandBuffer)#

Begin rendering to a specific CommandBuffer. Must be called to render sprites. DO NOT update sprites after calling this function before calling endRendering.

THIS METHOD OR ITS OVERLOAD MUST BE CALLED BEFORE RENDERING ANY SPRITES THAT BELONG TO A SPECIFIC UIRenderer. The sequence must always be beginRendering, render …, endRendering. Always try to group as many rendering commands as possible between begin and end, to avoid needless state changes.

Parameters:

commandBuffer – The SecondaryCommandBuffer object where all the rendering commands will be put into.

inline void beginRendering(pvrvk::SecondaryCommandBuffer &commandBuffer, const pvrvk::Framebuffer &framebuffer, bool useRenderPass = false)#

Begin rendering to a specific CommandBuffer, using a specific Framebuffer and optionally a renderpass. Must be called to render sprites. DO NOT update sprites after calling this function before calling endRendering.

THIS METHOD OR ITS OVERLOAD MUST BE CALLED BEFORE RENDERING ANY SPRITES THAT BELONG TO A SPECIFIC UIRenderer. The sequence must always be beginRendering, render …, endRendering. Always try to group as many rendering commands as possible between begin and end, to avoid needless state changes.

Parameters:
  • commandBuffer – The SecondaryCommandBuffer object where all the rendering commands will be put into.

  • framebuffer – A framebuffer object which will be used to begin the command buffer.

  • useRenderPass – Specifies whether a RenderPass should be used to begin the command buffer.

inline void beginRendering(pvrvk::CommandBuffer &commandBuffer)#

Begin rendering to a specific CommandBuffer. Must be called to render sprites. DO NOT update sprites after calling this function before calling endRendering.

THIS METHOD OR ITS OVERLOAD MUST BE CALLED BEFORE RENDERING ANY SPRITES THAT BELONG TO A SPECIFIC UIRenderer. The sequence must always be beginRendering, render …, endRendering. Always try to group as many rendering commands as possible between begin and end, to avoid needless state changes.

Parameters:

commandBuffer – The CommandBuffer object where all the rendering commands will be put into.

inline void beginRendering(pvrvk::SecondaryCommandBuffer commandBuffer, pvrvk::GraphicsPipeline &pipe)#

Begin rendering to a specific CommandBuffer, with a custom user-provided GraphicsPipeline.

THIS METHOD OR ITS OVERLOAD MUST BE CALLED BEFORE RENDERING ANY SPRITES THAT BELONG TO A SPECIFIC UIRenderer. The sequence must always be beginRendering, render …, endRendering. Always try to group as many rendering commands as possible between beginRendering and endRendering, to avoid needless state changes. Use this overload to render with a custom GraphicsPipeline.

Parameters:
  • commandBuffer – The SecondaryCommandBuffer object where all the rendering commands will be put into.

  • pipe – The GraphicsPipeline to use for rendering.

inline void beginRendering(pvrvk::SecondaryCommandBuffer commandBuffer, pvrvk::GraphicsPipeline &pipe, const pvrvk::Framebuffer &framebuffer, bool useRenderPass = false)#

Begin rendering to a specific CommandBuffer, with a custom user-provided GraphicsPipeline.

THIS METHOD OR ITS OVERLOAD MUST BE CALLED BEFORE RENDERING ANY SPRITES THAT BELONG TO A SPECIFIC UIRenderer. The sequence must always be beginRendering, render …, endRendering. Always try to group as many rendering commands as possible between beginRendering and endRendering, to avoid needless state changes. Use this overload to render with a custom GraphicsPipeline.

Parameters:
  • commandBuffer – The SecondaryCommandBuffer object where all the rendering commands will be put into.

  • pipe – The GraphicsPipeline to use for rendering.

  • framebuffer – A framebuffer object which will be used to begin the command buffer.

  • useRenderPass – Specifies whether a RenderPass should be used to begin the command buffer.

inline void beginRendering(pvrvk::CommandBuffer commandBuffer, pvrvk::GraphicsPipeline &pipe)#

Begin rendering to a specific CommandBuffer, with a custom user-provided GraphicsPipeline.

THIS METHOD OR ITS OVERLOAD MUST BE CALLED BEFORE RENDERING ANY SPRITES THAT BELONG TO A SPECIFIC UIRenderer. The sequence must always be beginRendering, render …, endRendering. Always try to group as many rendering commands as possible between beginRendering and endRendering, to avoid needless state changes. Use this overload to render with a custom GraphicsPipeline.

Parameters:
  • commandBuffer – The CommandBuffer object where all the rendering commands will be put into.

  • pipe – The GraphicsPipeline to use for rendering.

inline void endRendering()

End rendering. Always call this method before submitting the commandBuffer passed to the UIRenderer.

This method must be called after you finish rendering sprites (after a call to beginRendering). The sequence must always be beginRendering, render …, endRendering. Try to group as many of the rendering commands (preferably all) between beginRendering and endRendering.

inline pvrvk::CommandBufferBase &getActiveCommandBuffer()#

Get the CommandBuffer that is being used to currently render.

Returns:

If between a beginRendering and endRendering, the CommandBuffer used at beginRendering. Otherwise, null.

inline const Font &getDefaultFont() const

The UIRenderer has a built-in default pvr::ui::Font that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

The default font. Constant overload.

inline Font &getDefaultFont()

The UIRenderer has a built-in default pvr::ui::Font that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

A pvr::ui::Font object of the default font.

inline const Image &getSdkLogo() const

The UIRenderer has a built-in pvr::ui::Image of the PowerVR SDK logo that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

The PowerVR SDK pvr::ui::Image. Constant overload.

inline Image &getSdkLogo()

The UIRenderer has a built-in pvr::ui::Image of the PowerVR SDK logo that can always be used when the UIRenderer is initialized. Used throughout the PowerVR SDK Examples.

Returns:

The PowerVR SDK pvr::ui::Image.

inline const Text &getDefaultTitle() const

The UIRenderer has a built-in pvr::ui::Text positioned and sized for used as a title (top-left, large) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default title pvr::ui::Text. Originally empty (use setText on it). Constant overload.

inline Text &getDefaultTitle()

The UIRenderer has a built-in pvr::ui::Text positioned and sized for used as a title (top-left, large) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default title pvr::ui::Text. Originally empty (use setText on it).

inline const Text &getDefaultDescription() const

The UIRenderer has a built-in pvr::ui::Text positioned and sized for use as a description (subtitle) (top-left, below DefaultTitle, small)) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default descritption pvr::ui::Text. Originally empty (use setText on it). Constant overload.

inline Text &getDefaultDescription()

The UIRenderer has a built-in pvr::ui::Text positioned and sized for used as a description (subtitle (top-left, below DefaultTitle, small)) for convenience. Set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default descritption pvr::ui::Text. Originally empty (use setText on it).

inline const Text &getDefaultControls() const

The UIRenderer has a built-in pvr::ui::Text positioned and sized for use as a controls display (bottom-left, small text) for convenience. You can set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default Controls pvr::ui::Text. Originally empty (use setText on it). Constant overload.

inline Text &getDefaultControls()

The UIRenderer has a built-in pvr::ui::Text positioned and sized for use as a controls display (bottom-left, small text) for convenience. You can set the text of this sprite and use it as normal. Can be resized and repositioned at will. Used throughout the PowerVR SDK Examples.

Returns:

The Default Controls pvr::ui::Text. Originally empty (use setText on it).

inline pvrvk::PipelineLayout getPipelineLayout()#

Return the PipelineLayout object of the internal Pipeline object used by this UIRenderer.

Returns:

The PipelineLayout.

inline glm::mat4 getProjection() const

Returns the projection matrix.

Returns:

The UIRenderer projection matrix

inline void rotateScreen90degreeCCW()

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const pvrvk::DescriptorSetLayout&

inline void rotateScreen90degreeCW()

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const pvrvk::DescriptorSetLayout&

inline glm::mat4 getScreenRotation() const

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const pvrvk::DescriptorSetLayout&

inline const pvrvk::DescriptorSetLayout &getTexDescriptorSetLayout() const#

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const pvrvk::DescriptorSetLayout&

inline const pvrvk::DescriptorSetLayout &getUboDescSetLayout() const#

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const pvrvk::DescriptorSetLayout&

inline uint32_t getMaxRenderableSprites() const#

Returns maximum renderable sprites (Text and Images)

Returns:

The maximum number of renderable sprites

inline uint32_t getMaxInstances() const#

Return maximum number of instances supported (including sprites and groups)

Returns:

The maximum number of instances

inline uint32_t getNumAvailableSprites() const#

return the number of available renderable sprites (Image and Text)

Returns:

The number of remaining sprite slots

inline uint32_t getNumAvailableInstances() const#

return the number of availble instance

Returns:

The number of remaining instance slots

inline pvrvk::DescriptorPool &getDescriptorPool()#

return the default DescriptorSetLayout. ONLY to be used by the Sprites

Returns:

const pvrvk::DescriptorSetLayout&

inline pvrvk::Sampler &getSamplerBilinear()#

Return the bilinear sampler used by the UIRenderer.

Returns:

The bilinear sampler used by the UIRenderer

inline pvrvk::Sampler &getSamplerTrilinear()#

Return the trilinear sampler used by the UIRenderer.

Returns:

The trilinear sampler used by the UIRenderer

Friends

friend class ::pvr::ui::impl::Image_
friend class ::pvr::ui::impl::Text_
friend class ::pvr::ui::impl::Group_
friend class ::pvr::ui::impl::Sprite_
friend class ::pvr::ui::impl::Font_
friend class ::pvr::ui::impl::TextElement_
friend class ::pvr::ui::impl::MatrixGroup_
friend class pvr::ui::impl::Image_
friend class pvr::ui::impl::Text_
friend class pvr::ui::impl::Group_
friend class pvr::ui::impl::Sprite_
friend class pvr::ui::impl::Font_
struct ProgramData#

Information used for uploading required info to the shaders (matrices, attributes etc).

Public Types

enum Uniform#

Uniform index information.

Values:

enumerator UniformMVPmtx#
enumerator UniformFontTexture#
enumerator UniformColor#
enumerator UniformAlphaMode#
enumerator UniformUVmtx#
enumerator NumUniform#
enumerator UniformMVPmtx
enumerator UniformFontTexture
enumerator UniformColor
enumerator UniformAlphaMode
enumerator UniformUVmtx
enumerator NumUniform
enum Attribute#

Attribute index information.

Values:

enumerator AttributeVertex#
enumerator AttributeUV#
enumerator NumAttribute#
enumerator AttributeVertex
enumerator AttributeUV
enumerator NumAttribute
enum Uniform

Uniform index information.

Values:

enumerator UniformMVPmtx
enumerator UniformFontTexture
enumerator UniformColor
enumerator UniformAlphaMode
enumerator UniformUVmtx
enumerator NumUniform
enumerator UniformMVPmtx
enumerator UniformFontTexture
enumerator UniformColor
enumerator UniformAlphaMode
enumerator UniformUVmtx
enumerator NumUniform
enum Attribute

Attribute index information.

Values:

enumerator AttributeVertex
enumerator AttributeUV
enumerator NumAttribute
enumerator AttributeVertex
enumerator AttributeUV
enumerator NumAttribute

Public Members

int32_t uniforms[NumUniform]#

An array of uniforms used by the UIRenderer.

int32_t attributes[NumAttribute]#

An array of attributes used by the UIRenderer.

UIRendererError#

Inheritance Relationships#

Base Type#

  • public std::runtime_error

Derived Type#

Class Documentation#

class UIRendererError : public std::runtime_error#

A simple std::runtime_error wrapper for UIRenderer error codes.

Subclassed by pvr::ui::UIRendererInstanceMaxError

Public Functions

inline explicit UIRendererError(const std::string &error)#

Constructor.

Parameters:

error – The error message to log.

UIRendererInstanceMaxError#

Inheritance Relationships#

Base Type#

Class Documentation#

class UIRendererInstanceMaxError : public pvr::ui::UIRendererError#

A simple extension of a UIRendererError used to throwing errors due to reaching the maximum number of instances supported by a UIRenderer.

Public Functions

inline explicit UIRendererInstanceMaxError(const std::string &error)#

Constructor.

Parameters:

error – The error message to log.

Allocation_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public pvrvk::impl::IDeviceMemory_

Class Documentation#

class Allocation_ : public pvrvk::impl::IDeviceMemory_#

The DeviceMemoryWrapper_. Class Just wraps the Vulkan device memory object allocated by the memory allocatpr. This class doesn’t manages the creation and destruction of vulkan object. It only serves as the interface to device memory functions.

Public Functions

inline bool isMappable() const#

Return true if this memory block is mappable by the host (const).

Returns:

True is this memory block can be mapped, otherwise false.

inline pvrvk::MemoryPropertyFlags getMemoryFlags() const#

Return the memory flags(const)

Returns:

pvrvk::MemoryPropertyFlags

inline uint32_t getMemoryType() const#

Return the memory type.

Returns:

The memory type of the pvrvk::Allocation

void *map(VkDeviceSize offset = 0, VkDeviceSize size = VK_WHOLE_SIZE, pvrvk::MemoryMapFlags memoryMapFlags = pvrvk::MemoryMapFlags::e_NONE)#

Map the memory allocation. Also you can directly call map on the device memory on you own if you want But using this function makes sures correct offset and size is always specified. Therefore map and unmap of this object is recommended. Do not use it on memory allocated with AllocationCreateFlags::e_PERSISTENT_MAP_BIT as multiple maps to same DeviceMemory is illegal.

Parameters:
  • offset – The offset into the device memory to map

  • size – The size of the returned mapped data

  • memoryMapFlags – Memory mapping flags specifying how the mappng will take place

Returns:

Returned mapped data

void unmap()#

Function unmaps the memory previously mapped by the mapMemory function.

inline bool isMapped() const#

Return true if this memory is being mapped by the host (const)

Returns:

VkDeviceSize</returns

inline pvrvk::DeviceSize getOffset() const#

Get offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation.

Returns:

Returns device offset

inline void flushRange(pvrvk::DeviceSize offset = 0, pvrvk::DeviceSize size = VK_WHOLE_SIZE)#

Flush ranges of non-coherent memory from the host caches.

Parameters:
  • offset – The offset into the device memory to map

  • size – The size of the returned mapped data

void *getMappedData()#

Returns a pointer to the beginning of this allocation as mapped data.

Null if this allocation is not persistently mapped. It can change after call to unmapPersistentlyMappedMemory(), mapPersistentlyMappedMemory() from the memory allocator. Also it can change after call to defragment() if this allocation is passed to the function.

Returns:

Returns the mapped data

inline void *getUserData()#

Get the user data.

Returns:

Returns the user data

void setUserData(void *userData)#

Sets userData of this allocation to new value.

Parameters:

userData – The new data to srt

bool isAllocationLost() const#

Check if this allocation is lost. Allocation created with AllocationCreateFlags::e_CAN_BECOME_LOST_BIT flag can become lost as a result of another allocation with AllocationCreateFlags::e_CAN_MAKE_OTHER_LOST_BIT flag, so you must check it before use.

Returns:

Returns true if the allocation is lost.

inline AllocationCreateFlags getCreateFlags() const#

Get this allocation create flags.

Returns:

The allocation creation flags.

inline bool canBecomeLost() const#

Check if this allocation can become lost.

Returns:

Returns true if this allocation can become lost

inline VkDeviceSize getMappedOffset() const#

Return this mapped memory offset (const)

Returns:

The offset into the device memory which has been mapped

inline VkDeviceSize getMappedSize() const#

Return this mapped memory size (const)

Returns:

The size of the mapped memory

inline VkDeviceSize getSize() const#

Return this memory size (const)

Returns:

The size of the device memory

inline Pool getMemoryPool()#

Return this memory pool.

Returns:

The memory pool

inline void invalidateRange(VkDeviceSize offset = 0, VkDeviceSize size = VK_WHOLE_SIZE)#

Invalidates ranges of non-coherent memory from the host caches.

Parameters:
  • offset – The offset into the device memory to map

  • size – The size of the returned mapped data

Friends

friend class pvr::utils::vma::impl::Allocator_

Allocation_::make_shared_enabler#

Nested Relationships#

This class is a nested type of Allocation_.

Class Documentation#

class make_shared_enabler#

Allocator_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public std::enable_shared_from_this< Allocator_ >

Class Documentation#

class Allocator_ : public std::enable_shared_from_this<Allocator_>#

The MemoryAllocator_ class./summary>

Public Functions

void addCallbackDispatcherContext()#

Adds a callback dispatcher.

Allocation allocateMemoryForImage(pvrvk::Image &image, const AllocationCreateInfo &allocCreateInfo)#

Allocate memory for an image.

Parameters:
  • image – The image to allocate memeory for

  • allocCreateInfo – Allocation create info

Returns:

Returns the successfull memory allocation.

Allocation allocateMemoryForBuffer(pvrvk::Buffer &buffer, const AllocationCreateInfo &createInfo)#

Allocate memory for buffer. NOTE: It is the calle’s responsibility of the allocation’s lifetime.

Parameters:
  • buffer – The buffer the allocation is for

  • createInfo – allocation create info

Returns:

A successfully allocated allocation

Allocation allocateMemory(const pvrvk::MemoryRequirements *vkMemoryRequirements, const AllocationCreateInfo &createInfo)#

Alloocate memory. Note: It is users resposibility to keep the lifetime of the allocation returned from this function call.

Parameters:
  • vkMemoryRequirements – Memory requirement

  • createInfo – Allcoation create info

Returns:

The successfull allocation.

inline Pool createPool(const PoolCreateInfo &poolCreateInfo)#

Create memory pool object.

Creates a Pool.

Parameters:
  • poolCreateInfo – Pool allcoation create info

  • poolCreateInfo – Specifies how the created pool will be created

Returns:

The successfully created Pool object.

Returns:

The created Memory Pool.

void findMemoryTypeIndex(uint32_t memoryTypeBits, const AllocationCreateInfo &allocationCreateInfo, uint32_t &outMemoryTypeIndex)#

Finds the memory type index for a particular allocation.

Parameters:
  • memoryTypeBits – The set of bits required for a successfull allocation

  • allocationCreateInfo – Allocation creation info which will contaol the way in which the allocation will be used

  • outMemoryTypeIndex – The returned memory type index

pvrvk::Buffer createBuffer(const pvrvk::BufferCreateInfo &createInfo, const AllocationCreateInfo &allocationCreateInfo)#

Create buffer with memory allocation.

Parameters:
  • createInfo – Buffer creation information

  • allocationCreateInfo – Allocation creation info which will control the way in which the allocation will be used

Returns:

The successfully created buffer.

pvrvk::Image createImage(const pvrvk::ImageCreateInfo &createInfo, const AllocationCreateInfo &allocationCreateInfo)#

Create image with memory allocation.

Parameters:
  • createInfo – Image creation information

  • allocationCreateInfo – Allocation creation info which will control the way in which the allocation will be used

Returns:

The successfully created image.

void defragment(Allocation *memAllocations, uint32_t numAllocations, const VmaDefragmentationInfo *defragInfo, pvrvk::Bool32 *outAllocationsChanged, DefragmentationStats *outDefragStatus)#

Defragment the memory allocations. This function can move allocaion to compact used memory, ensure more continuous free space and possibly also free some DeviceMemory. It can work only on allocations made from memory type that is HOST_VISIBLE. Allocations are modified to point to the new DeviceMemory and offset. Data in this memory is also memmove-ed to the new place. However, if you have images or buffers bound to these allocations, you need to destroy, recreate, and bind them to the new place in memory.

Parameters:
  • memAllocations – A pointer to a set of device memory allocations to defragment

  • numAllocations – The number of device memory allocations pointed to by memAllocations

  • defragInfo – VmaDefragmentationInfo controlling the defragment operation

  • outAllocationsChanged – An array of boolean values specifying whether the corresponding memory allocation in the array pointed to by memAllocations has been defragmented

  • outDefragStatus – A set of DefragmentationStats

inline pvrvk::DeviceWeakPtr getDevice()#

Getter for the allocator’s device.

Returns:

The device.

inline std::string buildStatsString(bool detailedMap)#

Create and returns and memory statistics map.

Parameters:

detailedMap – Specifies whether a defailed statistics map should be created

Returns:

The statistics map.

inline Stats calculateStats() const#

Create and returns and memory statistics.

Returns:

The statistics map.

Allocator_::make_shared_enabler#

Nested Relationships#

This class is a nested type of Allocator_.

Class Documentation#

class make_shared_enabler#

Public Functions

inline make_shared_enabler()#

Friends

friend class Allocator_

DeviceMemoryWrapper_#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public pvrvk::impl::DeviceMemory_

Class Documentation#

class DeviceMemoryWrapper_ : public pvrvk::impl::DeviceMemory_#

A wrapper for device memory.

DeviceMemoryWrapper_::make_shared_enabler#

Nested Relationships#

This class is a nested type of DeviceMemoryWrapper_.

Inheritance Relationships#

Base Type#

  • public DeviceMemory_::make_shared_enabler

Class Documentation#

class make_shared_enabler : public DeviceMemory_::make_shared_enabler#

Protected Functions

inline make_shared_enabler()#

Friends

friend class DeviceMemoryWrapper_

Pool_#

Nested Relationships#

Nested Types#

Class Documentation#

class Pool_#

An embedded ref counted Pool class.

Public Functions

PoolStats getStats() const#

Get pool stats.

Returns:

Returns pool stats

size_t makeAllocationsLost()#

Mark all allocations from this pool lost as if they are not used in current frame or VmaPoolCreateInfo::frameInUseCount back from now.

Returns:

Returns number of allocations marked as lost.

Friends

friend class pvr::utils::vma::impl::Allocator_

Pool_::make_shared_enabler#

Nested Relationships#

This class is a nested type of Pool_.

Class Documentation#

class make_shared_enabler#

Public Functions

inline make_shared_enabler()#

Friends

friend class Pool_

AccelerationStructureWrapper#

Class Documentation#

class AccelerationStructureWrapper#

A wrapper for an acceleration structure for the Vulkan Khronos Ray Tracing extension.

Public Functions

inline explicit AccelerationStructureWrapper()#

Constructor.

void buildASModelDescription(std::vector<pvrvk::Buffer> vertexBuffers, std::vector<pvrvk::Buffer> indexBuffers, std::vector<int> verticesSize, std::vector<int> indicesSize, const std::vector<glm::mat4> &vectorInstanceTransform)#

Fills the member variables _rtModelInfos, _instances and _sceneDescriptions used for the top level and bottom level acceleration structures needed.

Parameters:
  • vertexBuffers – Array with a vertex buffer for each scene model.

  • indexBuffers – Array with an index buffer for each scene model.

  • verticesSize – Array with the amount of vertices of the geometry for this scene model.

  • indicesSize – Array with the amount of indices of the geometry for this scene model.

  • vectorInstanceTransform – Array with the transforms of each TLAS node, information will be stored in _instances and _sceneDescriptions.

void clearASModelDescriptionData()#

Clear the information in _rtModelInfos, _instances and _sceneDescriptions filled in the call to buildASModelDescription once that information is no longer needed.

void buildAS(pvrvk::Device device, pvrvk::Queue queue, pvrvk::CommandBuffer commandBuffer, pvrvk::BuildAccelerationStructureFlagsKHR buildASFlags = pvrvk::BuildAccelerationStructureFlagsKHR::e_PREFER_FAST_TRACE_BIT_KHR)#

Build the acceleration structures _tlas and _blas (both the top and the bottom level ones).

Parameters:
  • device – Device to build this acceleration structure for.

  • queue – Queue to submit commands.

  • buildASFlags – Build options for the acceleration structure. NOTE: Some flags are not implemented yet like e_ALLOW_COMPACTION_BIT_KHR, currently intended use is e_PREFER_FAST_TRACE_BIT_KHR.

  • commandBuffer – Command buffer to record commands submitted to the provided queue.

void buildBottomLevelASModels(pvrvk::Device device, pvrvk::CommandBuffer commandBuffer, pvrvk::Queue queue)#

Build a bottom level acceleration structure for each scene element.

Parameters:
  • device – Device to build the buffers for the bottom level scene elements being ray traced.

  • commandBuffer – Command buffer to record commands submitted to the provided queue.

  • queue – Queue to submit commands.

void buildTopLevelASAndInstances(pvrvk::Device device, pvrvk::CommandBuffer commandBuffer, pvrvk::Queue queue, pvrvk::BuildAccelerationStructureFlagsKHR flags, bool update)#

Build the top level acceleration structure and the instances used for ray tracing.

Parameters:
  • device – Device to build this top level acceration structure with.

  • commandBuffer – Command buffer to record commands submitted to the provided queue.

  • queue – Queue to submit commands.

  • flags – Flags for the acceleration struct to be built.

  • update – Flag to know whether to update or create the TLAS.

void setupGeometryInstances(pvrvk::Device device, std::vector<VkAccelerationStructureInstanceKHR> &geometryInstances)#

Helper function to convert information from elements in _instances to VkAccelerationStructureInstanceKHR equivalents.

Parameters:
  • device – Device needed for the buffer address for the instance.

  • geometryInstances – Vector where to store the VkAccelerationStructureInstanceKHR elements generated.

inline pvrvk::AccelerationStructure getTopLevelAccelerationStructure()#

Get the top level acceleration structure.

Returns:

The top level information about the instances in the scene for the scene descriptor buffer used.

inline std::vector<SceneDescription> &getSceneDescriptions()#

Get the top level information about the instances in the scene for the scene descriptor buffer used.

Returns:

The top level information about the instances in the scene for the scene descriptor buffer used.

inline std::vector<pvrvk::AccelerationStructure> &getBlas()#

Get the array with the bottom level acceleration structures.

Returns:

The array with the bottom level acceleration structures.

void updateInstanceTransformData(const std::vector<glm::mat4> &vectorTransform)#

Update the RTInstance::transform field of each element.

Parameters:

update – Vector with the transform data to update, has to match the size of AccelerationStructureWrapper::_instances.

ImageApiAsyncUploader#

Inheritance Relationships#

Base Type#

  • public async::AsyncScheduler< pvrvk::ImageView, ImageUploadFuture, imageUploadAsyncWorker >

Class Documentation#

class ImageApiAsyncUploader : public async::AsyncScheduler<pvrvk::ImageView, ImageUploadFuture, imageUploadAsyncWorker>#

This class wraps a worker thread that uploads texture to the GPU asynchronously and returns futures to them. This class would normally be used with Texture Futures as well, in order to do both of the operations asynchronously.

Public Types

typedef async::IFrameworkAsyncResult<pvrvk::ImageView>::Callback CallbackType#

The type of the optional callback that is called at the end of the operation.

Public Functions

inline ImageApiAsyncUploader()#
inline void init(pvrvk::Device &device, pvrvk::Queue &queue, async::Mutex *queueSemaphore = nullptr)#

Initialize this AsyncUploader. Do not use the queue and pool unguarded aftewards, as they will be accessed from an indeterminate thread at indeterminate times. It is ideal that the queue is only used by this Uploader, but if it is not, a (CPU) Semaphore must be passed to guard access to the queue.

Parameters:
  • device – A Vulkan _device that will be used to create the textures. A Command pool will be created on this device for the queue family of the queue

  • queue – A Vulkan command queue that will be used to upload the textures

  • queueSemaphore – Use the Semaphore as a mutex: Initial count 1, call wait() before all accesses to the Vulkan queue, then signal() when finished accessing. If the queue does not need external synchronization (i.e. it is only used by this object), leave the queueSemaphore at its default value of NULL

inline AsyncApiTexture uploadTextureAsync(const AsyncTexture &texture, bool allowDecompress = true, CallbackType callback = nullptr, bool callbackBeforeSignal = false)#

Begin a texture uploading task and return the future to the Vulkan Texture. Use the returned future to query completion and get the result. Takes asynchronous textures as input so that the loading and uploading tasks can be chained and done on different threads.

Parameters:
  • texture – A PVR Texture future (can be gotten from the Async Texture Loader or another async source)

  • allowDecompress – If the texture is compressed to an unsupported format, allow it to be decompressed to RGBA8 if a software decompressor is available. Default true

  • callback – An optional function pointer that will be invoked when the uploading is complete. IF you use the callback AND the you set the flag “callbackBeforeSignal” to TRUE, do NOT call the “get” function of the future in the callback. Default NULL.

  • callbackBeforeSignal – A flag signifying if the callback should be called BEFORE or AFTER the semaphore of the Result future (the Texture future) is signalled as complete. Defaults to false, so as to avoid the deadlock that will happen if the user attempts to call “get” on the future while the signal will happen just after return of the callback. Set to “true” if you want to do something WITHOUT calling “get” on the future, but before the texture is used.

Returns:

A texture upload Future which you can use to query or get the uploaded texture

ModelGles#

Nested Relationships#

Nested Types#

Class Documentation#

class ModelGles#

The ModelGles class provides the functionality for creating all of the buffers (vbos and ibos) and textures required for basic rendering of a pvr::assets::Model using OpenGL ES.

Public Types

enum class Flags#

Values:

enumerator None#
enumerator LoadMeshes#
enumerator LoadTextures#
enumerator GLES2Only#
enumerator loadASTCTextures#

Public Functions

inline pvr::assets::Model &getModel()#

Getter for the pvr::assets::Model used to create the ModelGles class.

Returns:

Returns the pvr::assets::Model which was used to create this ModelGles class.

inline pvr::assets::ModelHandle &getModelHandle()#

Getter for the pvr::assets::Model used to create the ModelGles class.

Returns:

Returns the pvr::assets::Model which was used to create this ModelGles class.

inline ModelGles()#

Default Constructor for a ModelGles class.

inline ~ModelGles()#

Destructor for a ModelGles class. The destructor deletes and frees the buffers and textures being used by the ModelGles class.

void init(pvr::IAssetProvider &assetProvider, pvr::assets::Model &inModel, Flags flags = (Flags)((int)Flags::LoadMeshes | (int)Flags::LoadTextures))#

Initialises the ModelGles class using a pvr::IAssetProvider and pvr::assets::Model.

Parameters:
  • assetProvider – A pvr::IAssetProvider used for loading assets from file.

  • inModel – A pvr::assets::Model which specifies the buffers and textures which are required for basic rendering of the Model.

  • isEs2 – The isEs2 flag affects whether only OpenGL ES 2.0 functionality is used or whether newer OpenGL ES 3+ functionality can be used.

void init(pvr::IAssetProvider &assetProvider, pvr::assets::ModelHandle &inModel, Flags flags = (Flags)((int)Flags::LoadMeshes | (int)Flags::LoadTextures))#

Initialises the ModelGles class using a pvr::IAssetProvider and pvr::assets::Model.

Parameters:
  • assetProvider – A pvr::IAssetProvider used for loading assets from file.

  • inModel – A pvr::assets::ModelHandle which specifies the buffers and textures which are required for basic rendering of the Model.

  • isEs2 – The isEs2 flag affects whether only OpenGL ES 2.0 functionality is used or whether newer OpenGL ES 3+ functionality can be used.

inline GLuint getApiTextureById(uint32_t texId)#

Getter for an OpenGL ES texture handle for a particular pvr::assets::Model texture index.

Parameters:

texId – The pvr::assets::Model texture index.

Returns:

Returns the OpenGL ES handle for the texture with id texId.

inline GLuint getApiTextureByNode(uint32_t nodeId, const pvr::StringHash &texSemantic)#

Getter for an OpenGL ES texture handle for a particular node of the pvr::assets::Model with the provided texture semantic.

Parameters:
  • nodeId – The node identifier into the pvr::assets::Model for which to retrieve the texture.

  • texSemantic – The texture semantic name for the pvr::assets::Model for which to retrieve the texture.

Returns:

Returns the OpenGL ES handle for the texture with name matching texSemantic for the node specified.

inline GLuint getApiTextureByMaterial(uint32_t materialId, const pvr::StringHash &texSemantic)#

Getter for an OpenGL ES texture handle for a particular material of the pvr::assets::Model with the provided texture semantic.

Parameters:
  • materialId – The material identifier into the pvr::assets::Model for which to retrieve the texture.

  • texSemantic – The texture semantic name for the pvr::assets::Model for which to retrieve the texture.

Returns:

Returns the OpenGL ES handle for the texture with name matching texSemantic for the material specified.

inline ApiMeshGles &getApiMeshById(uint32_t meshId)#

Getter for a particular ApiMeshGles structure which encapsulates buffers (vbos and ibos) for rendering the mesh.

Parameters:

meshId – The mesh identifier into the pvr::assets::Model for which to retrieve the ApiMeshGles.

Returns:

Returns the ApiMeshGles for the mesh specified.

inline ApiMeshGles &getApiMeshByNodeId(uint32_t nodeId)#

Getter for a particular ApiMeshGles structure which encapsulates buffers (vbos and ibos) for rendering the mesh.

Parameters:

nodeId – The node identifier into the pvr::assets::Model for which to retrieve the ApiMeshGles.

Returns:

Returns the ApiMeshGles for the node specified.

inline GLuint getVboByMeshId(uint32_t meshId, uint32_t vboId)#

Getter for a particular vertex buffer object for the specified mesh and vbo.

Parameters:
  • meshId – The mesh identifier into the pvr::assets::Model for which to retrieve the vertex buffer object for.

  • vboId – The specific vertex buffer object to retrieve for the mesh.

Returns:

Returns the vertex buffer object for the mesh specified at vboId index.

inline GLuint getIboByMeshId(uint32_t meshId)#

Getter for a particular index buffer object for the specified mesh.

Parameters:

meshId – The mesh identifier into the pvr::assets::Model for which to retrieve the index buffer object for.

Returns:

Returns the index buffer object for the mesh specified.

inline GLuint getVboByNodeId(uint32_t nodeId, uint32_t vboId)#

Getter for a particular vertex buffer object for the specified node and vbo.

Parameters:
  • nodeId – The node identifier into the pvr::assets::Model for which to retrieve the vertex buffer object for.

  • vboId – The specific vertex buffer object to retrieve for the node.

Returns:

Returns the vertex buffer object for the node specified at vboId index.

inline GLuint getIboByNodeId(uint32_t nodeId)#

Getter for a particular index buffer object for the specified node.

Parameters:

nodeId – The node identifier into the pvr::assets::Model for which to retrieve the index buffer object for.

Returns:

Returns the index buffer object for the node specified.

struct ApiMeshGles#

The ApiMeshGles structure handles the encapsulation of all buffers (vbos and ibos) for a particular mesh of a model.

Public Members

std::vector<GLuint> vbos#

A list of vertex buffer objects in use for the mesh.

GLuint ibo#

An index buffer objects in use for the mesh.

StructuredBufferView#

Class Documentation#

class StructuredBufferView#

A structured buffer view is a class that can be used to define an explicit structure to an object that is usually accessed as raw memory. For example, a GPU-side buffer is mapped to a void pointer, but a StructuredBufferView can be used to create a runtime structure for it, and set its entries one by one. Example usage for accessing a StructuredBufferView defined for the buffer bonesUbo defined below: struct Bone{ highp mat4 boneMatrix; highp mat3 boneMatrixIT; }; layout(std140, binding = i) uniform bonesUbo { mediump int BoneCount; // a name or index can be used to retrieve a particular element Bone bones[]; // elementArrayIndex is used to index into an arrays of elements } boneBuffer; getElementByName(“BoneCount”) = boneBuffer.BoneCount getElementByName(“bones”) = boneBuffer.Bone[0] getElementByName(“bones”, 1) = boneBuffer.Bone[1].

Public Functions

inline StructuredBufferView()#

Constructor. Creates an empty StructuredBufferView.

inline StructuredBufferView(const StructuredBufferView &other)#

Constructor. Creates an empty StructuredBufferView.

inline StructuredBufferView(const StructuredBufferView &&other)#

Constructor. Creates an empty StructuredBufferView.

inline StructuredBufferView &operator=(StructuredBufferView other)#
inline void pointToMappedMemory(void *mappedMemory, const uint32_t mappedDynamicSlice = 0)#

Assigns memory for this structured buffer view to point towards. Can also set the mapped dynamic slice which will be used to adjust any offsets retrieved or used when setting buffer values.

Parameters:
  • mappedMemory – The mapped memory to point to

  • mappedDynamicSlice – The dynamic slice used when mapping the mapped memory.

inline uint64_t getSize() const#

Get the size of the whole buffer represented by the StructuredBufferView. This size takes into account dynamic slices.

Returns:

Return the size of the buffer

inline uint32_t getMappedDynamicSlice() const#

Get dynamic slice which was mapped when a buffer was mapped which follows the structure set out by this StructuredBufferView. The mapped dynamic slice is used to adjust the offset value used when setting values. The mapped dynamic slice is set via a call to pointToMappedMemory.

Returns:

Return the mapped dynamic slice

inline const void *getMappedMemory() const#

Get the mapped memory pointed to by this StructuredBufferView. The mapped memory is set via a call to pointToMappedMemory.

Returns:

Return the mapped memory

inline uint64_t getDynamicSliceSize() const#

Get the size of a given dynamic slice of the buffer represented by the StructuredBufferView.

Returns:

Return the size of particular dynamic slice

inline uint32_t getNumDynamicSlices() const#

Get the number of dynamic slices the StructuredBufferView uses.

Returns:

Return the number of dynamic slices

inline const std::string &getName() const#

Get the StructuredBufferViewName.

Returns:

The name of root element

inline uint32_t getDynamicSliceOffset(uint32_t dynamicSliceIndex) const#

Get the offset for the given dynamic slice.

Parameters:

dynamicSliceIndex – The dynamic slice to retrieve the offset for

Returns:

Return the offset for the given dynamic slice

inline void init(const StructuredMemoryDescription &desc)#

Initialises the StructuredBufferView for a non-dynamic buffer.

Parameters:

desc – The description to use for initialising the StructuredBufferView

inline void initDynamic(const StructuredMemoryDescription &desc, uint32_t numDynamicSlices = 1, BufferUsageFlags usage = BufferUsageFlags::UniformBuffer, const uint64_t minUboDynamicAlignment = 0, const uint64_t minSsboDynamicAlignment = 0)#

Initialises the StructuredBufferView for a dynamic buffer.

Parameters:
  • desc – The description to use for initialising the StructuredBufferView

  • numDynamicSlices – The number of dynamic slices to use for the StructuredBufferView

  • usage – The intended usage of the underlying buffer

  • minUboDynamicAlignment – The minimum dynamic alignment when used as a uniform buffer

  • minSsboDynamicAlignment – The minimum dynamic alignment when used as a storage buffer

inline const StructuredBufferViewElement getElementByName(const StringHash &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElementByName(const StringHash &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElementByName(const std::string &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElementByName(const std::string &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElementByName(const char *str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElementByName(const char *str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElement(uint32_t elementIndex, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using an index.

Parameters:
  • elementIndex – The index of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElement(uint32_t elementIndex, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using an index.

Parameters:
  • elementIndex – The index of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline std::string getElementNameByIndex(uint32_t elementIndex)#

Gets an element name using an index.

Parameters:

elementIndex – The index of the element to retrieve

Returns:

Return the name of the element at the index.

inline uint32_t getNumElements()#

Gets the number of elements for a particular level of the structured buffer view.

Returns:

Return the number of elements for a particular level of the structured buffer view.

inline void setLastElementArraySize(uint32_t arraySize)#

Sets the element array size for the last entry in the StructuredBufferViewElement. Only the last element in the StructuredBufferViewElement may have its size set from the api.

Parameters:

arraySize – The size of the array

inline uint32_t getIndex(const StringHash &name) const#

Retrieve the index of a variable by its name.

Parameters:

name – The name of a element

Returns:

The index of a variable entry

inline uint32_t getIndex(const char *name) const#

Retrieve the index of a variable by its name.

Parameters:

name – The name of a element

Returns:

The index of a variable entry

inline uint32_t getIndex(const std::string &name) const#

Retrieve the index of a variable by its name.

Parameters:

name – The name of a element

Returns:

The index of a variable entry

inline std::string toString()#

Converts the StructuredBufferView to a readable string entry.

Returns:

The human readable string corresponding to the StructuredBufferView

Friends

inline friend void swap(StructuredBufferView &first, StructuredBufferView &second)#

StructuredBufferViewElement#

Class Documentation#

class StructuredBufferViewElement#

Defines a StructuredBufferViewElement. A StructuredBufferViewElement handles the public interface used for working with a StructuredMemoryEntry.

Public Functions

inline StructuredBufferViewElement getElementByName(const StringHash &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElementByName(const StringHash &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElementByName(const std::string &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElementByName(const std::string &str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElementByName(const char *str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElementByName(const char *str, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using a name.

Parameters:
  • str – The name of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline StructuredBufferViewElement getElement(uint32_t elementIndex, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0)#

Gets an element using an index.

Parameters:
  • elementIndex – The index of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const StructuredBufferViewElement getElement(uint32_t elementIndex, uint32_t elementArrayIndex = 0, uint32_t dynamicSlice = 0) const#

Gets an element using an index.

Parameters:
  • elementIndex – The index of the element to retrieve

  • elementArrayIndex – The element array index of the element to retrieve

  • dynamicSlice – The dynamic slice of the element to retrieve.

Returns:

Return the StructuredBufferViewElement.

inline const std::string &getElementNameByIndex(uint32_t elementIndex) const#

Gets an element using an index.

Parameters:

elementIndex – The index of the element to retrieve

Returns:

Return the StructuredBufferViewElement.

inline uint32_t getIndex(const StringHash &str)#

Gets the index for a given element.

Parameters:

str – The name of the element to retrieve the index for

Returns:

Return the index of the StructuredBufferViewElement.

inline uint32_t getIndex(const std::string &str)#

Gets the index for a given element.

Parameters:

str – The name of the element to retrieve the index for

Returns:

Return the index of the StructuredBufferViewElement.

inline uint32_t getIndex(const char *str)#

Gets the index for a given element.

Parameters:

str – The name of the element to retrieve the index for

Returns:

Return the index of the StructuredBufferViewElement.

inline uint32_t getOffset() const#

Gets the offset for the StructuredBufferViewElement. This function takes into account any mapped memory. if the mapped dynamic slice is not equal to zero then the offset returned here will be adjusted based on the mapped dynamic slice.

Returns:

Return the offset of the StructuredBufferViewElement.

inline uint64_t getValueSize() const#

Gets the size of the underlying structure memory entry.

Returns:

Return the size of the underlying structure memory entry.

inline uint64_t getArrayPaddedSize() const#

Gets the size of the underlying structure memory entry.

Returns:

Return the size of the underlying structure memory entry.

inline void setValue(const float &value)#
inline void setValue(const float *value)#
inline void setValue(const uint32_t &value)#
inline void setValue(const uint32_t *value)#
inline void setValue(const uint64_t &value)#
inline void setValue(const uint64_t *value)#
inline void setValue(const int32_t &value)#
inline void setValue(const int32_t *value)#
inline void setValue(const int64_t &value)#
inline void setValue(const int64_t *value)#
inline void setValue(const glm::vec2 &value)#
inline void setValue(const glm::vec2 *value)#
inline void setValue(const glm::vec4 &value)#
inline void setValue(const glm::vec4 *value)#
inline void setValue(const glm::ivec2 &value)#
inline void setValue(const glm::ivec2 *value)#
inline void setValue(const glm::ivec4 &value)#
inline void setValue(const glm::ivec4 *value)#
inline void setValue(const glm::uvec2 &value)#
inline void setValue(const glm::uvec2 *value)#
inline void setValue(const glm::uvec4 &value)#
inline void setValue(const glm::uvec4 *value)#
inline void setValue(const glm::mat2x2 &value)#
inline void setValue(const glm::mat2x2 *value)#
inline void setValue(const glm::mat2x4 &value)#
inline void setValue(const glm::mat2x4 *value)#
inline void setValue(const glm::mat3x2 &value)#
inline void setValue(const glm::mat3x2 *value)#
inline void setValue(const glm::mat3x4 &value)#
inline void setValue(const glm::mat3x4 *value)#
inline void setValue(const glm::mat4x2 &value)#
inline void setValue(const glm::mat4x2 *value)#
inline void setValue(const glm::mat4x4 &value)#
inline void setValue(const glm::mat4x4 *value)#
inline void setValue(const glm::vec3 &value)#

Sets the value (glm::vec3 specific) for this element taking the source by reference.

Parameters:

value – The value to set by reference

inline void setValue(const glm::ivec3 &value)#

Sets the value (glm::ivec3 specific) for this element taking the source by reference.

Parameters:

value – The value to set by reference

inline void setValue(const glm::uvec3 &value)#

Sets the value (glm::ivec3 specific) for this element taking the source by reference.

Parameters:

value – The value to set by reference

inline void setValue(const glm::vec3 *value)#

Sets the value (glm::vec3 specific) for this element taking the source by pointer.

Parameters:

value – The value to set by pointer

inline void setValue(const glm::ivec3 *value)#

Sets the value (glm::ivec3 specific) for this element taking the source by pointer.

Parameters:

value – The value to set by pointer

inline void setValue(const glm::uvec3 *value)#

Sets the value (glm::uvec3 specific) for this element taking the source by pointer.

Parameters:

value – The value to set by pointer

inline void setValue(const glm::mat2x3 &value)#

Sets the value (glm::mat2x3 specific) for this element taking the source by reference.

Parameters:

value – The value to set by reference

inline void setValue(const glm::mat3x3 &value)#

Sets the value (glm::mat3x3 specific) for this element taking the source by reference.

Parameters:

value – The value to set by reference

inline void setValue(const glm::mat4x3 &value)#

Sets the value (glm::mat4x3 specific) for this element taking the source by reference.

Parameters:

value – The value to set by reference

inline void setValue(const glm::mat2x3 *value)#

Sets the value (glm::mat2x3 specific) for this element taking the source by pointer.

Parameters:

value – The value to set by pointer

inline void setValue(const glm::mat3x3 *value)#

Sets the value (glm::mat3x3 specific) for this element taking the source by pointer.

Parameters:

value – The value to set by pointer

inline void setValue(const glm::mat4x3 *value)#

Sets the value (glm::mat4x3 specific) for this element taking the source by pointer.

Parameters:

value – The value to set by pointer

inline void setValue(const FreeValue &value)#

Sets the value of this element using a FreeValue which encapsulates various data types.

Parameters:

value – The free value to set by reference

inline void setValue(const TypedMem &value)#

Sets the value for this element using typed memory.

Parameters:

value – The TypedMem to set by reference

inline void setArrayValuesStartingFromThis(const TypedMem &value)#

Sets a number of array values in a single call using typed memory. Without this multiple setValue calls would be necessary.

Parameters:

value – The TypedMem to set by reference

inline uint32_t getNumElements()#

Gets the number of elements for a particular level of the structured buffer view.

Returns:

Return the number of elements for a particular level of the structured buffer view.

StructuredMemoryDescription#

Class Documentation#

class StructuredMemoryDescription#

Defines a memory element description. The element will be provided with a name, type and number of array elements. The element itself may also contain child memory elements.

Public Functions

inline StructuredMemoryDescription(const StructuredMemoryDescription &rhs)#

Copy Constructor.

Parameters:

rhs – The StructuredMemoryDescription to copy from.

inline StructuredMemoryDescription(const std::string &name, uint32_t arraySize, std::initializer_list<StructuredMemoryDescription> children)#

The constructor for a StructuredMemoryDescription based on the provided name, arraySize and children.

Parameters:
  • name – The name of an element to add.

  • arraySize – The array size for a new element to add.

  • children – A std::initializer_list<StructuredMemoryDescription> containing the description for a set of children to add.

inline StructuredMemoryDescription(std::string &&name, uint32_t arraySize, std::initializer_list<StructuredMemoryDescription> children)#

The constructor for a StructuredMemoryDescription based on the provided name, arraySize and children.

Parameters:
  • name – The name of an element to add.

  • arraySize – The array size for a new element to add.

  • children – A std::initializer_list<StructuredMemoryDescription> containing the description for a set of children to add.

inline StructuredMemoryDescription(std::string &&name, GpuDatatypes type)#

The constructor for a StructuredMemoryDescription based on the provided name and GpuDatatypes.

Parameters:
  • name – The name of an element to add.

  • type – The type of a new element to add.

inline StructuredMemoryDescription(const std::string &str, uint32_t arraySize, pvr::GpuDatatypes type)#

The constructor for a StructuredMemoryDescription based on the provided name, arraySize and GpuDatatypes.

Parameters:
  • str – The name of an element to add.

  • arraySize – The array size for a new element to add.

  • type – The type of a new element to add.

inline StructuredMemoryDescription()#

The default constructor for a StructuredMemoryDescription.

inline StructuredMemoryDescription(StructuredMemoryDescription &&rhs)#

Move constructor for a StructuredMemoryDescription.

Parameters:

rhs – The StructuredMemoryDescription to move from.

inline StructuredMemoryDescription &operator=(const StructuredMemoryDescription &rhs)#

assignment operator for a StructuredMemoryDescription.

Parameters:

rhs – The StructuredMemoryDescription to copy from.

Returns:

Return this object

inline StructuredMemoryDescription &setName(const std::string &name)#

Sets the name of the StructuredMemoryDescription.

Parameters:

name – The new name of the StructuredMemoryDescription

Returns:

Returns *this.

inline StructuredMemoryDescription &setName(std::string &&name)#

Sets the name of the StructuredMemoryDescription.

Parameters:

name – The new name of the StructuredMemoryDescription

Returns:

Returns *this.

inline StructuredMemoryDescription &setNumArrayElements(uint32_t numArrayElements)#

Sets the number of array elements of the StructuredMemoryDescription.

Parameters:

numArrayElements – The new number of array elements for the StructuredMemoryDescription

Returns:

Returns *this.

inline StructuredMemoryDescription &setType(GpuDatatypes type)#

Sets the type of the StructuredMemoryDescription.

Parameters:

type – The new type of the StructuredMemoryDescription

Returns:

Returns *this.

inline StructuredMemoryDescription &addElement(const std::string &name, GpuDatatypes type, uint32_t numArrayElements = 1)#

Adds an element to the list of children for the StructuredMemoryDescription.

Parameters:
  • name – The name of the child element

  • type – The type of the child element

  • numArrayElements – The number of array elements of the child element

Returns:

Returns *this.

inline StructuredMemoryDescription &addElement(std::string &name, GpuDatatypes type, uint32_t numArrayElements = 1)#

Adds an element to the list of children for the StructuredMemoryDescription.

Parameters:
  • name – The name of the child element

  • type – The type of the child element

  • numArrayElements – The number of array elements of the child element

Returns:

Returns *this.

inline StructuredMemoryDescription &addElement(const StructuredMemoryDescription &smd)#

Adds an element to the list of children for the StructuredMemoryDescription.

Parameters:

smd – A StructuredMemoryDescription defining a child to add to the list of children for the StructuredMemoryDescription

Returns:

Returns *this.

inline StructuredMemoryDescription getElement(const std::string &name)#

Gets an element description from the StructuredMemoryDescription.

Parameters:

name – the name of a particular element to get the description for

Returns:

Returns the StructuredMemoryDescription for a element with name.

inline StructuredMemoryDescription getElement(uint32_t index)#

Gets an element description from the StructuredMemoryDescription.

Parameters:

index – the name of a particular element to get the description for

Returns:

Returns the StructuredMemoryDescription for a element at index.

inline const std::string &getName() const#

Gets an element name for the StructuredMemoryDescription.

Returns:

Returns the name for the StructuredMemoryDescription.

inline const GpuDatatypes getType()#

Gets an element type for the StructuredMemoryDescription.

Returns:

Returns the type for the StructuredMemoryDescription.

inline const uint32_t getNumArrayElements()#

Gets the number of array elements for the StructuredMemoryDescription.

Returns:

Returns the number of array elements for the StructuredMemoryDescription.

inline const uint32_t getNumChildren()#

Gets the number of child elements for the StructuredMemoryDescription.

Returns:

Returns the number of child elements for the StructuredMemoryDescription.

StructuredMemoryEntry#

Nested Relationships#

Nested Types#

Class Documentation#

class StructuredMemoryEntry#

Defines a StructuredMemoryEntry element. A StructuredMemoryEntry defines an actual element entry in a structured buffer view. WARNING: Arrays of size 1 not supported - they are considered non-arrays. WARNING: Due to pointers to parents, no reallocations must ever happen. Once initialized, the lists must be final. WARNING: THE ENTIRE PUBLIC INTERFACE OF THIS CLASS EXCEPT FOR INIT, IS CONST. WARNING: IT IS NOT INTENDED FOR THIS CLASS TO BE EVER MODIFIABLE.

Public Functions

inline StructuredMemoryEntry()#

A default Constructor for a StructuredMemoryEntry.

inline StructuredMemoryEntry(const StructuredMemoryEntry &other)#

A Copy constructor for a StructuredMemoryEntry.

Parameters:

other – The StructuredMemoryEntry to copy from

inline virtual ~StructuredMemoryEntry()#

Destructor. Virtual (for polymorphic use).

inline StructuredMemoryEntry &operator=(StructuredMemoryEntry other)#

Copy Assignment operator.

Parameters:

other – The StructuredMemoryEntry to assign to this StructuredMemoryEntry

Returns:

this object (allows chained calls)

inline const uint32_t getNumChildren() const#

Returns the number of children.

Returns:

Return the number of child entries.

inline const StructuredMemoryEntry &getChild(uint32_t index) const#

Returns the child at the given index.

Parameters:

index – The index of the child to return

Returns:

Return the child StructuredMemoryEntry.

inline const StructuredMemoryEntry *getParent() const#

Returns the parent.

Returns:

Return the StructuredMemoryEntry parent.

inline uint32_t getNumArrayElements() const#

Returns the number of array elements.

Returns:

Return the number of array elements.

inline bool isStructure() const#

Check if the StructuredMemoryEntry is a structure.

Returns:

Returns true if the StructuredMemoryEntry is a structure.

inline bool isPrimitive() const#

Check if the StructuredMemoryEntry has a primitive data type.

Returns:

Returns true if the StructuredMemoryEntry has a primitive data type.

inline const StringHash &getName() const#

Checks the name of the StructuredMemoryEntry.

Returns:

Returns the given name of the StructuredMemoryEntry.

inline GpuDatatypes getPrimitiveType() const#

Checks the primitive type of the StructuredMemoryEntry.

Returns:

Returns the typeof the StructuredMemoryEntry.

inline uint32_t getOffset() const#

Gets the offset for the StructuredMemoryEntry.

Returns:

Returns the offset the StructuredMemoryEntry.

inline uint32_t getArrayElementOffset(uint32_t arrayElement) const#

Returns the particular array element offset for the StructuredMemoryEntry.

Parameters:

arrayElement – The array element to retrieve the offset for

Returns:

Return the array element offset for the given arrayElement.

inline uint64_t getSize() const#

Gets the size of the StructuredMemoryEntry.

Returns:

Returns the size the StructuredMemoryEntry.

inline uint64_t getSingleItemSize() const#

Gets the size of the StructuredMemoryEntry.

Returns:

Returns the size the StructuredMemoryEntry.

inline void setLastElementArraySize(uint32_t arraySize)#

Sets the element array size for the last entry in the StructuredMemoryEntry. Only the last element in the StructuredMemoryEntry may have its size set from the api.

Parameters:

arraySize – The size of the array

inline uint32_t getIndex(const StringHash &name) const#

Returns the index of the child with the given name.

Parameters:

name – The name to search for

Returns:

Return the index of the element with the given name.

inline void init(const StructuredMemoryDescription &desc)#

Initialise the StructuredMemoryEntry using the given description. This function should be used to initialise non-dynamic buffers //ONLY CALL ON THE ROOT ELEMENT.

Parameters:

desc – The description used to initialise the StructuredMemoryEntry

inline void initDynamic(const StructuredMemoryDescription &desc, BufferUsageFlags usage = BufferUsageFlags::UniformBuffer, const uint64_t minUboDynamicAlignment = 0, const uint64_t minSsboDynamicAlignment = 0)#

Initialise the StructuredMemoryEntry using the given description. This function should be used to initialise dynamic buffers //ONLY CALL ON THE ROOT ELEMENT.

Parameters:
  • desc – The description used to initialise the StructuredMemoryEntry

  • usage – The intended usage of the StructuredMemoryEntry

  • minUboDynamicAlignment – The minimum dynamic alignment when used as a uniform buffer

  • minSsboDynamicAlignment – The minimum dynamic alignment when used as a storage buffer

inline void printIntoStringStream(std::stringstream &str, uint32_t level) const#

Prints a StructuredMemoryEntry to a std::stringstream for the current level.

Parameters:
  • str – The current std::stringstream to print to

  • level – The current level to print a preamble for

Public Static Functions

static inline void printPreamble(std::stringstream &str, uint32_t level)#

Prints a preamble for the current StructuredMemoryEntry level.

Parameters:
  • str – The current std::stringstream to print to

  • level – The current level to print a preamble for

Friends

inline friend void swap(StructuredMemoryEntry &first, StructuredMemoryEntry &second)#

A swap function for a pvr::utils::StructuredMemoryEntry. Swaps all members of each pvr::utils::StructuredMemoryEntry to the other.

Parameters:

VertexStreamDescription#

Class Documentation#

class VertexStreamDescription#

Class used to generate vertex information following a specific vertex format.

Public Types

enum DataSemantic#

Type of vertex information.

Values:

enumerator POSITION#
enumerator NORMAL#
enumerator TANGENT#
enumerator COLOR#
enumerator UV0#
enumerator UV1#
enumerator BONE_WEIGHTS#
enumerator BONE_INDICES#

Public Functions

VertexStreamDescription()#
void Add(uint16_t bufferBinding, pvr::DataType dataType, uint8_t width, const std::string &name, DataSemantic semantic)#
const pvr::utils::VertexConfiguration &GetVertexConfig() const#
bool HasChannel(DataSemantic semantic) const#
bool RetrieveChannelDescription(DataSemantic semantic, pvr::utils::VertexAttributeInfoWithBinding &out) const#
uint16_t GetBindingCount() const#
uint32_t GetBindingVertexStride(uint16_t binding) const#
uint16_t GetSemanticBinding(DataSemantic semantic) const#

GlError#

Inheritance Relationships#

Base Type#

  • public pvr::PvrError

Class Documentation#

class GlError : public pvr::PvrError#

A simple std::runtime_error wrapper for OpenGLES error codes.

Public Functions

inline GlError(GLuint errorCode)#

Constructor.

Parameters:

errorCode – The OpenGLES error code to log.

inline GlError(GLuint errorCode, const std::string &message)#

Constructor.

Parameters:
  • errorCode – The OpenGLES error code to log.

  • message – A message to log alongside the OpenGLES error code.

inline GlError(GLuint errorCode, const char *message)#

Constructor.

Parameters:
  • errorCode – The OpenGLES error code to log.

  • message – A message to log alongside the OpenGLES error code.

GlExtensionNotSupportedError#

Inheritance Relationships#

Base Type#

  • public pvr::PvrError

Class Documentation#

class GlExtensionNotSupportedError : public pvr::PvrError#

A simple std::runtime_error wrapper for OpenGLES extension not supported error codes.

Public Functions

inline GlExtensionNotSupportedError(const std::string &extensionString)#

Constructor.

Parameters:

extensionString – The unsunpported OpenGLES extension name to log.

inline GlExtensionNotSupportedError(const std::string &extensionString, const std::string &message)#

Constructor.

Parameters:
  • extensionString – The unsunpported OpenGLES extension name to log.

  • message – A message to log alongside the unsunpported OpenGLES extension name.

Multi#

Class Documentation#

template<typename T_, uint8_t MAX_ITEMS = 4>
class Multi#

A small statically allocated array This class represents a small array of items. The array is statically allocated, and has at most 255 items, usually 8. It is not meant to (and cannot) be used to store large numbers of items (use a std::vector instead), rather it is meant to hold small tuples of items. The PowerVR framework utilizes this class to store tuples of one-per-swap-image items.

Public Types

typedef T_ ElementType#

The items contained in this object.

typedef ElementType ContainerType[MAX_ITEMS]#

The type of the container.

Public Functions

inline ElementType *data()#

Get data.

Returns:

Returns a pointer to the first element.

inline ElementType &operator[](uint32_t idx)#

Indexing operator.

Parameters:

idx – The index

Returns:

Returns a reference to the indexed item.

inline const ElementType &operator[](uint32_t idx) const#

Const Indexing operator.

Parameters:

idx – The index

Returns:

Returns a const reference to the indexed item.

inline ContainerType &getContainer()#

Get a reference to the actually held items (a C-array of the specified max number of items)

Returns:

The array of items.

inline ElementType &back()#

Get a reference to the last item.

Returns:

The last object. If it is out of range, the behaviour is undefined.

inline const ElementType &back() const#

Get a reference to the last item.

Returns:

The last object. If it is out of range, the behaviour is undefined.

inline size_t size() const#

Number of items currently held in the object.

Returns:

Number of items currently held in the object

inline void resize(uint32_t newsize)#

Set the number of items held in the object.

Parameters:

newsize – The new size. Clears unused items by default-initializing.

Returns:

The number of items currently held in the object

inline void clear()#

Empty the object.

inline Multi()#

Constructor. Constructs empty object.

inline explicit Multi(const ElementType &element)#

Constructor. Copy the given object to all entries of the container.

Parameters:

element – The element to copy into all entries of the container

inline Multi(const ElementType *elements, const uint32_t count)#

Constructor. Copy the initial objects from a c-style array.

Parameters:
  • elements – A C-style array of elements to copy

  • count – The number of items to copy

inline void add(const ElementType &element)#

Add an item past the current end of the array.

Parameters:

element – The item to add

inline void add(const ElementType *element, const uint32_t count)#

Add multiple item past the current end of the array.

Parameters:
  • element – C-style array of items to add

  • count – Number of items to add