Kanzi  3.9.4
Kanzi Engine API
kanzi::Renderer Class Reference

#include <kanzi/core.ui/platform/graphics_backend/gl/renderer.hpp>

Classes

struct  RendererSettings
 Settings structure for renderer construction. More...
 
struct  TextureUnitInfo
 Texture unit information structure. More...
 

Public Types

enum  BufferAccessMode { BufferAccessMode::ReadOnly, BufferAccessMode::WriteOnly, BufferAccessMode::ReadWrite }
 Mode for accessing a GPU buffer. More...
 
enum  ClearMode {
  ClearModeDisabled, ClearModeUnsignedNormalized, ClearModeUnsignedInteger, ClearModeSignedInteger,
  ClearModeFloat
}
 Per color buffer clear setting. More...
 
typedef void(* FramebufferCallback) (unsigned int frameBufferHandle)
 Callback prototype for setActiveFramebuffer. More...
 
enum  Information {
  InformationGLVendor, InformationGLRenderer, InformationGLVersion, InformationGLShadingLanguageVersion,
  InformationGLExtensions, InformationFormatSupport, InformationShaderBinarySupport, InformationProgramBinarySupport,
  InformationFeatureSupport, InformationImplementationDependent, InformationDebug, InformationAll
}
 
enum  RenderingChangeStateFlag {
  RenderingChangeStateFlagNone, RenderingChangeStateFlagColorWriteMode, RenderingChangeStateFlagBlendMode, RenderingChangeStateFlagCullMode,
  RenderingChangeStateFlagDepthTest, RenderingChangeStateFlagAll
}
 Rendering change flag type. More...
 
enum  Workaround {
  WorkaroundMaliHalfFloatTextureCoordinate, WorkaroundTegra3ColorBufferHalfFloat, WorkaroundAdreno330ColorBufferHalfFloat, WorkaroundChromiumTextureImageUnitCount,
  WorkaroundPVRFrameAMDHost, WorkaroundAMDCompressedTexStorage, WorkaroundPVRVFrameOESEGLImageExternal, WorkaroundPVRVFrameDepth32f,
  WorkaroundVivanteDepth32f, WorkaroundFaultyRequiredInternalformat, WorkaroundCount
}
 

Public Member Functions

void addClearColor (unsigned int drawBuffer, uint32_t red, uint32_t green, uint32_t blue, uint32_t alpha)
 Register color clear for unsigned integer color buffer. More...
 
void addClearColor (unsigned int drawBuffer, int32_t red, int32_t green, int32_t blue, int32_t alpha)
 Register color clear for signed integer color buffer. More...
 
void addClearColor (unsigned int drawBuffer, float red, float green, float blue, float alpha)
 Register color clear for float color buffer. More...
 
void addClearColor (unsigned int drawBuffer, ColorRGBA colorRGBA)
 Register color clear for unsigned normalized color buffer. More...
 
void addClearColor (unsigned int drawBuffer, ClearMode clearMode)
 Register color clear with value 0. More...
 
void addClearTarget (GraphicsClearTarget target)
 Sets a clearing target for renderer. More...
 
void advanceGlobalTime (chrono::milliseconds deltaTime)
 Advances renderer wall clock with time delta. More...
 
void applyAttributePointer (unsigned int location, int dimension, GraphicsDataType dataType, int stride, const void *data) const
 For given vertex attribute, specified by attribute location, configures attribute dimension, datatype, stride and starting offset in current vertex buffer. More...
 
void applyFixedUniformTime (int uniformLocation)
 Applies the Time fixed uniform. More...
 
void applyFixedUniformWindowSize (int uniformLocation)
 Applies the WindowSize fixed uniform. More...
 
void applyTexture (TextureType type, unsigned int textureUnit, unsigned int handle)
 Sets texture settings for given texture unit. More...
 
void applyTextureSizeUniforms (ShaderTextureUniform textureUniforms, unsigned int textureWidth, unsigned int textureHeight)
 Applies texture uniforms for the renderer. More...
 
void applyTransformation (ShaderProgram &shaderProgram)
 Applies transformations from renderer to GPU. More...
 
void applyTransformationUniform (ShaderProgram::FixedUniform uniform, int uniformLocation)
 Applies a single transformation uniform. More...
 
void applyVertexAttributeArrays ()
 Update vertex attribute configurations to the graphics driver. More...
 
void attachShaderToProgram (unsigned int programHandle, unsigned int shaderHandle)
 Attaches shader to program. More...
 
void beginMaterialSetup ()
 Begins a material for renderer. More...
 
void beginVertexArray ()
 Begins set of vertex arrays. More...
 
void bindAttributeToLocation (unsigned int programHandle, unsigned int locationIndex, kzString attributeName)
 Binds attribute to given location index, for example "kzPosition" to 0. More...
 
void bindFramebuffer (unsigned int frameBufferHandle)
 Binds framebuffer. More...
 
void bindRenderbuffer (unsigned int renderbuffer)
 Binds framebuffer for editing. More...
 
unsigned int bindTexture (TextureType type, unsigned int handle)
 Binds specified texture of specified type to currently active texture unit. More...
 
void calculateProjectionCameraWorldMatrix ()
 Calculates projection * camera * world matrix. More...
 
void clear ()
 Clears currently bound framebuffer with requested buffers. More...
 
void clearUniformCaches ()
 Free memory used by uniform caches. More...
 
bool compileSourceShader (ShaderType shaderType, unsigned int shaderHandle, const char *const shaderCode, string_view shaderName)
 Compiles source shader and deploys it to GPU. More...
 
void * createImageObject (void *dataPointer, int target, int *attributes)
 Creates image object, returns NULL if no hardware support. More...
 
unsigned int createShader (ShaderType type)
 Creates shader. More...
 
unsigned int createShaderProgram ()
 Creates shader program. Returns the handle to the program. More...
 
void deleteBuffer (unsigned int handle)
 Deletes vertex or index buffer. More...
 
void deleteFramebuffer (unsigned int frameBufferHandle)
 Deletes framebuffer. More...
 
void deleteImageObject (void *imageObject)
 Deletes image object created with createImageObject. More...
 
void deleteRenderbuffer (unsigned int renderbuffer)
 Deletes framebuffer. More...
 
void deleteShader (unsigned int shaderHandle)
 Deletes shader. More...
 
void deleteShaderProgram (unsigned int programHandle)
 Deletes shader program and attached shaders. More...
 
void deleteTexture (unsigned int textureHandle)
 Deletes texture via renderer. More...
 
bool deployBinaryProgram (unsigned int program, unsigned int binaryFormat, const void *data, size_t dataSize)
 Initializes shader program from program binary data. More...
 
bool deployBinaryShader (unsigned int count, const unsigned int *shaders, unsigned int binaryFormat, const void *data, size_t dataSize)
 Deploys binary shaders. More...
 
void detachShaderFromProgram (unsigned int programHandle, unsigned int shaderHandle)
 Detaches shader from program. More...
 
void detachTexture (unsigned int textureUnit)
 Detaches all texture information from given texture unit. More...
 
void disableState (RendererState state)
 Disables a specific renderer state. More...
 
void disableVertexAttributeArray (unsigned int attributeHandle)
 Sets vertex attribute array to be disabled. More...
 
void disableWorkaround (Workaround workaround)
 Disable a renderer workaround. More...
 
void drawBuffers ()
 Render buffers that are currently bound. More...
 
void enableState (RendererState state)
 Enables a specific renderer state. More...
 
void enableVertexAttributeArray (unsigned int attributeHandle)
 Sets vertex attribute array to be enabled. More...
 
void enableWorkaround (Workaround workaround)
 Enable a renderer workaround. More...
 
void endMaterialSetup ()
 Ends a material for renderer. More...
 
void endVertexArray (GraphicsPrimitiveType primitiveType, unsigned int count)
 Ends vertex array. Renders the specified vertex lists and finishes the usage. More...
 
GraphicsFormat findValidTextureFormat (GraphicsFormat format, unsigned int features) const
 Find a valid texture format which is supported by graphics adapter and is compatible with specified format. More...
 
void flush () const
 Flushes the GPU pipeline, forces all commands to be executed in finite time. More...
 
void framebufferRenderbuffer (Surface::APIAttachment attachment, unsigned int renderbuffer)
 Attaches renderbuffer to the currently active Framebuffer. More...
 
void framebufferTexture2D (unsigned int glTextureImageTarget, Surface::APIAttachment attachment, unsigned int textureHandle, unsigned int mipmapLevel, unsigned int implicitSampleCount)
 Attaches texture to the currently active Framebuffer. More...
 
unsigned int generateBuffer ()
 Generates new index or vertex buffer or uniform buffer object name. More...
 
unsigned int generateFramebuffer ()
 Generates new texture for renderer. More...
 
void generateMipmaps (TextureType textureType)
 Generates mipmaps for currently bound texture. More...
 
unsigned int generateRenderbuffer ()
 Generates new texture for renderer. More...
 
unsigned int generateTexture ()
 Generates new texture for renderer. More...
 
SurfaceColorSpace getActiveColorSpace () const
 Gets the active Color Space. More...
 
unsigned int getActiveFramebuffer () const
 Gets active frame buffer handle from. More...
 
GLGraphicsOutputgetActiveGLGraphicsOutput () const
 Gets active surface context from renderer. More...
 
KzsGlGraphicsContext * getActiveGraphicsContext () const
 
float getActiveScalar (GraphicsScalar scalar) const
 Returns a current scalar value from renderer. More...
 
const int * getActiveShaderAttributeMap () const
 Gets active vertex attribute map from renderer. More...
 
unsigned int getActiveShaderHandle () const
 Gets active shader handle from renderer. More...
 
SurfaceClientAPI getActiveSurfaceClientAPI () const
 
::KzsOpenGlVendor getActiveSurfaceVendor () const
 
unsigned int getBatchCount () const
 Gets batch count from renderer (number of draw calls, such as drawElements and drawArrays). More...
 
int getBlendMode () const
 Gets a blend mode for renderer. More...
 
unsigned int getBufferSwitchCount () const
 Gets number of buffer switches (VBO + IBO) from renderer. More...
 
int getColorReadFormat ()
 Returns GL constant for the color read format used in reading back data from framebuffer (RendererReadPixels). More...
 
int getColorReadType ()
 Returns GL constant for the color read type used in reading back data from framebuffer (RendererReadPixels). More...
 
GraphicsColorWriteMode getColorWriteMode () const
 Gets current color write mode from renderer. More...
 
GraphicsCullMode getCullMode () const
 Gets a cull mode for renderer. More...
 
const void * getCurrentVertexArrayAttributeData (VertexAttribute::Semantic attribute) const
 Gets current vertex array data from renderer. Reset when switching the shader. More...
 
unsigned int getCurrentVertexArrayFlags () const
 Gets the current vertex array flags from renderer. More...
 
GraphicsFormat getDepthStencilFormatForRenderbuffer (bool depth, bool stencil) const
 Returns a depth/stencil renderbuffer format which is supported by renderer. More...
 
GraphicsFormat getDepthStencilFormatForTexture (bool depth, bool stencil) const
 Returns a depth/stencil texture format which is supported by renderer. More...
 
GraphicsCompareFunction getDepthTest () const
 Gets a depth pass mode for renderer. More...
 
DrawBuffers getDrawBuffersSupport () const
 Return support for draw buffers. More...
 
bool getDumpStateOnDrawCalls () const
 Returns current dump state on draw calls setting. More...
 
