Driver Info API
This file contains the API that allows the user to get different information about the driver, its current state and the hardware it is running on.
Enums
- 
enum class APISupport
 Enum representing the level of API support for a current hardware. Currently it is only used to check DX12 support with a fallback on DX11 if the support is not full.
Values:
- 
enumerator FULL_SUPPORT
 Full support for the API.
- 
enumerator OUTDATED_OS
 The Windows version is outdated.
- 
enumerator OUTDATED_DRIVER
 The driver is outdated.
- 
enumerator BLACKLISTED_DRIVER
 The driver is blacklisted (we know about bugs in the driver)
- 
enumerator INSUFFICIENT_DEVICE
 The GPU doesn’t support all required features.
- 
enumerator NO_DEVICE_FOUND
 No compatible device found.
- 
enumerator FULL_SUPPORT
 
- 
class Driver3dInitCallback
 - #include <dag_info.h>
Callback class for initializing the 3D driver.
Public Types
- 
using NeedStereoRenderFunc = bool (*)()
 Function pointer type for checking if stereo rendering is needed.
- 
using StereoRenderDimensionFunc = int (*)()
 Function pointer type for getting the dimension of stereo rendering.
- 
using StereoRenderExtensionsFunc = const char *(*)()
 Function pointer type for getting the extensions for stereo rendering.
- 
using StereoRenderVersionsFunc = VersionRange (*)()
 Function pointer type for getting the supported versions for stereo rendering
- 
using StereoRenderAdapterFunc = int64_t (*)()
 Function pointer type for getting the adapter for stereo rendering.
Public Functions
- 
inline virtual void verifyResolutionSettings(int &ref_scr_wdt, int &ref_scr_hgt, int base_scr_wdt, int base_scr_hgt, bool window_mode) const
 Verifies the resolution settings.
- Parameters:
 ref_scr_wdt – The reference screen width
ref_scr_hgt – The reference screen height
base_scr_wdt – The base screen width
base_scr_hgt – The base screen height
window_mode – Flag indicating if the window mode is enabled
- 
virtual int validateDesc(Driver3dDesc &desc) const = 0
 Validates the driver description.
- Todo:
 This fucntion is not used anywhere. Remove it?
- Parameters:
 desc – The driver description to validate
- Returns:
 something
- 
virtual int compareDesc(Driver3dDesc &A, Driver3dDesc &B) const = 0
 Compares two driver descriptions.
- Todo:
 This fucntion is not used anywhere. Remove it?
- Parameters:
 A – The first driver description
B – The second driver description
- Returns:
 something
- 
inline virtual bool desiredStereoRender() const
 Checks if stereo rendering is desired.
- Returns:
 True if stereo rendering is desired, false otherwise
- 
inline virtual int64_t desiredAdapter() const
 Gets the desired adapter.
- Returns:
 The desired adapter ID
- 
inline virtual RenderSize desiredRendererSize() const
 Gets the desired size of the renderer.
- Returns:
 The desired size of the renderer
- 
inline virtual const char *desiredRendererDeviceExtensions() const
 Gets the desired device extensions for the renderer.
- Returns:
 The desired device extensions for the renderer
- 
inline virtual const char *desiredRendererInstanceExtensions() const
 Gets the desired instance extensions for the renderer.
- Returns:
 The desired instance extensions for the renderer
- 
inline virtual VersionRange desiredRendererVersionRange() const
 Gets the desired version range for the renderer.
- Returns:
 The desired version range for the renderer
- 
struct RenderSize
 - #include <dag_info.h>
Struct representing the size of the render area.
 
- 
struct VersionRange
 - #include <dag_info.h>
Struct representing a range of driver versions.
 
 - 
using NeedStereoRenderFunc = bool (*)()
 
- 
namespace d3d
 Functions
- 
GpuVendor guess_gpu_vendor(String *out_gpu_desc = NULL, uint32_t *out_drv_ver = NULL, DagorDateTime *out_drv_date = NULL, uint32_t *device_id = nullptr)
 Guesses and returns the GPU vendor ID.
