nCine::RHI::RhiCapabilitiesBase class

Backend-independent part of the RHI capabilities.

Owns the cached version numbers, information strings, integer limits and extension flags and answers every IRhiCapabilities query out of them - everything that does not depend on how the values were obtained. A backend derives from this and fills the storage in its constructor: the OpenGL family backend queries the live context (see GL::GLRhiCapabilities), every other backend publishes the limits it already knows through SetDeviceCapabilities().

Base classes

class IRhiCapabilities
Interface to query the runtime capabilities of the selected RHI backend.

Derived classes

class D3D11RhiCapabilities
Runtime capabilities of the Direct3D 11 backend.
class GLRhiCapabilities
Runtime capabilities of the OpenGL family backend.
class GuRhiCapabilities
Runtime capabilities of the GU backend.
class GxRhiCapabilities
Runtime capabilities of the GX backend.
class GxmRhiCapabilities
Runtime capabilities of the GXM backend.
class PvrRhiCapabilities
Runtime capabilities of the PowerVR backend.
class SwRhiCapabilities
Runtime capabilities of the software rasterizer backend.
class VulkanRhiCapabilities
Runtime capabilities of the Vulkan backend.

Constructors, destructors, conversion operators

RhiCapabilitiesBase() protected

Public functions

auto GetApiVersion(ApiVersion version) const -> std::int32_t override
Returns the specified API version component.
auto GetInfoStrings() const -> const InfoStrings& override
Returns the device information strings.
auto GetValue(IntValues valueName) const -> std::int32_t override
Returns a runtime integer value.
auto GetArrayValue(ArrayIntValues arrayValueName, std::uint32_t index) const -> std::int32_t override
Returns an element of a runtime integer array value.
auto HasExtension(Extensions extensionName) const -> bool override
Returns true if the specified OpenGL extension is available.

Protected functions

void SetDeviceCapabilities(const char* renderer, std::int32_t maxTextureSize, std::int32_t maxTextureImageUnits, std::int32_t maxUniformBlockSize, std::int32_t uniformBufferOffsetAlignment, std::int32_t maxColorAttachments)
Publishes the capabilities of a backend that has no queryable API context.
void NormalizeUniformBlockSize()
Derives IntValues::MAX_UNIFORM_BLOCK_SIZE_NORMALIZED from the raw block size.
void LogCapabilities() const
Writes the published device information, limits and capability tier to the log.

Protected static variables

static std::int32_t MaxProgramBinaryFormats constexpr
Largest number of program binary formats that can be cached.

Protected variables

std::int32_t _majorVersion
std::int32_t _minorVersion
std::int32_t _releaseVersion
Release version number (not available in OpenGL ES).
InfoStrings _infoStrings
std::int32_t _intValues
Cached values of the queryable integer limits.
bool _extensions
Cached availability flags of the queryable OpenGL extensions.
std::int32_t _programBinaryFormats
Cached program binary formats, the first IntValues::NUM_PROGRAM_BINARY_FORMATS are valid.

Function documentation

void nCine::RHI::RhiCapabilitiesBase::SetDeviceCapabilities(const char* renderer, std::int32_t maxTextureSize, std::int32_t maxTextureImageUnits, std::int32_t maxUniformBlockSize, std::int32_t uniformBufferOffsetAlignment, std::int32_t maxColorAttachments) protected

Publishes the capabilities of a backend that has no queryable API context.

Parameters
renderer Renderer name reported in the information strings
maxTextureSize Largest supported 2D texture dimension
maxTextureImageUnits Per-draw texture-unit budget the backend's bind tracking supports
maxUniformBlockSize Largest uniform block the backend accepts, normalized as well
uniformBufferOffsetAlignment Alignment the engine has to suballocate uniform ranges at
maxColorAttachments Color attachments a render target of this backend can hold

The published values keep the GL-era names the render pipeline reads, but they describe the backend's own device: the window backend creates it before the capabilities are constructed, so its real limits are already known here. The version strings describe the pipeline's OpenGL 3.3 compatibility level (the feature set the backend replays), not a live GL context. The vendor is left empty, because there is no driver vendor behind these backends to name.

Beside the arguments this publishes the values every such backend shares: the pipeline's uniform-binding budget (8, matching the backends' MaxUniformBindings), the 2048-byte vertex stride every target guarantees (the Direct3D 11 input-layout limit, the Vulkan spec minimum for maxVertexInputBindingStride, unconstrained on the CPU rasterizer) and no program-binary formats (BinaryShaderCache is disabled outside the OpenGL family backend).

void nCine::RHI::RhiCapabilitiesBase::NormalizeUniformBlockSize() protected

Derives IntValues::MAX_UNIFORM_BLOCK_SIZE_NORMALIZED from the raw block size.

The raw limit is sometimes not reported correctly (and is unbounded on backends that decode uniforms on the host), so the pipeline sizes its buffers from the value clamped into the [16 KB, 64 KB] window this publishes instead.

void nCine::RHI::RhiCapabilitiesBase::LogCapabilities() const protected

Writes the published device information, limits and capability tier to the log.

Called at the end of each backend's constructor, so every backend reports what it ended up publishing instead of only the OpenGL family one (which is all the log used to carry). The values keep their GL-era names in IntValues, but they are spelled out neutrally here and lines that do not apply to the backend are left out - an ES2 or fixed-function backend has no uniform buffer bindings to report, and only the OpenGL family backend has program binary formats and extensions (GL::GLRhiCapabilities appends those itself). Compiles away without DEATH_TRACE.