GraphicsFormat getFallback (GraphicsFormat format, unsigned int usageFlags) const
 Returns a fallback format which supports specified usage flags. More...
 
unsigned int getFeatures (GraphicsFormat format) const
 Describes what the specified format can be used for in the specified renderer. More...
 
FloatTexture getFloatTextureSupport () const
 Return support for float texture format. More...
 
unsigned int getFramebufferSwitchCount () const
 Gets number of framebuffer switches from renderer. More...
 
int getGlesVersion () const
 Returns supported OpenGL ES version number. More...
 
void getGLFormatTriplet (GraphicsFormat format, unsigned int features, unsigned int *out_glFormat, unsigned int *out_glInternalFormat, unsigned int *out_glType) const
 Returns GL API format, internal format, type triplet for given Format. More...
 
chrono::milliseconds getGlobalTime () const
 Gets wall clock time in milliseconds since program start. More...
 
HalfFloatTexture getHalfFloatTextureSupport () const
 Return support for half float texture format. More...
 
HalfFloatVertexAttribute getHalfFloatVertexAttributeSupport () const
 Return support for half-float vertex attribute. More...
 
unsigned int getHeavyweightCallCount () const
 Returns potential heavyweight calls such as buffer or texture updates and glFinish from renderer. More...
 
unsigned int getIndexCount () const
 Gets index count from renderer. More...
 
float getLineWidth () const
 Gets the line width assigned to the renderer. More...
 
bool getLogging () const
 Returns current OpenGL API call logging setting. More...
 
Matrix4x4 getMatrix (FixedMatrix matrixType) const
 Gets a matrix from renderer. More...
 
float getMaximumAnisotropy () const
 Gets maximum anisotropy. More...
 
unsigned int getMaximumRenderbufferSize () const
 Gets maximum renderbuffer size. More...
 
unsigned int getMaximumSampleCount () const
 Gets maximum sample count for multisample. More...
 
unsigned int getMaximumTextureSize (TextureType textureType) const
 Gets maximum texture side size. More...
 
unsigned int getMaximumVertexAttributeCount () const
 Gets maximum vertex attribute count. More...
 
unsigned int getMaximumViewportHeight () const
 Gets maximum viewport height. More...
 
unsigned int getMaximumViewportWidth () const
 Gets maximum viewport width. More...
 
Multisample getMultisampleSupport () const
 Return support for multisample textures and renderbuffers. More...
 
GraphicsFormat getNativePixelReadFormat ()
 Returns native pixel read format from renderer. More...
 
Vector2 getPolygonDepthOffset () const
 Gets the polygon depth offset assigned to the renderer. More...
 
string getProgramBinary (unsigned int program, unsigned int &binaryFormat)
 Gets binary representation for GL shader program. More...
 
ProgramBinary getProgramBinarySupport () const
 Return support for program binaries. More...
 
ViewportRectangle getScissor () const
 Gets current scissor rectangle from renderer. More...
 
unsigned int getShaderSwitchCount () const
 Gets shader switches. More...
 
bool getState (RendererState state) const
 Returns state of a specific renderer state. More...
 
void getStencilFunction (GraphicsCompareFunction *out_stencilCompareFunction, unsigned int *out_referenceValue, unsigned int *out_maskValue) const
 Gets stencil function from renderer. More...
 
void getStencilOperation (GraphicsStencilOperation *out_stencilFailOperation, GraphicsStencilOperation *out_stencilPassDepthFailOperation, GraphicsStencilOperation *out_stencilPassDepthPassOperation) const
 Gets a stencil operation from renderer. More...
 
TexStorage getTexStorageSupport () const
 Return support for tex storage. More...
 
bool getTexStorageSupport (TextureType type, unsigned int samples) const
 Return support for tex storage. More...
 
unsigned int getTextureSwitchCount () const
 Gets number of texture switches from renderer. More...
 
unsigned int getTriangleCount () const
 Gets triangle count from renderer. More...
 
unsigned int getUniformArrayLength (const char *uniformName) const
 Returns array uniform length for given uniform. More...
 
int getUniformLocationSlow (const string &uniformName) const
 Finds uniform location for given uniform from active shader. More...
 
unsigned int getUniformSendCount () const
 Gets uniform sending count from renderer. More...
 
size_t getVertexCount () const
 Gets vertex count from renderer. More...
 
ViewportRectangle getViewport () const
 Gets current viewport rectangle from renderer. More...
 
bool GPUCallsIsEnabled () const
 Checks if GPU calls are enabled. More...
 
bool hasClearTarget (GraphicsClearTarget target) const
 Sees if renderer has specific clear target. More...
 
void initialize (const RendererSettings &rendererSettings)
 Initializes renderer object. More...
 
void invalidateAllocations ()
 Invalidates all handles from renderer without affecting GL state. More...
 
void invalidateFramebufferAttachments (FramebufferTarget target, bitset< Surface::APIAttachmentCount > attachments) const
 Invalidates framebuffer attachments. More...
 
bool isClearEnabled () const
 See if clear is enabled. More...
 
bool isFramebufferComplete ()
 Checks if the framebuffer status is complete. More...
 
bool isHalfFloatVertexAttributeSupported () const
 Indicates whether half-float vertex attribute is supported in any fashion. More...
 
bool isInitialized () const
 Tells whether the renderer is initialized. More...
 
bool isProgramBinaryFormatSupported (unsigned int glProgramBinaryFormat) const
 Checks if GL program binary format is supported. More...
 
bool isShaderBinaryFormatSupported (unsigned int glShaderBinaryFormat) const
 Checks if GL shader binary format is supported. More...
 
bool isSupported (RendererSupport feature) const
 Is coverage buffer supported or not. More...
 
bool isWorkaroundEnabled (Workaround workaround) const
 Return if workaround is enabled or not. More...
 
bool linkShaderProgram (unsigned int programHandle, kzString shaderName)
 Links shader program with given handle. More...
 
void logOpenGLInformation (unsigned int flags) const
 Logs information about renderer capabilities. More...
 
void * mapIndexBuffer (unsigned int size, BufferAccessMode mode)
 Maps index buffer. More...
 
void * mapVertexBuffer (unsigned int size, BufferAccessMode mode)
 Maps vertex buffer. More...
 
void popStatistics ()
 
void pushStatistics ()
 
void readPixels (int x, int y, int width, int height, GraphicsFormat format, void *pixels)
 Reads the pixels from the current frame buffer. More...
 
void refreshRenderContext (bool geometryRendering)
 Refreshes render context to contain all proper states. More...
 
void removeClearTarget (GraphicsClearTarget target)
 Removes a clearing target for renderer. More...
 
void renderbufferStorage (GraphicsFormat format, unsigned int width, unsigned int height, unsigned int explicitSampleCount)
 Sets storage for currently bound renderbuffer. More...
 
 Renderer ()
 Creates a new renderer object. More...
 
void reset ()
 Resets renderer, e.g. resets its caches and states and syncs renderer variables with actual GL states. More...
 
void resetActiveFramebuffer ()
 Resets active frame buffer for renderer to default (screen). More...
 
void resetClearTarget ()
 Resets clear targets for renderer. More...
 
void resetFrame ()
 Resets frame for core renderer, that is, counters for logging rendering infos (triangle count etc.). More...
 
void resolveMultisample (NativeFramebufferHandle sourceFramebuffer, NativeFramebufferHandle destinationFramebuffer, unsigned int srcOffsetX, unsigned int srcOffsetY, unsigned int srcWidth, unsigned int srcHeight, unsigned int dstOffsetX, unsigned int dstOffsetY, unsigned int dstWidth, unsigned int dstHeight, bool color, bool depth, bool stencil)
 Resolve multisample framebuffer. More...
 
void resolveMultisample (NativeFramebufferHandle sourceFramebuffer, NativeFramebufferHandle destinationFramebuffer, unsigned int srcOffsetX, unsigned int srcOffsetY, unsigned int srcWidth, unsigned int srcHeight, unsigned int dstOffsetX, unsigned int dstOffsetY, unsigned int dstWidth, unsigned int dstHeight)
 Resolve multisample framebuffer. More...
 
void resolveMultisample (Texture &src, Texture &dst, unsigned int offsetX, unsigned int offsetY, unsigned int width, unsigned int height, bool color, bool depth)
 Resolve multisample samples from source texture into destination texture. More...
 
void resolveMultisample (Texture &src, Texture &dst, unsigned int offsetX, unsigned int offsetY, unsigned int width, unsigned int height)
 Resolve multisample samples from source texture into destination texture. More...
 
void setActiveFramebuffer (unsigned int frameBufferHandle)
 Sets active frame buffer for renderer. More...
 
void setActiveFramebufferCallback (FramebufferCallback callbackFunction)
 Sets callback function that is called after setActiveFramebuffer. More...
 
void setActiveGLGraphicsOutput (GLGraphicsOutput *glGraphicsOutput)
 Sets active surface context for renderer. More...
 
void setActiveScalar (GraphicsScalar scalar, float value)
 Switches an scalar value for renderer if necessary, e.g. depth clear value. More...
 
void setActiveShaderHandle (unsigned int activeShaderHandle, const int *vertexAttributeMap)
 Sets active shader for renderer. More...
 
void setActiveTextureUnit (unsigned int textureUnit)
 Sets the currently active texture unit. More...
 
void setBlendMode (int blendMode)
 Sets a blend mode for renderer. More...
 
void setClearColor (ColorRGBA colorRGBA)
 Set clear color for renderer. More...
 
void setClearDepthValue (float clearDepthValue)
 Set clear depth for renderer. More...
 
void setClearStencil (int stencilClearValue)
 Set clear stencil for renderer. More...
 
void setColorBufferCount (unsigned int colorBufferCount)
 Sets the number of draw buffers for currently active framebuffer. More...
 
void setColorWriteMode (GraphicsColorWriteMode colorWriteMode)
 Set a color write mode for renderer. More...
 
void setCullMode (GraphicsCullMode cullMode)
 Sets a cull mode for renderer. More...
 
void setDefaultFramebuffer (unsigned int frameBufferHandle)
 Specifies default frame buffer (screen) for renderer. More...
 
void setDepthTest (GraphicsCompareFunction depthMode)
 Sets a depth pass mode for renderer. More...
 
void setGPUCallsEnabled (bool enabled)
 Sets GPU calls enabled / disabled. More...
 
void setImageTargetTexture (TextureType type, void *imageObject)
 Sets image object bound to currently bound texture (type). More...
 
void setIndexBuffer (unsigned int indexBuffer)
 Sets an index buffer for renderer. More...
 
void setIndexBufferData (size_t dataSize, const void *data)
 Sets static index buffer data. More...
 
void setIndexBufferSubData (unsigned int offset, size_t size, const void *data)
 Uploads index buffer subdata with given offset and size. More...
 
void setIndexCount (unsigned int indexCount)
 Sets the index count for renderer. More...
 
void setIndexData (void *indexData)
 Sets index data for renderer. More...
 
void setIndexData (void *indexData, IndexBufferType type)
 Sets index data for renderer. More...
 
void setLineWidth (float lineWidth)
 Sets line rendering width for renderer. More...
 
void setLogging (bool enabled, bool dumpStateOnDrawCalls)
 Sets OpenGL API call logging on/off. More...
 
void setMatrix (FixedMatrix matrixType, Matrix4x4 matrix)
 Sets matrix for a renderer. More...
 
void setPixelStorePack (unsigned int packBytes)
 Sets pack row alignment in memory. More...
 
