- AMD Device Library eXtra v1.5
-
Programming with ADLX
- Programming with ADLX
-
ADLX Programming Guide
-
ADLX Samples
- ADLX Samples
-
C Samples
- C Samples
-
Display
- Display
- Display3DLUT
- DisplayBlanking
- DisplayColorDepth
- DisplayConnectivityExperience
- DisplayCustomColor
- DisplayCustomResolution
- DisplayDynamicRefreshRateControl
- DisplayEvents
- DisplayFreeSync
- DisplayFreeSyncColorAccuracy
- DisplayGamma
- DisplayGamut
- DisplayGPUScaling
- DisplayHDCP
- DisplayInfo
- DisplayIntegerScaling
- DisplayPixelFormat
- DisplayScalingMode
- DisplayVariBright
- DisplayVSR
-
Performance Monitoring
-
Receiving Events Notifications
-
C++ Samples
- C++ Samples
-
Display
- Display
- Display3DLUT
- DisplayBlanking
- DisplayColorDepth
- DisplayConnectivityExperience
- DisplayCustomColor
- DisplayCustomResolution
- DisplayDynamicRefreshRateControl
- DisplayEvents
- DisplayFreeSync
- DisplayFreeSyncColorAccuracy
- DisplayGamma
- DisplayGamut
- DisplayGPUScaling
- DisplayHDCP
- DisplayInfo
- DisplayIntegerScaling
- DisplayPixelFormat
- DisplayScalingMode
- DisplayVariBright
- DisplayVSR
-
Performance Monitoring
-
Receiving Events Notifications
-
ADLX SDK References
- ADLX SDK References
-
ADLX Helpers
-
ADLX Interfaces
- ADLX Interfaces
-
3D Graphics
- 3D Graphics
-
IADLX3DAnisotropicFiltering
-
IADLX3DAntiAliasing
-
IADLX3DFidelityFXFrameGenUpgrade
-
IADLX3DFidelityFXFrameGenUpgradeRatioOptionList
-
IADLX3DFrameRateTargetControl
-
IADLX3DImageSharpening
-
IADLX3DRadeonSuperResolution
-
IADLX3DSettingsChangedEvent
- IADLX3DSettingsChangedEvent
- GetGPU
- IsAnisotropicFilteringChanged
- IsAntiAliasingChanged
- IsAntiLagChanged
- IsBoostChanged
- IsChillChanged
- IsEnhancedSyncChanged
- IsFrameRateTargetControlChanged
- IsImageSharpeningChanged
- IsMorphologicalAntiAliasingChanged
- IsRadeonSuperResolutionChanged
- IsResetShaderCache
- IsTessellationModeChanged
- IsWaitForVerticalRefreshChanged
-
IADLX3DSettingsChangedEvent3
-
IADLX3DSettingsChangedHandling
-
IADLX3DSettingsServices
-
IADLX3DSettingsServices3
-
Display
- Display
-
IADLXDisplay3DLUT
- IADLXDisplay3DLUT
- ClearUser3DLUT
- GetAllUser3DLUT
- GetHDRUser3DLUT
- GetSCEDynamicContrast
- GetSCEDynamicContrastRange
- GetSDRUser3DLUT
- GetUser3DLUTIndex
- IsCurrentSCEDisabled
- IsCurrentSCEDynamicContrast
- IsCurrentSCEVividGaming
- IsSupportedSCE
- IsSupportedSCEDynamicContrast
- IsSupportedSCEVividGaming
- IsSupportedUser3DLUT
- SetAllUser3DLUT
- SetHDRUser3DLUT
- SetSCEDisabled
- SetSCEDynamicContrast
- SetSCEVividGaming
- SetSDRUser3DLUT
-
IADLXDisplay3DLUTChangedEvent
-
IADLXDisplayBlanking
-
IADLXDisplayChangedHandling
- IADLXDisplayChangedHandling
- AddDisplay3DLUTEventListener
- AddDisplayGammaEventListener
- AddDisplayGamutEventListener
- AddDisplayListEventListener
- AddDisplaySettingsEventListener
- RemoveDisplay3DLUTEventListener
- RemoveDisplayGammaEventListener
- RemoveDisplayGamutEventListener
- RemoveDisplayListEventListener
- RemoveDisplaySettingsEventListener
-
IADLXDisplayConnectivityExperience
- IADLXDisplayConnectivityExperience
- GetDPLinkRate
- GetNumberOfActiveLanes
- GetNumberOfTotalLanes
- GetRelativePreEmphasis
- GetRelativeVoltageSwing
- IsEnabledHDMIQualityDetection
- IsEnabledLinkProtection
- IsSupportedDPLink
- IsSupportedHDMIQualityDetection
- SetEnabledHDMIQualityDetection
- SetRelativePreEmphasis
- SetRelativeVoltageSwing
-
IADLXDisplayCustomColor
- IADLXDisplayCustomColor
- GetBrightness
- GetBrightnessRange
- GetContrast
- GetContrastRange
- GetHue
- GetHueRange
- GetSaturation
- GetSaturationRange
- GetTemperature
- GetTemperatureRange
- IsBrightnessSupported
- IsContrastSupported
- IsHueSupported
- IsSaturationSupported
- IsTemperatureSupported
- SetBrightness
- SetContrast
- SetHue
- SetSaturation
- SetTemperature
-
IADLXDisplayCustomResolution
-
IADLXDisplayDynamicRefreshRateControl
-
IADLXDisplayFreeSyncColorAccuracy
-
IADLXDisplayGamma
- IADLXDisplayGamma
- GetGammaCoefficient
- GetGammaRamp
- IsCurrentDeGammaRamp
- IsCurrentReGamma36
- IsCurrentReGammaBT709
- IsCurrentRegammaCoefficient
- IsCurrentReGammaPQ
- IsCurrentReGammaPQ2084Interim
- IsCurrentReGammaRamp
- IsCurrentReGammaSRGB
- IsSupportedReGamma36
- IsSupportedReGammaBT709
- IsSupportedReGammaPQ
- IsSupportedReGammaPQ2084Interim
- IsSupportedReGammaSRGB
- ResetGammaRamp
- SetDeGammaRamp
- SetReGamma36
- SetReGammaBT709
- SetReGammaCoefficient
- SetReGammaPQ
- SetReGammaPQ2084Interim
- SetReGammaRamp
- SetReGammaSRGB
-
IADLXDisplayGammaChangedEvent
-
IADLXDisplayGamut
- IADLXDisplayGamut
- GetGamutColorSpace
- GetWhitePoint
- IsCurrent5000kWhitePoint
- IsCurrent6500kWhitePoint
- IsCurrent7500kWhitePoint
- IsCurrent9300kWhitePoint
- IsCurrentAdobeRgbColorSpace
- IsCurrentCCIR2020ColorSpace
- IsCurrentCCIR601ColorSpace
- IsCurrentCCIR709ColorSpace
- IsCurrentCIERgbColorSpace
- IsCurrentCustomColorSpace
- IsCurrentCustomWhitePoint
- IsSupported5000kWhitePoint
- IsSupported6500kWhitePoint
- IsSupported7500kWhitePoint
- IsSupported9300kWhitePoint
- IsSupportedAdobeRgbColorSpace
- IsSupportedCCIR2020ColorSpace
- IsSupportedCCIR601ColorSpace
- IsSupportedCCIR709ColorSpace
- IsSupportedCIERgbColorSpace
- IsSupportedCustomColorSpace
- IsSupportedCustomWhitePoint
- SetGamut
-
IADLXDisplayGamutChangedEvent
-
IADLXDisplaySettingsChangedEvent
- IADLXDisplaySettingsChangedEvent
- GetDisplay
- IsColorDepthChanged
- IsCustomColorBrightnessChanged
- IsCustomColorContrastChanged
- IsCustomColorHueChanged
- IsCustomColorSaturationChanged
- IsCustomColorTemperatureChanged
- IsCustomResolutionChanged
- IsFreeSyncChanged
- IsGPUScalingChanged
- IsHDCPChanged
- IsIntegerScalingChanged
- IsPixelFormatChanged
- IsScalingModeChanged
- IsVariBrightChanged
- IsVSRChanged
-
IADLXDisplaySettingsChangedEvent3
-
IADLXDisplayVariBright1
- IADLXDisplayVariBright1
- IsBacklightAdaptiveEnabled
- IsBacklightAdaptiveSupported
- IsBatteryLifeEnabled
- IsBatteryLifeSupported
- IsFullScreenVideoEnabled
- IsFullScreenVideoSupported
- IsWindowsPowerModeEnabled
- IsWindowsPowerModeSupported
- SetBacklightAdaptiveEnabled
- SetBatteryLifeEnabled
- SetFullScreenVideoEnabled
- SetWindowsPowerModeEnabled
-
GPU Tuning
- GPU Tuning
-
IADLXGPUAutoTuningCompleteEvent
-
IADLXGPUTuningChangedEvent1
-
IADLXGPUTuningChangedHandling
-
IADLXGPUTuningServices
- IADLXGPUTuningServices
- GetAutoTuning
- GetGPUTuningChangedHandling
- GetManualFanTuning
- GetManualGFXTuning
- GetManualPowerTuning
- GetManualVRAMTuning
- GetPresetTuning
- IsAtFactory
- IsSupportedAutoTuning
- IsSupportedManualFanTuning
- IsSupportedManualGFXTuning
- IsSupportedManualPowerTuning
- IsSupportedManualVRAMTuning
- IsSupportedPresetTuning
- ResetToFactory
-
IADLXManualFanTuning
- IADLXManualFanTuning
- GetEmptyFanTuningStates
- GetFanTuningRanges
- GetFanTuningStates
- GetMinAcousticLimit
- GetMinAcousticLimitRange
- GetMinFanSpeed
- GetMinFanSpeedRange
- GetTargetFanSpeed
- GetTargetFanSpeedRange
- GetZeroRPMState
- IsSupportedMinAcousticLimit
- IsSupportedMinFanSpeed
- IsSupportedTargetFanSpeed
- IsSupportedZeroRPM
- IsValidFanTuningStates
- SetFanTuningStates
- SetMinAcousticLimit
- SetMinFanSpeed
- SetTargetFanSpeed
- SetZeroRPMState
-
IADLXManualFanTuningState
-
IADLXManualGraphicsTuning1
-
IADLXManualGraphicsTuning2_1
-
Miscellaneous
-
Multimedia
- Multimedia
-
IADLXMultimediaChangedEvent
-
IADLXMultimediaChangedHandling
-
IADLXMultimediaServices
-
IADLXVideoUpscale
-
Performance Monitoring
- Performance Monitoring
-
IADLXGPUMetricsSupport
- IADLXGPUMetricsSupport
- GetGPUClockSpeedRange
- GetGPUFanSpeedRange
- GetGPUHotspotTemperatureRange
- GetGPUIntakeTemperatureRange
- GetGPUPowerRange
- GetGPUTemperatureRange
- GetGPUTotalBoardPowerRange
- GetGPUUsageRange
- GetGPUVoltageRange
- GetGPUVRAMClockSpeedRange
- GetGPUVRAMRange
- IsSupportedGPUClockSpeed
- IsSupportedGPUFanSpeed
- IsSupportedGPUHotspotTemperature
- IsSupportedGPUIntakeTemperature
- IsSupportedGPUPower
- IsSupportedGPUTemperature
- IsSupportedGPUTotalBoardPower
- IsSupportedGPUUsage
- IsSupportedGPUVoltage
- IsSupportedGPUVRAM
- IsSupportedGPUVRAMClockSpeed
-
IADLXPerformanceMonitoringServices
- IADLXPerformanceMonitoringServices
- ClearPerformanceMetricsHistory
- GetAllMetricsHistory
- GetCurrentAllMetrics
- GetCurrentFPS
- GetCurrentGPUMetrics
- GetCurrentPerformanceMetricsHistorySize
- GetCurrentSystemMetrics
- GetFPSHistory
- GetGPUMetricsHistory
- GetMaxPerformanceMetricsHistorySize
- GetMaxPerformanceMetricsHistorySizeRange
- GetSamplingInterval
- GetSamplingIntervalRange
- GetSupportedGPUMetrics
- GetSupportedSystemMetrics
- GetSystemMetricsHistory
- SetMaxPerformanceMetricsHistorySize
- SetSamplingInterval
- StartPerformanceMetricsTracking
- StopPerformanceMetricsTracking
-
Power Tuning
- Power Tuning
-
IADLXGPUConnectChangedEvent
-
IADLXPowerTuningChangedHandling
-
IADLXPowerTuningServices1
-
IADLXSmartShiftMax
-
Legal Information and Compliance/Disclaimers
3DSettingsEvent
Navigation: Programming with ADLX → ADLX Samples → C++ Samples → 3D Graphics
Demonstrates how to register and unregister for notifications when 3D Graphics settings change, and perform related testing when programming with ADLX.
Sample Path
/Samples/CPP/3DGraphics/3DSettingsEvent
C++
Code
C++
//// Copyright Advanced Micro Devices, Inc. All rights reserved.////-------------------------------------------------------------------------------------------------
/// \file main3DSettingsEvent.cpp/// \brief Demonstrates how to register and unregister for notifications when 3D Graphics settings change, and perform related testing when programming with ADLX.
#include "SDK/ADLXHelper/Windows/Cpp/ADLXHelper.h"#include "SDK/Include/I3DSettings.h"#include <iostream>#include <string>
// Use ADLX namespaceusing namespace adlx;
// ADLXHelper instance// No outstanding interfaces from ADLX must exist when ADLX is destroyed.// Use global variables to ensure validity of the interface.static ADLXHelper g_ADLXHelp;
// Block event to verify call backHANDLE blockEvent = nullptr;
// Get the GPU unique namevoid GPUUniqueName(IADLXGPUPtr gpu, char* uniqueName);
// Call back to handle changed eventsclass CallBack3DSettingsChanged : public IADLX3DSettingsChangedListener{ public: adlx_bool ADLX_STD_CALL On3DSettingsChanged(IADLX3DSettingsChangedEvent* p3DSettingsChangedEvent) override { ADLX_RESULT res; IADLXGPUPtr gpu; res = p3DSettingsChangedEvent->GetGPU(&gpu); if (ADLX_SUCCEEDED(res)) { char uniqueName[128] = "Unknown"; GPUUniqueName(gpu, uniqueName); adlx_bool antiLagChanged = p3DSettingsChangedEvent->IsAntiLagChanged(); std::cout << "\tGPU: " << uniqueName << " AntiLag changed: " << antiLagChanged << std::endl; }
SetEvent(blockEvent);
// Return true for ADLX to continue notifying the next listener, or false to stop notification return true; }};
// Wait for exit with error messageint WaitAndExit(const char* msg, const int retCode);
int main(){ // Define return code ADLX_RESULT res = ADLX_FAIL;
// Initialize ADLX res = g_ADLXHelp.Initialize(); if (ADLX_SUCCEEDED(res)) { // Create block event blockEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
// GetGPUs IADLXGPUListPtr gpus; res = g_ADLXHelp.GetSystemServices()->GetGPUs(&gpus);
// Get 3DSettings service IADLX3DSettingsServicesPtr d3dSettingSrv; res = g_ADLXHelp.GetSystemServices()->Get3DSettingsServices(&d3dSettingSrv);
if (!gpus->Empty() && ADLX_SUCCEEDED(res)) { // Get GPU interface IADLXGPUPtr gpuInfo; adlx_uint index = 0; res = gpus->At(index, &gpuInfo); const char* gpuName = nullptr; res = gpuInfo->Name(&gpuName); std::cout << "\t" << gpuName << " is selected." << std::endl;
// Get change handle IADLX3DSettingsChangedHandlingPtr changeHandle; res = d3dSettingSrv->Get3DSettingsChangedHandling(&changeHandle); if (ADLX_SUCCEEDED(res)) { // Create call back IADLX3DSettingsChangedListener* call = new CallBack3DSettingsChanged;
// Add call back ADLX_RESULT addListenerRes = changeHandle->Add3DSettingsEventListener(call);
// Change anti-lag state std::cout << "\nSwitching Anti-Lag status\n"; IADLX3DAntiLagPtr antiLag; d3dSettingSrv->GetAntiLag(gpuInfo, &antiLag); adlx_bool enable; antiLag->IsEnabled(&enable);
std::cout << "\nWaiting for 3DSettings change event (5s)...\n"; antiLag->SetEnabled(!enable); WaitForSingleObject(blockEvent, 5000);
if (ADLX_SUCCEEDED (addListenerRes)) { // Remove call back res = changeHandle->Remove3DSettingsEventListener(call); if (ADLX_FAILED (res)) std::cout << "\nRemove 3DSettings event listener failed" << std::endl; }
// Delete call back delete call; call = nullptr; } } else { std::cout << "Failed to get 3DSettings services" << std::endl; } } else { std::cout << "ADLX initialization failed" << std::endl; system("pause"); return 0; }
// Destroy ADLX res = g_ADLXHelp.Terminate(); std::cout << "Destroy ADLX res: " << res << std::endl;
// Close event if (blockEvent) CloseHandle(blockEvent);
// Pause to see the print out system("pause");
return 0;}
void GPUUniqueName(IADLXGPUPtr gpu, char* uniqueName){ if (nullptr != gpu && nullptr != uniqueName) { const char* gpuName = nullptr; ADLX_RESULT res1 = gpu->Name(&gpuName); adlx_int id; ADLX_RESULT res2 = gpu->UniqueId(&id); if (ADLX_SUCCEEDED(res1) && ADLX_SUCCEEDED(res2)) sprintf_s(uniqueName, 128, "name:%s, id:%d", gpuName, id); }}See Also: ADLX Macro, ADLX Enums