- Parameters:
 out_gpu_desc – Pointer to store the GPU description
out_drv_ver – Pointer to store the driver version
out_drv_date – Pointer to store the driver date
device_id – Pointer to store the device ID
- Returns:
 The GPU vendor ID enum
- 
DagorDateTime get_gpu_driver_date(GpuVendor vendor)
 Gets the driver date for the GPU vendor.
- Parameters:
 vendor – The GPU vendor ID
- Returns:
 The driver date for the GPU vendor
- 
unsigned get_dedicated_gpu_memory_size_kb()
 Determines and returns the size of the dedicated GPU memory in KB.
- Returns:
 The size of the dedicated GPU memory in KB
- 
unsigned get_free_dedicated_gpu_memory_size_kb()
 Determines and returns the size of the free dedicated GPU memory in KB.
- Returns:
 The size of the free dedicated GPU memory in KB
- 
void get_current_gpu_memory_kb(uint32_t *dedicated_total, uint32_t *dedicated_free)
 Gets the current GPU memory during the game (supports only Nvidia GPUs).
- Parameters:
 dedicated_total – Pointer to store the total dedicated GPU memory
dedicated_free – Pointer to store the free dedicated GPU memory
- 
bool get_gpu_freq(String &out_freq)
 Gets the GPU frequency.
Note
This function works only for Nvidia GPUs
- Parameters:
 out_freq – String to store the GPU frequency
- Returns:
 True if the GPU frequency was successfully retrieved, false otherwise
- 
int get_gpu_temperature()
 Gets the GPU temperature.
Note
This function works only for Nvidia GPUs
- Returns:
 The GPU temperature
- 
void get_video_vendor_str(String &out_str)
 Gets the video vendor string.
- Parameters:
 out_str – String to store the video vendor string
- 
float get_display_scale()
 Gets the display scale.
- Returns:
 The display scale
- 
void disable_sli()
 Disables SLI settings for the profile.
- Todo:
 Remove. We don’t support SLI anymore
- 
const char *get_driver_name()
 Gets the driver name.
- Returns:
 The driver name
- 
DriverCode get_driver_code()
 Gets the driver code.
- Returns:
 The driver code
- 
static inline bool is_stub_driver()
 Checks if the d3d-stub driver is used.
- Returns:
 True if the d3d-stub driver is used, false otherwise
- 
const char *get_device_driver_version()
 Gets the device driver version.
Note
Work only for Vulkan. On other platforms returns “1.0”
- Returns:
 The device driver version
- 
const char *get_device_name()
 Gets the device name.
- Returns:
 The device name
- 
const char *get_last_error()
 Gets the last error message.
- Returns:
 The last error message
- 
uint32_t get_last_error_code()
 Gets the last error code.
- Returns:
 The last error code
- 
void *get_device()
 Gets the raw pointer to the device interface (implementation and platform specific).
- Returns:
 The raw pointer to the device interface
- 
void *get_context()
 Gets the raw pointer to the device context (implementation and platform specific).
- Returns:
 The raw pointer to the device context
- 
const Driver3dDesc &get_driver_desc()
 Gets the driver description.
- Returns:
 The driver description
- 
bool is_in_device_reset_now()
 Checks if the device is in device reset or being reset.
- Returns:
 True if the device is in device reset or being reset, false otherwise
- 
bool is_window_occluded()
 Checks if the game rendering window is completely occluded.
- Returns:
 True if the game rendering window is completely occluded, false otherwise
- 
bool should_use_compute_for_image_processing(std::initializer_list<unsigned> formats)
 Checks if compute commands should be preferred for image processing.
Note
Implemented only for DX11
- Parameters:
 formats – The list of image formats
- Returns:
 True if compute commands should be preferred, false otherwise
- 
GpuVendor guess_gpu_vendor(String *out_gpu_desc = NULL, uint32_t *out_drv_ver = NULL, DagorDateTime *out_drv_date = NULL, uint32_t *device_id = nullptr)