void setPixelStoreUnpack (unsigned int unpackBytes)
 Sets unpack row alignment in memory. More...
 
bool setPixelStoreUnpackRowLength (unsigned int rowLength)
 Sets the unpack row length. More...
 
void setPolygonDepthOffset (Vector2 offset)
 Sets the polygon depth offset for the renderer. More...
 
void setPolygonDepthOffset (float derivativeMultiplier, float constantMultiplier)
 Sets the polygon depth offset for the renderer. More...
 
void setPrimitiveType (GraphicsPrimitiveType prmitiveType)
 Sets the primitive type for renderer. More...
 
void setScissorTest (optional< ViewportRectangle > scissor)
 Sets scissor test state and optional rectangle for renderer. More...
 
void setState (RendererState state, bool enable)
 Enables or disables the state of a specific renderer state. More...
 
void setStencilFunction (GraphicsCompareFunction stencilCompareFunction, unsigned int referenceValue, unsigned int maskValue)
 Sets a stencil function for renderer. More...
 
void setStencilOperation (GraphicsStencilOperation stencilFailOperation, GraphicsStencilOperation stencilPassDepthFailOperation, GraphicsStencilOperation stencilPassDepthPassOperation)
 Sets a stencil operation for renderer. More...
 
void setTextureAddressingMode (TextureType type, Sampler::AddressingMode texAddress)
 Sets wrap mode for currently bound texture in current texture unit. More...
 
void setTextureCompare (TextureType type, bool isEnabled, GraphicsCompareFunction textureCompareFunction)
 Sets texture comparison function for currently bound texture in current texture unit. More...
 
void setTextureFilter (TextureType type, Sampler::Filter minificationFilter, Sampler::Filter magnificationFilter, Sampler::MipmapMode mipmapMode, float anisotropy)
 Sets texture filter for currently bound texture in current texture unit. More...
 
void setTextureImage2D (unsigned int glTextureImageTarget, unsigned int mipmapLevel, GraphicsFormat format, unsigned int width, unsigned int height, const void *data)
 Uploads texture data to GPU. More...
 
void setTextureSubImage2D (unsigned int glTextureImageTarget, unsigned int mipmapLevel, GraphicsFormat format, unsigned int x, unsigned int y, unsigned int width, unsigned int height, const void *data)
 Uploads texture subimage data to GPU. More...
 
void setTextureSwizzleMask (TextureType target, const TextureSwizzleMask &mask)
 Sets texture swizzle mask for currently bound alpha only texture in current texture unit. More...
 
void setUniformColorArray (int uniformLocation, unsigned int count, const ColorRGBA *values)
 Sets vector array with dimension to renderer, using currently bound shader. More...
 
void setUniformColorRGBA (const ColorRGBA &value, int uniformLocation)
 Sets ColorRGBA uniform for renderer, using currently bound shader. More...
 
void setUniformFloat (const float &value, int uniformLocation)
 Sets floating point uniform for renderer, using currently bound shader. More...
 
void setUniformFloatArray (int uniformLocation, unsigned int count, const float *values)
 Sets float array with dimension to renderer using currently bound shader. More...
 
void setUniformIntArray (int uniformLocation, unsigned int count, const int *values)
 Sets integer array with dimension to renderer using currently bound shader. More...
 
void setUniformInteger (const int &value, int uniformLocation)
 Sets integer uniform for renderer, using currently bound shader. More...
 
void setUniformMatArray (int uniformLocation, unsigned int count, const Matrix3x3 *values)
 Sets matrix array with dimension to renderer, using currently bound shader. More...
 
void setUniformMatArray (int uniformLocation, unsigned int count, const Matrix4x4 *values)
 Sets matrix array with dimension to renderer, using currently bound shader. More...
 
void setUniformMatrix3x3 (const Matrix3x3 &value, int uniformLocation)
 Sets Matrix3x3 uniform for renderer, using currently bound shader. More...
 
void setUniformMatrix4x4 (const Matrix4x4 &value, int uniformLocation)
 Sets Matrix4x4 uniform for renderer, using currently bound shader. More...
 
void setUniformTexture (int uniformLocation, unsigned int textureUnit)
 Sets the uniform for a texture based on current active texture unit. More...
 
void setUniformVec2 (const Vector2 &value, int uniformLocation)
 Sets Vector2 uniform for renderer, using currently bound shader. More...
 
void setUniformVec3 (const Vector3 &value, int uniformLocation)
 Sets Vector3 uniform for renderer, using currently bound shader. More...
 
void setUniformVec4 (const Vector4 &value, int uniformLocation)
 Sets Vector4 uniform for renderer, using currently bound shader. More...
 
void setUniformVecArray (int uniformLocation, unsigned int count, const Vector2 *values)
 Sets vector array with dimension to renderer, using currently bound shader. More...
 
void setUniformVecArray (int uniformLocation, unsigned int count, const Vector3 *values)
 Sets vector array with dimension to renderer, using currently bound shader. More...
 
void setUniformVecArray (int uniformLocation, unsigned int count, const Vector4 *values)
 Sets vector array with dimension to renderer, using currently bound shader. More...
 
void setVertexArrayData (VertexAttribute::Semantic attribute, GraphicsDataType dataType, const void *data, unsigned int stride)
 Sets vertex array data. More...
 
void setVertexArrayData (VertexAttribute::Semantic attribute, GraphicsDataType dataType, const void *data)
 Sets vertex array data wrapper. More...
 
void setVertexArrayData (VertexAttribute::Semantic attribute, const void *data, unsigned int stride)
 Sets vertex array data wrapper. More...
 
void setVertexArrayData (VertexAttribute::Semantic attribute, const void *data)
 Sets vertex array data wrapper. More...
 
void setVertexBuffer (unsigned int vertexBuffer)
 Sets a vertex buffer for renderer. More...
 
void setVertexBufferData (size_t dataSize, const void *data)
 Sets static vertex buffer data. More...
 
void setVertexBufferPointer (unsigned int location, int dimension, GraphicsDataType attributeDataType, int stride, const void *data)
 Sets attribute data source for currently enabled vertex attribute array. More...
 
void setVertexBufferSubData (unsigned int offset, size_t size, const void *data)
 Uploads vertex buffer subdata with given offset and size. More...
 
void setVertexCount (size_t vertexCount)
 Sets vertex count for renderer. More...
 
void setViewport (ViewportRectangle viewport)
 Sets an active view port for renderer. More...
 
void setWorkaroundEnable (Workaround workaround, bool enabled)
 Set workaround enable state to true or false. More...
 
bool supports (GraphicsFormat format, unsigned int features) const
 Returns whether format supports requested features. More...
 
bool supportsColorAttachment (GraphicsFormat format) const
 Returns whether format can be used as color attachment in framebuffers. More...
 
bool supportsDepthStencilAttachment (GraphicsFormat format) const
 Returns whether format can be used as depth/stencil attachment in framebuffers. More...
 
bool supportsRenderbuffer (GraphicsFormat format) const
 Returns whether format can be used as renderbuffer by the specified renderer. More...
 
bool supportsTexStorage (GraphicsFormat format, unsigned int features) const
 Returns true if graphics format supports texture storage. More...
 
bool supportsTexture (GraphicsFormat format) const
 Returns whether format can be used as texture by the specified renderer. More...
 
void textureStorage (TextureType type, int sampleCount, int mipmapLevelCount, GraphicsFormat format, unsigned int width, unsigned int height, unsigned int depth, bool fixedSampleLocations)
 Specifies immutable texture format and shape. More...
 
void uninitialize ()
 Uninitializes renderer object. More...
 
bool unmapIndexBuffer ()
 Unmaps index buffer. More...
 
bool unmapVertexBuffer ()
 Unmaps vertex buffer. More...
 
 ~Renderer ()
 

Static Public Member Functions

static ClearMode getClearMode (GraphicsFormat format)
 

Friends

RenderingChangeStateFlagoperator &= (RenderingChangeStateFlag &lhs, int rhs)
 And assignment operator for rendering change state flags. More...
 
RenderingChangeStateFlagoperator^= (RenderingChangeStateFlag &lhs, int rhs)
 Xor assignment operator for rendering change state flags. More...
 
RenderingChangeStateFlagoperator|= (RenderingChangeStateFlag &lhs, int rhs)
 Or assignment operator for rendering change state flags. More...
 

Member Typedef Documentation

◆ FramebufferCallback

typedef void(* kanzi::Renderer::FramebufferCallback) (unsigned int frameBufferHandle)

Callback prototype for setActiveFramebuffer.

Member Enumeration Documentation

◆ RenderingChangeStateFlag

Rendering change flag type.

Kanzi internally sets the bits to flag which rendering settings have changed.

Enumerator
RenderingChangeStateFlagNone 

No changes.

RenderingChangeStateFlagColorWriteMode 

Color write mode changed.

RenderingChangeStateFlagBlendMode 

Blend mode changed.

RenderingChangeStateFlagCullMode 

Cull mode changed.

RenderingChangeStateFlagDepthTest 

Depth mode changed.

RenderingChangeStateFlagAll 

Depth mode changed.

◆ Information

Enumerator
InformationGLVendor 
InformationGLRenderer 
InformationGLVersion 
InformationGLShadingLanguageVersion 
InformationGLExtensions 
InformationFormatSupport 
InformationShaderBinarySupport 
InformationProgramBinarySupport 
InformationFeatureSupport 
InformationImplementationDependent 
InformationDebug 
InformationAll 

◆ ClearMode

Per color buffer clear setting.

Enumerator
ClearModeDisabled 

Color buffer will not be cleared.

ClearModeUnsignedNormalized 

Clear color with unsigned normalized color.

ClearModeUnsignedInteger 

Clear color buffer with unsigned integer value.

Note
Integer color buffers require OpenGL ES 3
ClearModeSignedInteger 

Clesr color buffer with signed integer value.

Note
Integer color buffers require OpenGL ES 3
ClearModeFloat 

Clear color buffer with float value.

Note
Float color buffers require OpenGL ES 3.2 or EXT_color_buffer_half_float extension

◆ BufferAccessMode

Mode for accessing a GPU buffer.

Enumerator
ReadOnly 

Only reading the buffer is allowed. Writing it is forbidden.

WriteOnly 

Only writing the buffer is allowed. Reading it is forbidden.

ReadWrite 

Both reading and writing the buffer are allowed.

◆ Workaround

Enumerator
WorkaroundMaliHalfFloatTextureCoordinate 

Disable support for half float vertex attributes on Mali devices.

WorkaroundTegra3ColorBufferHalfFloat 

Enable color buffer half float on Tegra 3.

WorkaroundAdreno330ColorBufferHalfFloat 

Enable color buffer half float on Adreno 330.

WorkaroundChromiumTextureImageUnitCount 

VirtualBox/Chromium incorrectly reports number of image units.

WorkaroundPVRFrameAMDHost 

Disable half float vertex attributes.

WorkaroundAMDCompressedTexStorage 

Disable tex storage.

WorkaroundPVRVFrameOESEGLImageExternal 

Disable OES_EGL_image_external.

WorkaroundPVRVFrameDepth32f 

Disable 32f depth buffer format.

WorkaroundVivanteDepth32f 

Disable 32f depth buffer format.

WorkaroundFaultyRequiredInternalformat 

Disable GL_OES_required_internalformat when vendor is known to have drivers with related issues.

WorkaroundCount 

Constructor & Destructor Documentation

◆ Renderer()

kanzi::Renderer::Renderer ( )
explicit

