IGraphicDevice

Functions

SET_CID

RED_RC

GetOperatingSystem

RED_RC

GetSupportedGPUs

RED_RC

GetLocalGPUs

RED_RC

GetLocalGPUDriver

RED_RC

CheckLocalGPUDriver

RED_RC

GetScreenSaver

RED_RC

SetScreenSaver

RED_RC

IsNVIDIAAntiAliasingModeOverride

RED_RC

ResetNVIDIAAntiAliasingMode

Detailed Description

class IGraphicDevice : public RED::IREDObject

Graphic card setup interface. Analyzes the host computer.

@related Hardware platforms, class RED::IResourceManager

This interface is implemented by the cluster’s resource manager. See the \ref bk_ba_resource_manager chapter for details on accessing this interface from the resource manager.

This interface lets a REDsdk user checks its host computer system. All graphic cards that can be used to run a REDsdk GPU accelerated application are returned and analyzed: for each GPU identifier and operating system, this interface gives the currently installed graphic driver and the recommended driver version for an optimal REDsdk usage.

This interface also identifies REDsdk applications that are running in virtualization environments. In this case there’s no driver recommendation and REDsdk must be used in software rendering mode.

This interface also contains a minimal API to enable or disable the screen saver on windows. The screen saver may cause OpenGL errors for applications running on the GPU.

Public Functions

SET_CID(CID_class_REDIGraphicDevice)
virtual RED_RC GetOperatingSystem(RED::OPERATING_SYSTEM &oOS) const = 0

Returns the operating system we run on.

Note that we may run 32 bits binaries on a 64 bits OS.

Parameters

oOS – The operating system running the application.

Returns

RED_OK if the operation has succeeded,

RED_ALLOC_FAILURE if an internal allocation has failed, RED_FAIL otherwise.

virtual RED_RC GetSupportedGPUs(RED::Vector<RED::GPUID> &oGPUList) const = 0

Returns the complete list of REDsdk supported GPUs.

This method does a copy of the complete list of GPUs that can be used to run REDsdk using a GPU hardware acceleration.

Parameters

oGPUList – The vector that receives the GPU list.

Returns

RED_OK if the operation has succeeded,

RED_ALLOC_FAILURE if an internal allocation has failed, RED_FAIL otherwise.

virtual RED_RC GetLocalGPUs(RED::Vector<RED::GPUID> &oGPUList, bool iPrimaryOnly = false) const = 0

Returns the list of supported GPUs found on this computer.

This method looks for all graphic cards on the host computer. It keeps all graphic cards that can be used to run REDsdk using a hardware acceleration and return this list in ‘oGPUList’. The list returned by the method can be reduced to the primary device only if ‘iPrimary’ is set to true.

If the system is using a GPU that is unknown to REDsdk, then the method will return a value in ‘oGPUList’ for the unknown GPU whose name will be set to a special string: for example RED_HW_UNKNOWN_NVIDIA_GRAPHICS_ADAPTER if we have found an unknown NVIDIA graphic card. Similar strings exist for all hardware vendors and can be found in the REDIGraphicDevice.h header file.

\task tk_identifying_a_computers_gpu

The list of GPU chipsets is available at this page: \ref bk_ba_gpu_chipset_reference.

Parameters
  • oGPUList – The vector that receives the list of local REDsdk hardware accelerated graphic cards that have been found.

  • iPrimaryOnly – If set to true, only the primary graphic card is being returned by the call.

Returns

RED_OK if the operation has succeeded,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

virtual RED_RC GetLocalGPUDriver(RED::String &oDriver, RED::String &oDLLVersion, bool &oNewer, bool &oOlder, const RED::GPUID &iGPU) const = 0

Gets the installed driver version for a GPU on this computer.

This method returns the driver version currently installed for the specified GPU. The GPU must be present on the local computer.

The method returns two strings:

  • a ‘oDLLVersion’: This is the unmodified version of a DLL: it can be something like ‘6.14.10.7767’ for example.

  • A ‘oDriver’ string: This is the translated string version into a readable driver version, such as ‘Catalyst 8.7’ for example. Note that this translation occurs for the known REDsdk driver database,

  • Two additional boolean flags: ‘oOlder’ and ‘oNewer’ that indicates whether the currently installed driver is older or newer than the actual recommended version for the provided ‘iGPU’.

Please note that:

  • ‘oDriver’ will be empty for ATI and INTEL cards whenever the driver revision does not exist in REDsdk’s internal database. In this case, the ‘oDLLVersion’ is the only valid information we have. If the installed driver version is recognized by REDsdk, ‘oDriver’ is set to a valid readable string. Also, ‘oDriver’ is returned without any driver suffix: in the driver database, several drivers have suffixes such as ” mobility”, ” quadro”, ” notebook”. These are cut in the returned string.

  • ’oDLLVersion’ will be empty for NVIDIA cards. ‘oDriver’ is always set to the valid ‘Forceware X.Y’ version used by the graphic card, if the graphic card is enabled. If the graphic card is turned off, it may be detected but REDsdk may be unable to query the installed driver version for it.

  • ’oDriver’ will be returned to RED_HW_VIRTUAL_SOFTWARE_DRIVER, ‘oDLLVersion’, ‘oOlder’, ‘oNewer’ will be returned empty and false for all RED::HW_VIRTUAL_GENERIC types of virtual cards.

  • Finally, a combination of both ‘oDriver’ and ‘oDLLVersion’ set empty indicates that no driver is installed for the specified graphic card.

