The Renderer
interface looks like this:
class Renderer
{
static RendererData& data() noexcept;
static void saveSettings() noexcept;
static const FString& getVendorString() noexcept;
static const FString& getAPIVersion() noexcept;
static const FString& getGPUName() noexcept;
static const FString& getDriverVersion() noexcept;
static void forceUpdate() noexcept;
};
Warning
All the get
functions will not produce expected results
when targeting WASM
The first function returns a reference to the
RendererData
struct that looks like this:
struct RendererData
{
bool bVulkan = false; // Enables the vulkan submodule
bool bUsingVSync = true; // Enables V-Sync, defaults to true
uint32_t msaaSamples = 8; // The number of samples for MSAA, supersampling
bool bEnablePowerSavingMode = true; // Enables the power saving mode
float idleFrameRate = 9; // The number of frames to render when idle
};
You can see descriptions in the code comments above. It is defined as
part of the C API under C/Internal/RendererData.h
.
The saveSettings
function saves the settings in this
struct to the Renderer config file under
Config/Core/Renderer.yaml
.
All functions after that, return information fetched from the Graphics API about your GPU, like the driver version or API version.
Caution
Enabling power saving mode may impact the usability of highly dynamic applications, such as those that rely on updating plots, animation or logic every frame. This caveat might not apply for your application in certain cases, though. Read the tip below for more info.
Tip
You can mitigate the issues listed in the last note by calling
Renderer::forceUpdate
every time a certain widget that
requires high refresh rate is being rendered. This function temporarily
disables power saving mode.
Note
When targeting WASM, the bVulkan
boolean is used for
enabling/disabling the WebGPU renderer.
Settings
The settings for the renderer are stored at
Config/Core/Renderer.yaml
, which looks like this:
vulkan: false
v-sync: false
msaa-samples: 8
power-saving:
enabled: true
idle-frames: 9
And corresponds directly to the RendererData
struct
documented above.
Event safety
The following members of the Renderer
interface are
marked as Any time
:
data()
saveSettings()
The rest are marked as Begin
.
C API
The C API is the same as the C++ one, but using standard C API
semantics such as prefixing each function with
UImGui_Renderer_
, as defined here.
The API looks like this:
// Event Safety - Any time
* UImGui_Renderer_data();
UImGui_RendererData// Event Safety - Any time
void UImGui_Renderer_saveSettings();
// Event Safety - begin, post-begin
();
UImGui_String UImGui_Renderer_getVendorString// Event Safety - begin, post-begin
();
UImGui_String UImGui_Renderer_getAPIVersion// Event Safety - begin, post-begin
();
UImGui_String UImGui_Renderer_getGPUName// Event Safety - begin, post-begin
(); UImGui_String UImGui_Renderer_getDriverVersion
- Home
- Beginner content
- Install guide
- Creating and using the UI components
- The Instance
- The Init Info struct
- Textures
- Logging
- Unicode support
- Additional features
- Client-side bar
- Custom type definitions
- Memory management
- C API development
- Config files and Folders
- Interfaces
- Internal Event safety
- Customising the build system
- Modules system
- Collaborating with others
- Advanced content
- Developer and contributor resources
- Misc