Creates a new renderer object.

◆ ~Renderer()

kanzi::Renderer::~Renderer ( )

Member Function Documentation

◆ resetFrame()

void kanzi::Renderer::resetFrame ( )

Resets frame for core renderer, that is, counters for logging rendering infos (triangle count etc.).

◆ reset()

void kanzi::Renderer::reset ( )

Resets renderer, e.g. resets its caches and states and syncs renderer variables with actual GL states.

◆ initialize()

void kanzi::Renderer::initialize ( const RendererSettings rendererSettings)

Initializes renderer object.

Requires graphics context.

Parameters
rendererSettingsSettings structure for initializing the renderer.

◆ uninitialize()

void kanzi::Renderer::uninitialize ( )

Uninitializes renderer object.

◆ isInitialized()

bool kanzi::Renderer::isInitialized ( ) const

Tells whether the renderer is initialized.

Returns
True if the renderer is initialized.

◆ setActiveGLGraphicsOutput()

void kanzi::Renderer::setActiveGLGraphicsOutput ( GLGraphicsOutput glGraphicsOutput)

Sets active surface context for renderer.

◆ getActiveGLGraphicsOutput()

GLGraphicsOutput* kanzi::Renderer::getActiveGLGraphicsOutput ( ) const

Gets active surface context from renderer.

◆ getActiveGraphicsContext()

KzsGlGraphicsContext* kanzi::Renderer::getActiveGraphicsContext ( ) const

◆ getActiveSurfaceClientAPI()

SurfaceClientAPI kanzi::Renderer::getActiveSurfaceClientAPI ( ) const

◆ getActiveColorSpace()

SurfaceColorSpace kanzi::Renderer::getActiveColorSpace ( ) const

Gets the active Color Space.

◆ getActiveSurfaceVendor()

::KzsOpenGlVendor kanzi::Renderer::getActiveSurfaceVendor ( ) const

◆ enableState()

void kanzi::Renderer::enableState ( RendererState  state)

Enables a specific renderer state.

◆ disableState()

void kanzi::Renderer::disableState ( RendererState  state)

Disables a specific renderer state.

◆ setState()

void kanzi::Renderer::setState ( RendererState  state,
bool  enable 
)

Enables or disables the state of a specific renderer state.

◆ getState()

bool kanzi::Renderer::getState ( RendererState  state) const

Returns state of a specific renderer state.

◆ clear()

void kanzi::Renderer::clear ( )

Clears currently bound framebuffer with requested buffers.

Buffers can be requested to be clered with addClearTarget() and addClearColor() functions.

◆ resetClearTarget()

void kanzi::Renderer::resetClearTarget ( )

Resets clear targets for renderer.

◆ addClearTarget()

void kanzi::Renderer::addClearTarget ( GraphicsClearTarget  target)

Sets a clearing target for renderer.

See also
addClearColor()
Note
You must use addClearColor to clear color buffers 1..3 (GraphicsClearTargetColor1..3)
Parameters
targetThe buffer to clear, must be GraphicsClearTargetColor0, GraphicsClearTargetDepth or GraphicsClearTargetStencil

◆ getClearMode()

static ClearMode kanzi::Renderer::getClearMode ( GraphicsFormat  format)
static

◆ addClearColor() [1/5]

void kanzi::Renderer::addClearColor ( unsigned int  drawBuffer,
uint32_t  red,
uint32_t  green,
uint32_t  blue,
uint32_t  alpha 
)

Register color clear for unsigned integer color buffer.

All registered clears are performed when clear() is called.

Note
OpenGL ES 3 is required for integer color buffers.
See also
clear()
Parameters
drawBufferIndex of color buffer to clear (0..3).
redClear color red channel value.
greenClear color green channel value.
blueClear color blue channel value.
alphaClear color alpha channel value.

◆ addClearColor() [2/5]

void kanzi::Renderer::addClearColor ( unsigned int  drawBuffer,
int32_t  red,
int32_t  green,
int32_t  blue,
int32_t  alpha 
)

Register color clear for signed integer color buffer.

All registered clears are performed when clear() is called.

Note
OpenGL ES 3 is required for integer color buffers.
See also
clear()
Parameters
drawBufferIndex of color buffer to clear (0..3).
redClear color red channel value.
greenClear color green channel value.
blueClear color blue channel value.
alphaClear color alpha channel value.

◆ addClearColor() [3/5]

void kanzi::Renderer::addClearColor ( unsigned int  drawBuffer,
float  red,
float  green,
float  blue,
float  alpha 
)

Register color clear for float color buffer.

All registered clears are performed when clear() is called.

Note
OpenGL ES 3.2 or EXT_color_buffer_half_float is required for float color buffers.
OpenGL ES 3.0 is required for drawBuffer > 0
See also
clear()
Parameters
drawBufferIndex of color buffer to clear (0..3 for OpenGL ES 3, must be 0 for OpenGL ES 2).
redClear color red channel value.
greenClear color green channel value.
blueClear color blue channel value.
alphaClear color alpha channel value.

◆ addClearColor() [4/5]

void kanzi::Renderer::addClearColor ( unsigned int  drawBuffer,
ColorRGBA  colorRGBA 
)

Register color clear for unsigned normalized color buffer.

All registered clears are performed when clear() is called.

Note
OpenGL ES 3.0 is required for drawBuffer > 0
See also
clear()
Parameters
drawBufferIndex of color buffer to clear (0..3 for OpenGL ES 3, must be 0 for OpenGL ES 2).
colorRGBARGBA clear color.

◆ addClearColor() [5/5]

void kanzi::Renderer::addClearColor ( unsigned int  drawBuffer,
ClearMode  clearMode 
)

Register color clear with value 0.

All registered clears are performed when clear() is called.

Note
OpenGL ES 3.0 is required for drawBuffer > 0
See also
clear()
Parameters
drawBufferIndex of color buffer to clear (0..3 for OpenGL ES 3, must be 0 for OpenGL ES 2).
clearModeClearMode of the color buffer.

◆ removeClearTarget()

void kanzi::Renderer::removeClearTarget ( GraphicsClearTarget  target)

Removes a clearing target for renderer.

◆ hasClearTarget()

bool kanzi::Renderer::hasClearTarget ( GraphicsClearTarget  target) const

Sees if renderer has specific clear target.

◆ isClearEnabled()

bool kanzi::Renderer::isClearEnabled ( ) const

See if clear is enabled.

◆ setClearColor()

void kanzi::Renderer::setClearColor ( ColorRGBA  colorRGBA)

Set clear color for renderer.

◆ setColorWriteMode()

void kanzi::Renderer::setColorWriteMode ( GraphicsColorWriteMode  colorWriteMode)

Set a color write mode for renderer.

◆ getColorWriteMode()

GraphicsColorWriteMode kanzi::Renderer::getColorWriteMode ( ) const

Gets current color write mode from renderer.

◆ setScissorTest()

void kanzi::Renderer::setScissorTest ( optional< ViewportRectangle scissor)

Sets scissor test state and optional rectangle for renderer.

◆ setClearDepthValue()

void kanzi::Renderer::setClearDepthValue ( float  clearDepthValue)

Set clear depth for renderer.

◆ setClearStencil()

void kanzi::Renderer::setClearStencil ( int  stencilClearValue)

Set clear stencil for renderer.

◆ setViewport()

void kanzi::Renderer::setViewport ( ViewportRectangle  viewport)

Sets an active view port for renderer.

◆ setVertexBuffer()

void kanzi::Renderer::setVertexBuffer ( unsigned int  vertexBuffer)

Sets a vertex buffer for renderer.

◆ setIndexBuffer()

void kanzi::Renderer::setIndexBuffer ( unsigned int  indexBuffer)

Sets an index buffer for renderer.

◆ drawBuffers()

void kanzi::Renderer::drawBuffers ( )

Render buffers that are currently bound.

◆ setVertexCount()

void kanzi::Renderer::setVertexCount ( size_t  vertexCount)

Sets vertex count for renderer.

◆ setIndexCount()

void kanzi::Renderer::setIndexCount ( unsigned int  indexCount)

Sets the index count for renderer.

◆ setIndexData() [1/2]

void kanzi::Renderer::setIndexData ( void *  indexData)

Sets index data for renderer.

◆ setIndexData() [2/2]

void kanzi::Renderer::setIndexData ( void *  indexData,
IndexBufferType  type 
)

Sets index data for renderer.

◆ setPrimitiveType()

void kanzi::Renderer::setPrimitiveType ( GraphicsPrimitiveType  prmitiveType)

Sets the primitive type for renderer.

◆ getUniformLocationSlow()

int kanzi::Renderer::getUniformLocationSlow ( const string &  uniformName) const

Finds uniform location for given uniform from active shader.

The data will be stored to uniform cache and fetched from in subsequent calls.

Note
Comparing strings is expensive, so avoid calling this function.

◆ getUniformArrayLength()

unsigned int kanzi::Renderer::getUniformArrayLength ( const char *  uniformName) const

Returns array uniform length for given uniform.

If uniform with given name is not found, returns 0. If uniform is not an array, returns 1.

◆ setUniformIntArray()

void kanzi::Renderer::setUniformIntArray ( int  uniformLocation,
unsigned int  count,
const int *  values 
)

Sets integer array with dimension to renderer using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformFloatArray()

void kanzi::Renderer::setUniformFloatArray ( int  uniformLocation,
unsigned int  count,
const float *  values 
)

Sets float array with dimension to renderer using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformVecArray() [1/3]

void kanzi::Renderer::setUniformVecArray ( int  uniformLocation,
unsigned int  count,
const Vector2 values 
)

Sets vector array with dimension to renderer, using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformVecArray() [2/3]

void kanzi::Renderer::setUniformVecArray ( int  uniformLocation,
unsigned int  count,
const Vector3 values 
)

Sets vector array with dimension to renderer, using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformVecArray() [3/3]

void kanzi::Renderer::setUniformVecArray ( int  uniformLocation,
unsigned int  count,
const Vector4 values 
)

Sets vector array with dimension to renderer, using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformColorArray()

void kanzi::Renderer::setUniformColorArray ( int  uniformLocation,
unsigned int  count,
const ColorRGBA values 
)

Sets vector array with dimension to renderer, using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformMatArray() [1/2]

void kanzi::Renderer::setUniformMatArray ( int  uniformLocation,
unsigned int  count,
const Matrix3x3 values 
)

Sets matrix array with dimension to renderer, using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformMatArray() [2/2]

void kanzi::Renderer::setUniformMatArray ( int  uniformLocation,
unsigned int  count,
const Matrix4x4 values 
)

Sets matrix array with dimension to renderer, using currently bound shader.

Parameters
uniformLocationUniform location ID.
countNumber of entries to set.
valuesValues to set.

◆ setUniformInteger()

void kanzi::Renderer::setUniformInteger ( const int &  value,
int  uniformLocation 
)
inline

Sets integer uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformFloat()

void kanzi::Renderer::setUniformFloat ( const float &  value,
int  uniformLocation 
)
inline

Sets floating point uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformVec2()

void kanzi::Renderer::setUniformVec2 ( const Vector2 value,
int  uniformLocation 
)
inline

Sets Vector2 uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformVec3()

void kanzi::Renderer::setUniformVec3 ( const Vector3 value,
int  uniformLocation 
)
inline

Sets Vector3 uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformVec4()

void kanzi::Renderer::setUniformVec4 ( const Vector4 value,
int  uniformLocation 
)
inline