Please also note that this API recognizes official driver versions. Specific patches or driver hotfixes may change driver versions and these versions may therefore be unknown to REDsdk.

\task tk_identifying_a_gpus_installed_driver

The list of GPU drivers is available here: \ref bk_ba_gpu_driver_reference.

Parameters
  • oDriver – This is the driver version including the name of the hardware vendor in a readable form, as it can be usually downloaded from the hardware vendor website.

  • oDLLVersion – This is the DLL driver version. This version is the raw version written inside the main DLL driver file. This version is converted into ‘oDriver’ using REDsdk’s internal driver database.

  • oNewer – Is the installed driver newer than the recommended driver for this GPU on this operating system?

  • oOlder – Is the installed driver older than the recommended driver for this GPU on this operating system?

  • iGPU – The GPU whose corresponding driver is to be searched for.

Returns

RED_OK if the operation has succeeded,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

virtual RED_RC CheckLocalGPUDriver(bool &oUpdate, RED::DRIVER_VALIDATION &oCertification, const RED::GPUID &iGPU) const = 0

Returns REDsdk recommendation for a GPU installed driver.

This method checks the driver that is installed for ‘iGPU’. Based on the found result, it recommends to change the installed version or not and delivers a certification level.

The recommended driver version is the version string stored in the ‘iGPU’ structure, for each operating system. If ‘oUpgrade’ is returned set to true, then the version indicated by ‘iGPU’ should be installed.

This method always return oUpdate set to false and oCertification set to RED::DR_OK on Windows 10 and more recent operating systems, since starting with Windows 10, this is windows that is in charge of choosing the graphic driver for a GPU.

The list of GPU drivers is available here: \ref bk_ba_gpu_driver_reference

Parameters
  • oUpdate – Returned to true if a driver update is recommended, false if the driver version is correct. Note that this method may be used to recommend a driver upgrade or a driver downgrade.

  • oCertification – Returned confidence level in the installed driver.

  • iGPU – The GPU whose driver is to be analyzed.

Returns

RED_OK if the operation has succeeded,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

virtual RED_RC GetScreenSaver(bool &oOnOff) const = 0

Retrieves the status (on / off) of the screen saver.

This method queries the operating system to figure out whether the screen saver is enabled or not. The found result is written in ‘oOnOff’. The method does nothing on non windows OS.

Parameters

oOnOff – Screen saver current on / off status.

Returns

RED_OK if the operation has succeeded,

RED_FAIL on a windows registry access failure.

virtual RED_RC SetScreenSaver(bool iOnOff) const = 0

Enables or disables the screen saver on windows.

This method enables or disables the screen saver for all windows versions. It may need administrator privileges to work properly depending on the windows version being executed. The method does nothing on non windows OS.

Parameters

iOnOff – set to true to enable the screen saver, false to disable it.

Returns

RED_OK if the operation has succeeded,

RED_FAIL on a windows registry access failure.

virtual RED_RC IsNVIDIAAntiAliasingModeOverride(bool &oOverride) const = 0

Checks NVIDIA driver settings.

This method is specific to NVIDIA cards on Windows systems. It does nothing on other systems or if no NVIDIA card is present on the computer.

This method uses the NVIDIA driver setting API to retrieve the current value of the “Antialiasing - Mode” setting of the installed NVIDIA driver. If the setting value is different from “Application-controlled” (meaning that the application controls the anti-aliasing setting), then ‘oOverride’ is returned set to ‘true’.

Then, RED::IGraphicDevice::ResetNVIDIAAntiAliasingMode can be used to turn back the NVIDIA “Antialiasing - Mode” back to “Application-controlled”.

Parameters

oOverride – set to ‘true’ if the NVIDIA card driver setting overrides the anti-aliasing mode.

Returns

RED_OK if the method has succeeded. Note that if no NVIDIA card is present or if we’re not running on Windows, the return code is always set to RED_OK;

RED_FAIL if the operation could not be completed.

virtual RED_RC ResetNVIDIAAntiAliasingMode() const = 0

Resets the NVIDIA anti-aliasing mode to application controlled.

This method is only effective after a restart of the application, due to the fact that the OpenGL layer of the application needs to be re-initialized after the call.

This method resets the NVIDIA “Antialiasing - Mode” setting to its default “Application-controlled” value.

Returns

RED_OK if the method has succeeded. Note that if no NVIDIA card is present or if we’re not running on Windows, the return code is always set to RED_OK;

RED_FAIL if the operation could not be completed.