Candera Device

Shared Sampler Objects

On OpenGL ES 3.0 Platforms texture sampling parameters is decoupled from texture information using sampler objects. The benefit is that multiple textures may share the same sampling parameters and therefore a sampler object. A sampler object can be bound to a texture unit in a single draw call, eliminating the need to set all sampling parameters such as filter mode, wrap mode or anisotropy separately per frame.

In Candera the usage of sampler objects is implicit and hidden from the user. The RenderDevice will determine which textures can share a sampler object and will bind them accordingly. Sampler objects can be shared if the MinLod and MaxLod parameters are left at their default values, to utilize the full potential of sampler objects it is beneficial if the other sampler parameters MaxAnisotropy, WrapMode, MipMapFilter, MagnificationFilter and MinificationFilter are the same for as many textures as possible. The LodBias parameter has no effect on sampler objects as it is a texture parameter only.

A new value recorder id was added for CGI Studio Analyzer to track the number of sampler objects that are created: ValueRecId::SamplerObjectCount. The value represents the number of sampler objects created across all contexts.


DirectTextureImage Alpha Format

The newest iMX6 drivers support setting an 8 bit alpha format on DirectTextureImage. The format FormatAlpha has been added.


Added check for custom Bitmap Format

A check for custom bitmap format has been added to Bitmap class. The new function is used by Candera RenderDevice to check the bitmap format before Upload is attempted.

Bitmap size computation

As different platforms support different bitmap formats, the size of the pixel array for a bitmap, in VRAM, is platform dependent. To provide a more accurate value for this size the following modifications were made:

  • new RenderDevice::GetSize and RenderDevice2D::GetSize methods were added. This method receives a Bitmap parameter and returns the size of its pixel array in VRAM.
  • new BitmapImage2D::GetSize method was added. This method returns the estimated value of the video memory used by the bitmap.
  • the possibility to explicitly specify a size for a Bitmap within the constructor was preserved. However, the automatic computation of the size, if default value 0 is used with the constructor, was removed. Now, if default value 0 is used for the size parameter in constructor, Bitmap::GetSize method returns 0. If a value is set for size parameter, the Bitmap::GetSize method returns this value.

New draw methods for RenderTarget class

New RenderTarget::SafeBeginDraw, RenderTarget::SafeEndDraw and RenderTarget::GetActiveRenderTarget methods have been added.

SafeBeginDraw and SafeEndDraw are used to store the active render target during RenderTarget::BeginDraw / RenderTarget::EndDraw sequence. A pointer to the active RenderTarget is set on a SafeBeginDraw call and reset to 0 on a SafeEndDraw call.

The stored render target can be further retrieve using RenderTarget::GetActiveRenderTarget method.

As the current active render target is further used in the internal implementation of Candera, it is recommended to change calls of BeginDraw and EndDraw to calls of SafeBeginDraw and SafeEndDraw.


Revision #4
Created 2023-03-02 06:16:37 UTC by Kanai Tomoaki
Updated 2023-06-19 05:52:57 UTC by Tsuyoshi.Kato