- 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/C/3DGraphics/3DSettingsEvent
C
Code
C
//// Copyright Advanced Micro Devices, Inc. All rights reserved.////-------------------------------------------------------------------------------------------------
/// \file main3DSettingsEvent.c/// \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/C/ADLXHelper.h"#include "SDK/Include/I3DSettings.h"
// Block eventHANDLE blockEvent = NULL;
// Get the GPU unique namevoid GPUUniqueName(IADLXGPU* gpu, char* uniqueName);
// Call-back to handle changed eventsadlx_bool ADLX_STD_CALL on3DSettingsChanged(IADLX3DSettingsChangedListener* pThis, IADLX3DSettingsChangedEvent* p3DSettingsChangedEvent){ ADLX_RESULT res; IADLXGPU* gpu = NULL; res = p3DSettingsChangedEvent->pVtbl->GetGPU(p3DSettingsChangedEvent, &gpu); if (ADLX_SUCCEEDED(res)) { char uniqueName[128] = "Unknown"; GPUUniqueName(gpu, uniqueName); adlx_bool antiLagChanged = p3DSettingsChangedEvent->pVtbl->IsAntiLagChanged(p3DSettingsChangedEvent); printf("\tGPU: %s AntiLag changed: %d\n", uniqueName, antiLagChanged); }
SetEvent(blockEvent);
// Release the GPU interface if (gpu != NULL) { gpu->pVtbl->Release(gpu); gpu = NULL; }
// Return true for ADLX to continue notifying the next listener, or false to stop notification return true;};static IADLX3DSettingsChangedListenerVtbl vtbl = {&on3DSettingsChanged};static IADLX3DSettingsChangedListener call = {&vtbl};
int main(){ // Define return code ADLX_RESULT res = ADLX_FAIL;
// Initialize ADLX res = ADLXHelper_Initialize(); if (ADLX_SUCCEEDED(res)) { // Create block event blockEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
// Get system services IADLXSystem* sys = ADLXHelper_GetSystemServices();
// Get GPUs IADLXGPUList* gpus = NULL; res = sys->pVtbl->GetGPUs(sys, &gpus);
// Get 3DSettings service IADLX3DSettingsServices* d3dSettingSrv = NULL; res = sys->pVtbl->Get3DSettingsServices(sys, &d3dSettingSrv);
if (ADLX_SUCCEEDED(res)) { // Get GPU interface IADLXGPU* gpu = NULL; adlx_uint index = 0; res = gpus->pVtbl->At_GPUList(gpus, index, &gpu);
// Get change handle IADLX3DSettingsChangedHandling* changeHandle = NULL; res = d3dSettingSrv->pVtbl->Get3DSettingsChangedHandling(d3dSettingSrv, &changeHandle); if (ADLX_SUCCEEDED(res)) { // Add call-back ADLX_RESULT addListenerRes = changeHandle->pVtbl->Add3DSettingsEventListener(changeHandle, &call);
// Change anti-lag state printf("\nSwitching Anti-Lag status\n"); IADLX3DAntiLag* antiLag = NULL; d3dSettingSrv->pVtbl->GetAntiLag(d3dSettingSrv, gpu, &antiLag); adlx_bool enable; antiLag->pVtbl->IsEnabled(antiLag, &enable);
printf("\nWaiting for 3DSettings change event (5s)...\n"); antiLag->pVtbl->SetEnabled(antiLag, !enable); WaitForSingleObject(blockEvent, 5000);
if (ADLX_SUCCEEDED (addListenerRes)) { // Remove call-back res = changeHandle->pVtbl->Remove3DSettingsEventListener(changeHandle, &call); if (ADLX_FAILED (res)) printf("\nRemove 3DSettings event listener failed\n"); }
// Release the AntiLag interface if (antiLag != NULL) { antiLag->pVtbl->Release(antiLag); antiLag = NULL; }
}
// Release the changeHandle interface if (changeHandle != NULL) { changeHandle->pVtbl->Release(changeHandle); changeHandle = NULL; }
// Release the GPU interface if (gpu != NULL) { gpu->pVtbl->Release(gpu); gpu = NULL; } } else { printf("Failed to get 3DSettings services\n"); }
// Release the 3DSettingsService interface if (d3dSettingSrv != NULL) { d3dSettingSrv->pVtbl->Release(d3dSettingSrv); d3dSettingSrv = NULL; }
// Release the GPUs list interface if (gpus != NULL) { gpus->pVtbl->Release(gpus); gpus = NULL; } } else { printf("ADLX initialization failed\n"); return 0; }
// Destroy ADLX res = ADLXHelper_Terminate(); printf("Destroy ADLX res: %d\n", res);
// Close event if (blockEvent) CloseHandle(blockEvent);
// Pause to see the print out system("pause");
return 0;}
void GPUUniqueName(IADLXGPU* gpu, char* uniqueName){ if (NULL != gpu && NULL != uniqueName) { const char* gpuName = NULL; ADLX_RESULT res1 = gpu->pVtbl->Name(gpu, &gpuName); adlx_int id; ADLX_RESULT res2 = gpu->pVtbl->UniqueId(gpu, &id); if (ADLX_SUCCEEDED(res1) && ADLX_SUCCEEDED(res2)) sprintf_s(uniqueName, 128, "name:%s, id:%d", gpuName, id); }}See Also: ADLX Macro, ADLX Enums