Sets Vector4 uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformColorRGBA()

void kanzi::Renderer::setUniformColorRGBA ( const ColorRGBA value,
int  uniformLocation 
)
inline

Sets ColorRGBA uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformMatrix3x3()

void kanzi::Renderer::setUniformMatrix3x3 ( const Matrix3x3 value,
int  uniformLocation 
)
inline

Sets Matrix3x3 uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setUniformMatrix4x4()

void kanzi::Renderer::setUniformMatrix4x4 ( const Matrix4x4 value,
int  uniformLocation 
)
inline

Sets Matrix4x4 uniform for renderer, using currently bound shader.

Parameters
valueValue to set.
uniformLocationUniform location ID.

◆ setActiveScalar()

void kanzi::Renderer::setActiveScalar ( GraphicsScalar  scalar,
float  value 
)

Switches an scalar value for renderer if necessary, e.g. depth clear value.

◆ getActiveScalar()

float kanzi::Renderer::getActiveScalar ( GraphicsScalar  scalar) const

Returns a current scalar value from renderer.

◆ setBlendMode()

void kanzi::Renderer::setBlendMode ( int  blendMode)

Sets a blend mode for renderer.

Since
Kanzi 3.9.1 data type of blendMode parameter changed from GraphicsBlendMode to int.

◆ getBlendMode()

int kanzi::Renderer::getBlendMode ( ) const

Gets a blend mode for renderer.

Since
Kanzi 3.9.1 data type of blendMode parameter changed from GraphicsBlendMode to int.

◆ setCullMode()

void kanzi::Renderer::setCullMode ( GraphicsCullMode  cullMode)

Sets a cull mode for renderer.

◆ getCullMode()

GraphicsCullMode kanzi::Renderer::getCullMode ( ) const

Gets a cull mode for renderer.

◆ setDepthTest()

void kanzi::Renderer::setDepthTest ( GraphicsCompareFunction  depthMode)

Sets a depth pass mode for renderer.

◆ getDepthTest()

GraphicsCompareFunction kanzi::Renderer::getDepthTest ( ) const

Gets a depth pass mode for renderer.

◆ setStencilFunction()

void kanzi::Renderer::setStencilFunction ( GraphicsCompareFunction  stencilCompareFunction,
unsigned int  referenceValue,
unsigned int  maskValue 
)

Sets a stencil function for renderer.

◆ setStencilOperation()

void kanzi::Renderer::setStencilOperation ( GraphicsStencilOperation  stencilFailOperation,
GraphicsStencilOperation  stencilPassDepthFailOperation,
GraphicsStencilOperation  stencilPassDepthPassOperation 
)

Sets a stencil operation for renderer.

◆ getStencilFunction()

void kanzi::Renderer::getStencilFunction ( GraphicsCompareFunction out_stencilCompareFunction,
unsigned int *  out_referenceValue,
unsigned int *  out_maskValue 
) const

Gets stencil function from renderer.

◆ getStencilOperation()

void kanzi::Renderer::getStencilOperation ( GraphicsStencilOperation out_stencilFailOperation,
GraphicsStencilOperation out_stencilPassDepthFailOperation,
GraphicsStencilOperation out_stencilPassDepthPassOperation 
) const

Gets a stencil operation from renderer.

◆ setMatrix()

void kanzi::Renderer::setMatrix ( FixedMatrix  matrixType,
Matrix4x4  matrix 
)

Sets matrix for a renderer.

◆ getMatrix()

Matrix4x4 kanzi::Renderer::getMatrix ( FixedMatrix  matrixType) const

Gets a matrix from renderer.

◆ calculateProjectionCameraWorldMatrix()

void kanzi::Renderer::calculateProjectionCameraWorldMatrix ( )

Calculates projection * camera * world matrix.

◆ applyFixedUniformTime()

void kanzi::Renderer::applyFixedUniformTime ( int  uniformLocation)

Applies the Time fixed uniform.

Parameters
uniformLocationUniform location.

◆ applyFixedUniformWindowSize()

void kanzi::Renderer::applyFixedUniformWindowSize ( int  uniformLocation)

Applies the WindowSize fixed uniform.

Parameters
uniformLocationUniform location.

◆ applyTransformationUniform()

void kanzi::Renderer::applyTransformationUniform ( ShaderProgram::FixedUniform  uniform,
int  uniformLocation 
)

Applies a single transformation uniform.

Repeatedly called by applyTransformation().

Parameters
uniformUniform type.
uniformLocationUniform location.

◆ applyTransformation()

void kanzi::Renderer::applyTransformation ( ShaderProgram shaderProgram)

Applies transformations from renderer to GPU.

Parameters
shaderProgramShader program in use.

◆ applyTextureSizeUniforms()

void kanzi::Renderer::applyTextureSizeUniforms ( ShaderTextureUniform  textureUniforms,
unsigned int  textureWidth,
unsigned int  textureHeight 
)

Applies texture uniforms for the renderer.

◆ applyTexture()

void kanzi::Renderer::applyTexture ( TextureType  type,
unsigned int  textureUnit,
unsigned int  handle 
)

Sets texture settings for given texture unit.

This only changes renderer state and does not issue GL calls. The texture unit state must be refreshed for the changes to take effect.

Parameters
typeType of the texture (texture target) to set.
textureUnitTexture unit to set.
handleNative texture handle.

◆ detachTexture()

void kanzi::Renderer::detachTexture ( unsigned int  textureUnit)

Detaches all texture information from given texture unit.

This only changes renderer state and does not issue GL calls. The texture unit state must be refreshed for the changes to take effect.

Parameters
textureUnitTexture unit to set.

◆ setActiveTextureUnit()

void kanzi::Renderer::setActiveTextureUnit ( unsigned int  textureUnit)

Sets the currently active texture unit.

Takes effect immediately. Can be called by the user or is used internally when refreshing texture unit render context.

Parameters
textureUnitTexture unit to activate.

◆ setUniformTexture()

void kanzi::Renderer::setUniformTexture ( int  uniformLocation,
unsigned int  textureUnit 
)

Sets the uniform for a texture based on current active texture unit.

This is essentially an alias for setting an integer uniform.

Parameters
uniformLocationUniform location to apply.
textureUnitTexture unit for this uniform.

◆ bindTexture()

unsigned int kanzi::Renderer::bindTexture ( TextureType  type,
unsigned int  handle 
)

Binds specified texture of specified type to currently active texture unit.

Takes effect immediately, and as a consequence, doesn't flag the texture unit render context dirty.

Parameters
typeType of texture to bind.
handleNative texture handle.
Returns
Previous texture handle bound to current texture unit for this texture type.

◆ generateTexture()

unsigned int kanzi::Renderer::generateTexture ( )

Generates new texture for renderer.

◆ setTextureImage2D()

void kanzi::Renderer::setTextureImage2D ( unsigned int  glTextureImageTarget,
unsigned int  mipmapLevel,
GraphicsFormat  format,
unsigned int  width,
unsigned int  height,
const void *  data 
)

Uploads texture data to GPU.

◆ setTextureSubImage2D()

void kanzi::Renderer::setTextureSubImage2D ( unsigned int  glTextureImageTarget,
unsigned int  mipmapLevel,
GraphicsFormat  format,
unsigned int  x,
unsigned int  y,
unsigned int  width,
unsigned int  height,
const void *  data 
)

Uploads texture subimage data to GPU.

◆ textureStorage()

void kanzi::Renderer::textureStorage ( TextureType  type,
int  sampleCount,
int  mipmapLevelCount,
GraphicsFormat  format,
unsigned int  width,
unsigned int  height,
unsigned int  depth,
bool  fixedSampleLocations 
)

Specifies immutable texture format and shape.

◆ generateMipmaps()

void kanzi::Renderer::generateMipmaps ( TextureType  textureType)

Generates mipmaps for currently bound texture.

◆ deleteTexture()

void kanzi::Renderer::deleteTexture ( unsigned int  textureHandle)

Deletes texture via renderer.

◆ setTextureAddressingMode()

void kanzi::Renderer::setTextureAddressingMode ( TextureType  type,
Sampler::AddressingMode  texAddress 
)

Sets wrap mode for currently bound texture in current texture unit.

◆ setTextureFilter()

void kanzi::Renderer::setTextureFilter ( TextureType  type,
Sampler::Filter  minificationFilter,
Sampler::Filter  magnificationFilter,
Sampler::MipmapMode  mipmapMode,
float  anisotropy 
)

Sets texture filter for currently bound texture in current texture unit.

Parameters
typeSelects which texture to edit (current 2d, cubemap etc.)
minificationFilterMinification filter for texture.
magnificationFilterMagnification filter for texture.
mipmapModeMipmap mode for the texture.
anisotropyAnisotropic filtering level for texture. Values <= 1.0f disable the feature.

◆ setTextureSwizzleMask()

void kanzi::Renderer::setTextureSwizzleMask ( TextureType  target,
const TextureSwizzleMask mask 
)

Sets texture swizzle mask for currently bound alpha only texture in current texture unit.

This method makes all the color channels map to the alpha channel. Note: Use this method only for GraphicsFormatALPHA8_UNORM texture format, and if the native OpenGL driver supports GL_ARB_texture_swizzle or GL_EXT_texture_swizzle extension.

Parameters
targetTarget texture type.
maskSwizzle mask for the texture. This can be a custom swizzle mask or chosen from the predefined ones: SwizzleMaskRGBToLuminanceAlpha and SwizzleMaskLuminanceToRGBA.

◆ setTextureCompare()

void kanzi::Renderer::setTextureCompare ( TextureType  type,
bool  isEnabled,
GraphicsCompareFunction  textureCompareFunction 
)

Sets texture comparison function for currently bound texture in current texture unit.

Parameters
typeSelects which texture to edit (current 2d, cubemap etc.)
isEnabledIf true, depth comparison mode is enabled for the texture, otherwise depth comparison is disabled.
textureCompareFunctionSelects which texture comparison function to use.

◆ setPixelStorePack()

void kanzi::Renderer::setPixelStorePack ( unsigned int  packBytes)

Sets pack row alignment in memory.

Default value is 4.

Parameters
packBytesValue for byte alignment.

◆ setPixelStoreUnpack()

void kanzi::Renderer::setPixelStoreUnpack ( unsigned int  unpackBytes)

Sets unpack row alignment in memory.

Default value is 4.

Parameters
unpackBytesValue for byte alignment.

◆ setPixelStoreUnpackRowLength()

bool kanzi::Renderer::setPixelStoreUnpackRowLength ( unsigned int  rowLength)

Sets the unpack row length.

If nonzero, specifies the number of bytes per row of image data. Use when image data rows are not aligned exactly at bytes per pixel multiplied by image width. Default value is 0.

Parameters
rowLengthNumber of bytes per image row.
Returns
If the target device supports the feature and it is possible to set the row length true, otherwise false.

◆ createShader()

unsigned int kanzi::Renderer::createShader ( ShaderType  type)

Creates shader.

◆ createShaderProgram()

unsigned int kanzi::Renderer::createShaderProgram ( )

Creates shader program. Returns the handle to the program.

◆ refreshRenderContext()

void kanzi::Renderer::refreshRenderContext ( bool  geometryRendering)

Refreshes render context to contain all proper states.

◆ attachShaderToProgram()

void kanzi::Renderer::attachShaderToProgram ( unsigned int  programHandle,
unsigned int  shaderHandle 
)

Attaches shader to program.

◆ detachShaderFromProgram()

void kanzi::Renderer::detachShaderFromProgram ( unsigned int  programHandle,
unsigned int  shaderHandle 
)

Detaches shader from program.

◆ bindAttributeToLocation()

void kanzi::Renderer::bindAttributeToLocation ( unsigned int  programHandle,
unsigned int  locationIndex,
kzString  attributeName 
)

Binds attribute to given location index, for example "kzPosition" to 0.

◆ linkShaderProgram()

bool kanzi::Renderer::linkShaderProgram ( unsigned int  programHandle,
kzString  shaderName 
)

Links shader program with given handle.

◆ compileSourceShader()

bool kanzi::Renderer::compileSourceShader ( ShaderType  shaderType,
unsigned int  shaderHandle,
const char *const  shaderCode,
string_view  shaderName 
)

Compiles source shader and deploys it to GPU.

◆ deployBinaryShader()

bool kanzi::Renderer::deployBinaryShader ( unsigned int  count,
const unsigned int *  shaders,
unsigned int  binaryFormat,
const void *  data,
size_t  dataSize 
)

Deploys binary shaders.

Returns
true if binary shader was accepted by the graphics driver.

◆ deployBinaryProgram()

bool kanzi::Renderer::deployBinaryProgram ( unsigned int  program,
unsigned int  binaryFormat,
const void *  data,
size_t  dataSize 
)

Initializes shader program from program binary data.

Program binaries are vendor, device and driver version specific. If deployBinaryProgram() succeeds, program is in linked state. If deployBinaryProgram() fails, program remains in previous state. See

See also
isProgramBinaryFormatSupported to check if specific program binary format is supported by graphics device. See
getProgramBinary to query back program binary of a previously linked GL shader program from graphics device.
Parameters
programGL shader program name to initialize from program binary data.
binaryFormatBinary format for data.
dataProgram binary data.
dataSizeNumber of bytes in data.
Returns
true if shader program was successfully initialized from program binary data, otherwise false.

◆ getProgramBinary()

string kanzi::Renderer::getProgramBinary ( unsigned int  program,
unsigned int &  binaryFormat 
)

Gets binary representation for GL shader program.

Program binaries are vendor, device and driver version specific.

See also
isProgramBinaryFormatSupported
deployBinaryProgram
Parameters
programGL shader program name to get program binary from.
binaryFormatGL program binary format will be returned here, or KZS_GL_NONE if no program binary format was supported by graphics device.
Returns
Program binary data. If no program binary format was supported by graphics device, size of data will be 0.

◆ deleteShaderProgram()

void kanzi::Renderer::deleteShaderProgram ( unsigned int  programHandle)

Deletes shader program and attached shaders.

◆ deleteShader()

void kanzi::Renderer::deleteShader ( unsigned int  shaderHandle)

Deletes shader.

◆ generateFramebuffer()

unsigned int kanzi::Renderer::generateFramebuffer ( )

Generates new texture for renderer.

◆ deleteFramebuffer()

void kanzi::Renderer::deleteFramebuffer ( unsigned int  frameBufferHandle)

Deletes framebuffer.

◆ bindFramebuffer()

void kanzi::Renderer::bindFramebuffer ( unsigned int  frameBufferHandle)

Binds framebuffer.

◆ isFramebufferComplete()

bool kanzi::Renderer::isFramebufferComplete ( )

Checks if the framebuffer status is complete.

If framebuffer status is not complete, error code will be logged.

Note
Detailed error condition is only available in debug builds.
Avoid calling isFramebufferComplete() in release builds, as this may cause graphics driver to slow down.
Returns
True if status is framebuffer complete, otherwise false.

◆ invalidateFramebufferAttachments()

void kanzi::Renderer::invalidateFramebufferAttachments ( FramebufferTarget  target,
bitset< Surface::APIAttachmentCount attachments 
) const

Invalidates framebuffer attachments.

After invalidation, contents of specified attachments are undefined. The graphics driver may perform performance and memory optimizations when it knows that contents of specific attachments are no longer needed.

Parameters
targetFramebuffer target to invalidate.
attachmentsBits from Framebuffer::AttachmentBit to specify attachments to invalidate. Surfaces that are attached to these attachment points will be invalidated.

◆ framebufferTexture2D()

void kanzi::Renderer::framebufferTexture2D ( unsigned int  glTextureImageTarget,
Surface::APIAttachment  attachment,
unsigned int  textureHandle,
unsigned int  mipmapLevel,
unsigned int  implicitSampleCount 
)

Attaches texture to the currently active Framebuffer.

Parameters
glTextureImageTargetGL texture image target. For cubemap texture this specifies the cubemap face.
attachmentFramebuffer attachment point where texture should be attached to.
textureHandleGL texture object name to attach.
mipmapLevelMipmap level of texture to attach.
implicitSampleCountWhen implicit multisample textures are used, this specifies the number of samples to use. When implicit multisample textures are not used, value here must be 0.

◆ framebufferRenderbuffer()

void kanzi::Renderer::framebufferRenderbuffer ( Surface::APIAttachment  attachment,
unsigned int  renderbuffer 
)

Attaches renderbuffer to the currently active Framebuffer.

Parameters
attachmentFramebuffer attachment point where renderbuffer should be attached to.
renderbufferGL renderbuffer object name to attach.

◆ generateRenderbuffer()

unsigned int kanzi::Renderer::generateRenderbuffer ( )

Generates new texture for renderer.

Returns
Newly allocated GL renderbuffer object name.

◆ deleteRenderbuffer()

void kanzi::Renderer::deleteRenderbuffer ( unsigned int  renderbuffer)

Deletes framebuffer.

Parameters
renderbufferGL renderbuffer object name to delete.

◆ bindRenderbuffer()

void kanzi::Renderer::bindRenderbuffer ( unsigned int  renderbuffer)

Binds framebuffer for editing.

Parameters
renderbufferGl renderbuffer object name to bind.

◆ renderbufferStorage()

void kanzi::Renderer::renderbufferStorage ( GraphicsFormat  format,
unsigned int  width,
unsigned int  height,
unsigned int  explicitSampleCount 
)

Sets storage for currently bound renderbuffer.

Parameters
formatGraphicsFormat for the renderbuffer.
widthWidth for the renderbuffer in pixels.
heightHeight for the renderbuffer in pixels.
explicitSampleCountNumber of multisample samples.

◆ generateBuffer()

unsigned int kanzi::Renderer::generateBuffer ( )

Generates new index or vertex buffer or uniform buffer object name.

◆ setVertexBufferData()

void kanzi::Renderer::setVertexBufferData ( size_t  dataSize,
const void *  data 
)

Sets static vertex buffer data.

◆ setIndexBufferData()

void kanzi::Renderer::setIndexBufferData ( size_t  dataSize,
const void *  data 
)

Sets static index buffer data.

◆ setVertexBufferSubData()

void kanzi::Renderer::setVertexBufferSubData ( unsigned int  offset,
size_t  size,
const void *  data 
)

Uploads vertex buffer subdata with given offset and size.

◆ setIndexBufferSubData()

void kanzi::Renderer::setIndexBufferSubData ( unsigned int  offset,
size_t  size,
const void *  data 
)

Uploads index buffer subdata with given offset and size.

◆ deleteBuffer()

void kanzi::Renderer::deleteBuffer ( unsigned int  handle)

Deletes vertex or index buffer.

◆ mapVertexBuffer()

void* kanzi::Renderer::mapVertexBuffer ( unsigned int  size,
BufferAccessMode  mode 
)

Maps vertex buffer.

Parameters
sizeSize in bytes of the mapped area of the buffer.
modeBuffer access mode, which can be read, write, or both.

◆ unmapVertexBuffer()

bool kanzi::Renderer::unmapVertexBuffer ( )

Unmaps vertex buffer.

Returns
Indicates whether the unmapping failed.

◆ mapIndexBuffer()

void* kanzi::Renderer::mapIndexBuffer ( unsigned int  size,
BufferAccessMode  mode 
)

Maps index buffer.

Parameters
sizeSize in bytes of the mapped area of the buffer.
modeBuffer access mode, which can be read, write, or both.

◆ unmapIndexBuffer()

bool kanzi::Renderer::unmapIndexBuffer ( )

Unmaps index buffer.

Returns
Indicates whether the unmapping failed.

◆ enableVertexAttributeArray()

void kanzi::Renderer::enableVertexAttributeArray ( unsigned int  attributeHandle)

Sets vertex attribute array to be enabled.

Deprecated:
Implicitly handled by beginVertexArray() and setVertexBufferPointer().
Parameters
attributeHandleindex to attribute to enable

◆ disableVertexAttributeArray()

void kanzi::Renderer::disableVertexAttributeArray ( unsigned int  attributeHandle)

Sets vertex attribute array to be disabled.

Deprecated:
Implicitly handled by beginVertexArray() and setVertexBufferPointer().
Parameters
attributeHandleindex to attribute to disable

◆ applyVertexAttributeArrays()

void kanzi::Renderer::applyVertexAttributeArrays ( )

Update vertex attribute configurations to the graphics driver.

This should be called before each draw call if vertex attribute configuration has been changed with any of enableVertexAttributeArray(), disableVertexAttributeArray() or setVertexBufferPointer().

◆ setVertexBufferPointer()

void kanzi::Renderer::setVertexBufferPointer ( unsigned int  location,
int  dimension,
GraphicsDataType  attributeDataType,
int  stride,
const void *  data 
)

Sets attribute data source for currently enabled vertex attribute array.

Note
Attribute will be sourced from the vertex buffer (GPU memory) which is current at the time of call to setVertexBufferPointer(). If current vertex buffer is zero, attribute data is sourced from CPU memory (also known as "client side data" in OpenGL).
Parameters
locationAttribute location.
dimensionNumber of vector components in the attribute. Valid values are 1, 2, 3 and 4.
attributeDataTypeData type for attribute.
strideStride, number of bytes to get from one vertex to the next vertex. Valid values are positive integers.
dataIf current vertex buffer is non-zero, this is offset in bytes to current vertex buffer GPU memory. If current vertex buffer is zero, this is CPU memory address to attribute data.

◆ setActiveShaderHandle()

void kanzi::Renderer::setActiveShaderHandle ( unsigned int  activeShaderHandle,
const int *  vertexAttributeMap 
)

Sets active shader for renderer.

◆ getActiveShaderHandle()

unsigned int kanzi::Renderer::getActiveShaderHandle ( ) const

Gets active shader handle from renderer.

◆ getActiveShaderAttributeMap()

const int* kanzi::Renderer::getActiveShaderAttributeMap ( ) const

Gets active vertex attribute map from renderer.

◆ setDefaultFramebuffer()

void kanzi::Renderer::setDefaultFramebuffer ( unsigned int  frameBufferHandle)

Specifies default frame buffer (screen) for renderer.

◆ setActiveFramebuffer()

void kanzi::Renderer::setActiveFramebuffer ( unsigned int  frameBufferHandle)

Sets active frame buffer for renderer.

Parameters
frameBufferHandleHandle to bind for rendering.

◆ setColorBufferCount()

void kanzi::Renderer::setColorBufferCount ( unsigned int  colorBufferCount)

Sets the number of draw buffers for currently active framebuffer.

Note
OpenGL ES 3 is required for drawBufferCount > 1
Parameters
colorBufferCountNumber of color attachments.

◆ resetActiveFramebuffer()

void kanzi::Renderer::resetActiveFramebuffer ( )

Resets active frame buffer for renderer to default (screen).

◆ setActiveFramebufferCallback()

void kanzi::Renderer::setActiveFramebufferCallback ( FramebufferCallback  callbackFunction)

Sets callback function that is called after setActiveFramebuffer.

◆ getActiveFramebuffer()

unsigned int kanzi::Renderer::getActiveFramebuffer ( ) const

Gets active frame buffer handle from.

◆ readPixels()

void kanzi::Renderer::readPixels ( int  x,
int  y,
int  width,
int  height,
GraphicsFormat  format,
void *  pixels 
)

Reads the pixels from the current frame buffer.

◆ getNativePixelReadFormat()

GraphicsFormat kanzi::Renderer::getNativePixelReadFormat ( )

Returns native pixel read format from renderer.

◆ beginMaterialSetup()

void kanzi::Renderer::beginMaterialSetup ( )

Begins a material for renderer.

◆ endMaterialSetup()

void kanzi::Renderer::endMaterialSetup ( )

Ends a material for renderer.

◆ beginVertexArray()

void kanzi::Renderer::beginVertexArray ( )

Begins set of vertex arrays.

◆ setVertexArrayData() [1/4]

void kanzi::Renderer::setVertexArrayData ( VertexAttribute::Semantic  attribute,
GraphicsDataType  dataType,
const void *  data,
unsigned int  stride 
)

Sets vertex array data.

Value 0u for stride means the elements are tightly packed.

Parameters
attributeSemantic attribute used.
dataTypeVertex data type.
dataVertex data pointer.
strideVertex stride in bytes.

◆ setVertexArrayData() [2/4]

void kanzi::Renderer::setVertexArrayData ( VertexAttribute::Semantic  attribute,
GraphicsDataType  dataType,
const void *  data 
)
inline

Sets vertex array data wrapper.

Stride defaults to 0u.

Parameters
attributeSemantic attribute used.
dataTypeVertex data type.
dataVertex data pointer.

◆ setVertexArrayData() [3/4]

void kanzi::Renderer::setVertexArrayData ( VertexAttribute::Semantic  attribute,
const void *  data,
unsigned int  stride 
)
inline

Sets vertex array data wrapper.

Data type defaults to 32-bit float.

Parameters
attributeSemantic attribute used.
dataVertex data pointer.
strideVertex stride in bytes.

◆ setVertexArrayData() [4/4]

void kanzi::Renderer::setVertexArrayData ( VertexAttribute::Semantic  attribute,
const void *  data 
)
inline

Sets vertex array data wrapper.

Data type defaults to 32-bit float. Stride defaults to 0u.

Parameters
attributeSemantic attribute used.
dataVertex data pointer.

◆ endVertexArray()

void kanzi::Renderer::endVertexArray ( GraphicsPrimitiveType  primitiveType,
unsigned int  count 
)

Ends vertex array. Renders the specified vertex lists and finishes the usage.

◆ getCurrentVertexArrayFlags()

unsigned int kanzi::Renderer::getCurrentVertexArrayFlags ( ) const

Gets the current vertex array flags from renderer.

◆ getCurrentVertexArrayAttributeData()

const void* kanzi::Renderer::getCurrentVertexArrayAttributeData ( VertexAttribute::Semantic  attribute) const

Gets current vertex array data from renderer. Reset when switching the shader.

◆ getLineWidth()

float kanzi::Renderer::getLineWidth ( ) const

Gets the line width assigned to the renderer.

The default line width is 1.0f.

Returns
Line width.
Since
Kanzi 3.9.4

◆ setLineWidth()

void kanzi::Renderer::setLineWidth ( float  lineWidth)

Sets line rendering width for renderer.

Parameters
lineWidthLine width.

◆ getPolygonDepthOffset()

Vector2 kanzi::Renderer::getPolygonDepthOffset ( ) const

Gets the polygon depth offset assigned to the renderer.

If the offset is Vector2(0.0f, 0.0f), the feature is disabled.

Returns
The polygon depth offset.
Since
Kanzi 3.9.4

◆ setPolygonDepthOffset() [1/2]

void kanzi::Renderer::setPolygonDepthOffset ( Vector2  offset)

Sets the polygon depth offset for the renderer.

This affects the depth offset of filled polygons only. Kanzi calculates the offset to add as:

dz * X + units * Y

Where:

  • dZ is the depth change derivative for the fragment.
  • units is the smallest measurable unit of depth.

To disable the feature, set both components to the default value 0.0f.

Parameters
offsetDepth offset multipliers (derivative, constant).
Since
Kanzi 3.9.4

◆ setPolygonDepthOffset() [2/2]

void kanzi::Renderer::setPolygonDepthOffset ( float  derivativeMultiplier,
float  constantMultiplier 
)
inline

Sets the polygon depth offset for the renderer.

Parameters
derivativeMultiplierMultiplier for the Z derivative.
constantMultiplierMultiplier for the constant units.
Since
Kanzi 3.9.4

◆ flush()

void kanzi::Renderer::flush ( ) const

Flushes the GPU pipeline, forces all commands to be executed in finite time.

◆ pushStatistics()

void kanzi::Renderer::pushStatistics ( )

◆ popStatistics()

void kanzi::Renderer::popStatistics ( )

◆ getIndexCount()

unsigned int kanzi::Renderer::getIndexCount ( ) const

Gets index count from renderer.

◆ getTriangleCount()

unsigned int kanzi::Renderer::getTriangleCount ( ) const

Gets triangle count from renderer.

◆ getVertexCount()

size_t kanzi::Renderer::getVertexCount ( ) const

Gets vertex count from renderer.

◆ getBatchCount()

unsigned int kanzi::Renderer::getBatchCount ( ) const

Gets batch count from renderer (number of draw calls, such as drawElements and drawArrays).

◆ getShaderSwitchCount()

unsigned int kanzi::Renderer::getShaderSwitchCount ( ) const

Gets shader switches.

◆ getUniformSendCount()

unsigned int kanzi::Renderer::getUniformSendCount ( ) const

Gets uniform sending count from renderer.

◆ getTextureSwitchCount()

unsigned int kanzi::Renderer::getTextureSwitchCount ( ) const

Gets number of texture switches from renderer.

◆ getFramebufferSwitchCount()

unsigned int kanzi::Renderer::getFramebufferSwitchCount ( ) const

Gets number of framebuffer switches from renderer.

◆ getBufferSwitchCount()

unsigned int kanzi::Renderer::getBufferSwitchCount ( ) const

Gets number of buffer switches (VBO + IBO) from renderer.

◆ getHeavyweightCallCount()

unsigned int kanzi::Renderer::getHeavyweightCallCount ( ) const

Returns potential heavyweight calls such as buffer or texture updates and glFinish from renderer.

Potential due to GPU implementation may decide when heavyweight occurs (e.g. reading cannot be performed before write operation finishes).

◆ isShaderBinaryFormatSupported()

bool kanzi::Renderer::isShaderBinaryFormatSupported ( unsigned int  glShaderBinaryFormat) const

Checks if GL shader binary format is supported.

Parameters
glShaderBinaryFormatGL shader binary format to check
Returns
True if shader binary format is supported.

◆ isProgramBinaryFormatSupported()

bool kanzi::Renderer::isProgramBinaryFormatSupported ( unsigned int  glProgramBinaryFormat) const

Checks if GL program binary format is supported.

Parameters
glProgramBinaryFormatGL program binary format to check
Returns
True if program binary format is supported.

◆ setGPUCallsEnabled()

void kanzi::Renderer::setGPUCallsEnabled ( bool  enabled)

Sets GPU calls enabled / disabled.

◆ GPUCallsIsEnabled()

bool kanzi::Renderer::GPUCallsIsEnabled ( ) const

Checks if GPU calls are enabled.

Returns
If GPU calls are enabled true, otherwise false.

◆ isSupported()

bool kanzi::Renderer::isSupported ( RendererSupport  feature) const

Is coverage buffer supported or not.

Parameters
featureFeature to check.
Returns
If supported true, otherwise false.

◆ getMultisampleSupport()

Multisample kanzi::Renderer::getMultisampleSupport ( ) const

Return support for multisample textures and renderbuffers.

Returns
Multisampling support enum.

◆ getProgramBinarySupport()

ProgramBinary kanzi::Renderer::getProgramBinarySupport ( ) const

Return support for program binaries.

Returns
Program binary support enum.

◆ getHalfFloatTextureSupport()

HalfFloatTexture kanzi::Renderer::getHalfFloatTextureSupport ( ) const

Return support for half float texture format.

Returns
Half float texture support enum.

◆ getHalfFloatVertexAttributeSupport()

HalfFloatVertexAttribute kanzi::Renderer::getHalfFloatVertexAttributeSupport ( ) const
inline

Return support for half-float vertex attribute.

Returns
Half-float vertex attribute support enum.

◆ isHalfFloatVertexAttributeSupported()

bool kanzi::Renderer::isHalfFloatVertexAttributeSupported ( ) const
inline

Indicates whether half-float vertex attribute is supported in any fashion.

Returns
If supported true, otherwise false.

◆ getFloatTextureSupport()

FloatTexture kanzi::Renderer::getFloatTextureSupport ( ) const

Return support for float texture format.

Returns
Float texture support enum.

◆ getTexStorageSupport() [1/2]

TexStorage kanzi::Renderer::getTexStorageSupport ( ) const

Return support for tex storage.

Returns
Tex storage support enum.

◆ getDrawBuffersSupport()

DrawBuffers kanzi::Renderer::getDrawBuffersSupport ( ) const

Return support for draw buffers.

Returns
Draw buffers support enum.

◆ getTexStorageSupport() [2/2]

bool kanzi::Renderer::getTexStorageSupport ( TextureType  type,
unsigned int  samples 
) const

Return support for tex storage.

Parameters
typeTexture type requested.
samplesSample count requested.
Returns
If supported true, otherwise false.

◆ createImageObject()

void* kanzi::Renderer::createImageObject ( void *  dataPointer,
int  target,
int *  attributes 
)

Creates image object, returns NULL if no hardware support.

Image object can be bound as texture input. Requires surface to be set for renderer via setSurface, otherwise throws an error.

◆ deleteImageObject()

void kanzi::Renderer::deleteImageObject ( void *  imageObject)

Deletes image object created with createImageObject.

◆ setImageTargetTexture()

void kanzi::Renderer::setImageTargetTexture ( TextureType  type,
void *  imageObject 
)

Sets image object bound to currently bound texture (type).

◆ getMaximumAnisotropy()

float kanzi::Renderer::getMaximumAnisotropy ( ) const

Gets maximum anisotropy.

◆ getMaximumTextureSize()

unsigned int kanzi::Renderer::getMaximumTextureSize ( TextureType  textureType) const

Gets maximum texture side size.

◆ getMaximumRenderbufferSize()

unsigned int kanzi::Renderer::getMaximumRenderbufferSize ( ) const

Gets maximum renderbuffer size.

◆ getMaximumViewportWidth()

unsigned int kanzi::Renderer::getMaximumViewportWidth ( ) const

Gets maximum viewport width.

◆ getMaximumViewportHeight()

unsigned int kanzi::Renderer::getMaximumViewportHeight ( ) const

Gets maximum viewport height.

◆ getMaximumVertexAttributeCount()

unsigned int kanzi::Renderer::getMaximumVertexAttributeCount ( ) const

Gets maximum vertex attribute count.

◆ getMaximumSampleCount()

unsigned int kanzi::Renderer::getMaximumSampleCount ( ) const

Gets maximum sample count for multisample.

◆ getColorReadFormat()

int kanzi::Renderer::getColorReadFormat ( )

Returns GL constant for the color read format used in reading back data from framebuffer (RendererReadPixels).

◆ getColorReadType()

int kanzi::Renderer::getColorReadType ( )

Returns GL constant for the color read type used in reading back data from framebuffer (RendererReadPixels).

◆ invalidateAllocations()

void kanzi::Renderer::invalidateAllocations ( )

Invalidates all handles from renderer without affecting GL state.

◆ logOpenGLInformation()

void kanzi::Renderer::logOpenGLInformation ( unsigned int  flags) const

Logs information about renderer capabilities.

◆ resolveMultisample() [1/4]

void kanzi::Renderer::resolveMultisample ( NativeFramebufferHandle  sourceFramebuffer,
NativeFramebufferHandle  destinationFramebuffer,
unsigned int  srcOffsetX,
unsigned int  srcOffsetY,
unsigned int  srcWidth,
unsigned int  srcHeight,
unsigned int  dstOffsetX,
unsigned int  dstOffsetY,
unsigned int  dstWidth,
unsigned int  dstHeight,
bool  color,
bool  depth,
bool  stencil 
)

Resolve multisample framebuffer.

Performs a blit from source framebuffer into destination framebuffer. This has implicit effect of resolving multisample samples.

Parameters
sourceFramebufferSource framebuffer handle.
destinationFramebufferDestination framebuffer handle.
srcOffsetXCopied area x offset in source framebuffer.
srcOffsetYCopied area y offset in source framebuffer.
srcWidthCopied area width in source framebuffer.
srcHeightCopied area height in source framebuffer.
dstOffsetXCopied area x offset in destination framebuffer.
dstOffsetYCopied area y offset in destination framebuffer.
dstWidthCopied area width in destination framebuffer.
dstHeightCopied area height in destination framebuffer.
colorSet to true to resolve color channel.
depthSet to true to resolve depth channel.
stencilSet to true to resolve stencil channel.

◆ resolveMultisample() [2/4]

void kanzi::Renderer::resolveMultisample ( NativeFramebufferHandle  sourceFramebuffer,
NativeFramebufferHandle  destinationFramebuffer,
unsigned int  srcOffsetX,
unsigned int  srcOffsetY,
unsigned int  srcWidth,
unsigned int  srcHeight,
unsigned int  dstOffsetX,
unsigned int  dstOffsetY,
unsigned int  dstWidth,
unsigned int  dstHeight 
)
inline

Resolve multisample framebuffer.

Performs a blit from source framebuffer into destination framebuffer. This has implicit effect of resolving multisample samples. Only resolves color buffer.

Parameters
sourceFramebufferSource framebuffer handle.
destinationFramebufferDestination framebuffer handle.
srcOffsetXCopied area x offset in source framebuffer.
srcOffsetYCopied area y offset in source framebuffer.
srcWidthCopied area width in source framebuffer.
srcHeightCopied area height in source framebuffer.
dstOffsetXCopied area x offset in destination framebuffer.
dstOffsetYCopied area y offset in destination framebuffer.
dstWidthCopied area width in destination framebuffer.
dstHeightCopied area height in destination framebuffer.

◆ resolveMultisample() [3/4]

void kanzi::Renderer::resolveMultisample ( Texture src,
Texture dst,
unsigned int  offsetX,
unsigned int  offsetY,
unsigned int  width,
unsigned int  height,
bool  color,
bool  depth 
)

Resolve multisample samples from source texture into destination texture.

Parameters
srcSource texture (with multisampling enabled).
dstDestination texture (with multisampling disabled).
offsetXCopied area x offset both in source and target texture.
offsetYCopied area y offset both in source and target texture.
widthWidth of the area to be copied from source to destination.
heightHeight of the area to be copied from source to destination.
colorSet to true to resolve color channel.
depthSet to true to resolve depth channel.

◆ resolveMultisample() [4/4]

void kanzi::Renderer::resolveMultisample ( Texture src,
Texture dst,
unsigned int  offsetX,
unsigned int  offsetY,
unsigned int  width,
unsigned int  height 
)
inline

Resolve multisample samples from source texture into destination texture.

Only resolves color buffer.

Parameters
srcSource texture (with multisampling enabled).
dstDestination texture (with multisampling disabled).
offsetXCopied area x offset both in source and target texture.
offsetYCopied area y offset both in source and target texture.
widthWidth of the area to be copied from source to destination.
heightHeight of the area to be copied from source to destination.

◆ getViewport()

ViewportRectangle kanzi::Renderer::getViewport ( ) const
inline

Gets current viewport rectangle from renderer.

◆ getScissor()

ViewportRectangle kanzi::Renderer::getScissor ( ) const
inline

Gets current scissor rectangle from renderer.

The rectangle is returned even if scissor test is not enabled. In this situation it is the last set scissor rectangle.

◆ enableWorkaround()

void kanzi::Renderer::enableWorkaround ( Workaround  workaround)
inline

Enable a renderer workaround.

◆ disableWorkaround()

void kanzi::Renderer::disableWorkaround ( Workaround  workaround)
inline

Disable a renderer workaround.

◆ isWorkaroundEnabled()

bool kanzi::Renderer::isWorkaroundEnabled ( Workaround  workaround) const
inline

Return if workaround is enabled or not.

◆ setWorkaroundEnable()

void kanzi::Renderer::setWorkaroundEnable ( Workaround  workaround,
bool  enabled 
)
inline

Set workaround enable state to true or false.

◆ findValidTextureFormat()

GraphicsFormat kanzi::Renderer::findValidTextureFormat ( GraphicsFormat  format,
unsigned int  features 
) const

Find a valid texture format which is supported by graphics adapter and is compatible with specified format.

Returned format must be binary compatible with the format parameter. For example, input ETC1 format can return ETC2 format).

Parameters
formatFormat that result format should be compatible with.
featuresUsage bits that should be supported by the format.
Returns
Format which is compatible with requested format, or GraphicsFormatNone if no such format exists.

◆ getFeatures()

unsigned int kanzi::Renderer::getFeatures ( GraphicsFormat  format) const

Describes what the specified format can be used for in the specified renderer.

◆ supports()

bool kanzi::Renderer::supports ( GraphicsFormat  format,
unsigned int  features 
) const

Returns whether format supports requested features.

◆ supportsTexture()

bool kanzi::Renderer::supportsTexture ( GraphicsFormat  format) const

Returns whether format can be used as texture by the specified renderer.

◆ supportsRenderbuffer()

bool kanzi::Renderer::supportsRenderbuffer ( GraphicsFormat  format) const

Returns whether format can be used as renderbuffer by the specified renderer.

◆ supportsColorAttachment()

bool kanzi::Renderer::supportsColorAttachment ( GraphicsFormat  format) const

Returns whether format can be used as color attachment in framebuffers.

◆ supportsDepthStencilAttachment()

bool kanzi::Renderer::supportsDepthStencilAttachment ( GraphicsFormat  format) const

Returns whether format can be used as depth/stencil attachment in framebuffers.

◆ getFallback()

GraphicsFormat kanzi::Renderer::getFallback ( GraphicsFormat  format,
unsigned int  usageFlags 
) const

Returns a fallback format which supports specified usage flags.

◆ getDepthStencilFormatForRenderbuffer()

GraphicsFormat kanzi::Renderer::getDepthStencilFormatForRenderbuffer ( bool  depth,
bool  stencil 
) const

Returns a depth/stencil renderbuffer format which is supported by renderer.

◆ getDepthStencilFormatForTexture()

GraphicsFormat kanzi::Renderer::getDepthStencilFormatForTexture ( bool  depth,
bool  stencil 
) const

Returns a depth/stencil texture format which is supported by renderer.

◆ applyAttributePointer()

void kanzi::Renderer::applyAttributePointer ( unsigned int  location,
int  dimension,
GraphicsDataType  dataType,
int  stride,
const void *  data 
) const

For given vertex attribute, specified by attribute location, configures attribute dimension, datatype, stride and starting offset in current vertex buffer.

Note
Attribute data is sourced from the vertex buffer GPU memory which is current at the time of applyAttributePointer() call. If current vertex buffer is 0, attribute data is sourced from CPU memory (also known as "client side data" in OpenGL).
Parameters
locationAttribute location to modify.
dimensionDimension for attribute. Valid values are 1, 2, 3 and 4.
dataTypeData type for attribute.
strideStride for attribute. Valid values are positive integers.
dataStarting offset in current vertex buffer GPU memory for attribute data. If current vertex buffer is 0, this is starting address in CPU memory for attribute data.

◆ getGLFormatTriplet()

void kanzi::Renderer::getGLFormatTriplet ( GraphicsFormat  format,
unsigned int  features,
unsigned int *  out_glFormat,
unsigned int *  out_glInternalFormat,
unsigned int *  out_glType 
) const

Returns GL API format, internal format, type triplet for given Format.

◆ supportsTexStorage()

bool kanzi::Renderer::supportsTexStorage ( GraphicsFormat  format,
unsigned int  features 
) const

Returns true if graphics format supports texture storage.

◆ clearUniformCaches()

void kanzi::Renderer::clearUniformCaches ( )

Free memory used by uniform caches.

◆ advanceGlobalTime()

void kanzi::Renderer::advanceGlobalTime ( chrono::milliseconds  deltaTime)

Advances renderer wall clock with time delta.

Parameters
deltaTimeWall clock delta time.

◆ getGlobalTime()

chrono::milliseconds kanzi::Renderer::getGlobalTime ( ) const

Gets wall clock time in milliseconds since program start.

◆ getGlesVersion()

int kanzi::Renderer::getGlesVersion ( ) const

Returns supported OpenGL ES version number.

Version is encoded into integer with the following formula: major version times 100 plus minor version times ten. For example, value 310 would mean version 3.1.

Returns
OpenGL ES version number.

◆ getLogging()

bool kanzi::Renderer::getLogging ( ) const

Returns current OpenGL API call logging setting.

Returns
True, if logging is enabled.

◆ getDumpStateOnDrawCalls()

bool kanzi::Renderer::getDumpStateOnDrawCalls ( ) const

Returns current dump state on draw calls setting.

Returns
True, if dump state on draw calls is enabled.

◆ setLogging()

void kanzi::Renderer::setLogging ( bool  enabled,
bool  dumpStateOnDrawCalls 
)

Sets OpenGL API call logging on/off.

Parameters
enabledNew logging setting.
dumpStateOnDrawCallsNew dump state on draw calls setting.

Friends And Related Function Documentation

◆ operator &=

RenderingChangeStateFlag& operator&= ( RenderingChangeStateFlag lhs,
int  rhs 
)
friend

And assignment operator for rendering change state flags.

Parameters
lhsLeft-hand-side operand.
rhsRight-hand-side operand.
Returns
Modified change state flag.

◆ operator|=

RenderingChangeStateFlag& operator|= ( RenderingChangeStateFlag lhs,
int  rhs 
)
friend

Or assignment operator for rendering change state flags.

Parameters
lhsLeft-hand-side operand.
rhsRight-hand-side operand.
Returns
Modified change state flag.

◆ operator^=

RenderingChangeStateFlag& operator^= ( RenderingChangeStateFlag lhs,
int  rhs 
)
friend

Xor assignment operator for rendering change state flags.

Parameters
lhsLeft-hand-side operand.
rhsRight-hand-side operand.
Returns
Modified change state flag.

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