diff --git a/vendor/nvapi/NvApiDriverSettings.c b/vendor/nvapi/NvApiDriverSettings.c index 2fb52dd755..ea117a30cc 100644 --- a/vendor/nvapi/NvApiDriverSettings.c +++ b/vendor/nvapi/NvApiDriverSettings.c @@ -148,13 +148,6 @@ EValues_OGL_SINGLE_BACKDEPTH_BUFFER g_valuesOGL_SINGLE_BACKDEPTH_BUFFER[OGL_SING OGL_SINGLE_BACKDEPTH_BUFFER_USE_HW_DEFAULT, }; -EValues_OGL_SLI_CFR_MODE g_valuesOGL_SLI_CFR_MODE[OGL_SLI_CFR_MODE_NUM_VALUES] = -{ - OGL_SLI_CFR_MODE_DISABLE, - OGL_SLI_CFR_MODE_ENABLE, - OGL_SLI_CFR_MODE_CLASSIC_SFR, -}; - EValues_OGL_SLI_MULTICAST g_valuesOGL_SLI_MULTICAST[OGL_SLI_MULTICAST_NUM_VALUES] = { OGL_SLI_MULTICAST_DISABLE, @@ -775,6 +768,30 @@ EValues_PS_SHADERDISKCACHE g_valuesPS_SHADERDISKCACHE[PS_SHADERDISKCACHE_NUM_VAL PS_SHADERDISKCACHE_ON, }; +EValues_PS_SHADERDISKCACHE_FLAGS g_valuesPS_SHADERDISKCACHE_FLAGS[PS_SHADERDISKCACHE_FLAGS_NUM_VALUES] = +{ + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEFAULT_COMPILES, + PS_SHADERDISKCACHE_FLAGS_DISABLE_OPTIONAL_COMPILES, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DRIVER_VERSIONING, + PS_SHADERDISKCACHE_FLAGS_DUMP_HISTOGRAM, + PS_SHADERDISKCACHE_FLAGS_DUMP_TIMELINE, + PS_SHADERDISKCACHE_FLAGS_DISABLE_GARBAGE_COLLECTION, + PS_SHADERDISKCACHE_FLAGS_ENABLE_ENCRYPTION, + PS_SHADERDISKCACHE_FLAGS_DISABLE_CRC, + PS_SHADERDISKCACHE_FLAGS_ENABLE_STATS_FILES, + PS_SHADERDISKCACHE_FLAGS_DISABLE_STATS_RESET, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEBUG_FORCED_COMPILE, + PS_SHADERDISKCACHE_FLAGS_NO_COMPRESSION, + PS_SHADERDISKCACHE_FLAGS_RLE_COMPRESSION, + PS_SHADERDISKCACHE_FLAGS_LZMA_COMPRESSION, + PS_SHADERDISKCACHE_FLAGS_BACKEND_MEM_MAP_FILES, + PS_SHADERDISKCACHE_FLAGS_BACKEND_DLL, + PS_SHADERDISKCACHE_FLAGS_FLOOD_CACHE_DIRECTORY, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEDUPLICATION, + PS_SHADERDISKCACHE_FLAGS_DELETE_PERFECT_CACHES, + PS_SHADERDISKCACHE_FLAGS_ALL_BUILDS_MISMATCH_TEST, +}; + EValues_PS_SHADERDISKCACHE_MAX_SIZE g_valuesPS_SHADERDISKCACHE_MAX_SIZE[PS_SHADERDISKCACHE_MAX_SIZE_NUM_VALUES] = { PS_SHADERDISKCACHE_MAX_SIZE_MIN, @@ -878,7 +895,6 @@ SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] = {OGL_OVERLAY_SUPPORT_ID, OGL_OVERLAY_SUPPORT_STRING, 3, (NvU32 *)g_valuesOGL_OVERLAY_SUPPORT, OGL_OVERLAY_SUPPORT_OFF}, {OGL_QUALITY_ENHANCEMENTS_ID, OGL_QUALITY_ENHANCEMENTS_STRING, 4, (NvU32 *)g_valuesOGL_QUALITY_ENHANCEMENTS, OGL_QUALITY_ENHANCEMENTS_QUAL}, {OGL_SINGLE_BACKDEPTH_BUFFER_ID, OGL_SINGLE_BACKDEPTH_BUFFER_STRING, 3, (NvU32 *)g_valuesOGL_SINGLE_BACKDEPTH_BUFFER, OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE}, - {OGL_SLI_CFR_MODE_ID, OGL_SLI_CFR_MODE_STRING, 3, (NvU32 *)g_valuesOGL_SLI_CFR_MODE, OGL_SLI_CFR_MODE_DISABLE}, {OGL_SLI_MULTICAST_ID, OGL_SLI_MULTICAST_STRING, 4, (NvU32 *)g_valuesOGL_SLI_MULTICAST, OGL_SLI_MULTICAST_DISABLE}, {OGL_THREAD_CONTROL_ID, OGL_THREAD_CONTROL_STRING, 2, (NvU32 *)g_valuesOGL_THREAD_CONTROL, 0x00000000}, {OGL_TMON_LEVEL_ID, OGL_TMON_LEVEL_STRING, 6, (NvU32 *)g_valuesOGL_TMON_LEVEL, OGL_TMON_LEVEL_MOST}, @@ -895,6 +911,8 @@ SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] = {ANSEL_ALLOW_ID, ANSEL_ALLOW_STRING, 2, (NvU32 *)g_valuesANSEL_ALLOW, ANSEL_ALLOW_ALLOWED}, {ANSEL_ALLOWLISTED_ID, ANSEL_ALLOWLISTED_STRING, 2, (NvU32 *)g_valuesANSEL_ALLOWLISTED, ANSEL_ALLOWLISTED_DISALLOWED}, {ANSEL_ENABLE_ID, ANSEL_ENABLE_STRING, 2, (NvU32 *)g_valuesANSEL_ENABLE, ANSEL_ENABLE_ON}, + {APPIDLE_DYNAMIC_FRL_FPS_ID, APPIDLE_DYNAMIC_FRL_FPS_STRING, 0, NULL, 0x00000000}, + {APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_ID, APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_STRING, 0, NULL, 0x00000000}, {APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING, 6, (NvU32 *)g_valuesAPPLICATION_PROFILE_NOTIFICATION_TIMEOUT, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED}, {APPLICATION_STEAM_ID_ID, APPLICATION_STEAM_ID_STRING, 0, NULL, 0x00000000}, {BATTERY_BOOST_APP_FPS_ID, BATTERY_BOOST_APP_FPS_STRING, 3, (NvU32 *)g_valuesBATTERY_BOOST_APP_FPS, BATTERY_BOOST_APP_FPS_NO_OVERRIDE}, @@ -946,6 +964,7 @@ SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] = {MAXWELL_B_SAMPLE_INTERLEAVE_ID, MAXWELL_B_SAMPLE_INTERLEAVE_STRING, 2, (NvU32 *)g_valuesMAXWELL_B_SAMPLE_INTERLEAVE, MAXWELL_B_SAMPLE_INTERLEAVE_OFF}, {PRERENDERLIMIT_ID, PRERENDERLIMIT_STRING, 3, (NvU32 *)g_valuesPRERENDERLIMIT, PRERENDERLIMIT_APP_CONTROLLED}, {PS_SHADERDISKCACHE_ID, PS_SHADERDISKCACHE_STRING, 2, (NvU32 *)g_valuesPS_SHADERDISKCACHE, PS_SHADERDISKCACHE_ON}, + {PS_SHADERDISKCACHE_FLAGS_ID, PS_SHADERDISKCACHE_FLAGS_STRING, 20, (NvU32 *)g_valuesPS_SHADERDISKCACHE_FLAGS, 0x00000000}, {PS_SHADERDISKCACHE_MAX_SIZE_ID, PS_SHADERDISKCACHE_MAX_SIZE_STRING, 2, (NvU32 *)g_valuesPS_SHADERDISKCACHE_MAX_SIZE, 0x00000000}, {PS_TEXFILTER_ANISO_OPTS2_ID, PS_TEXFILTER_ANISO_OPTS2_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_ANISO_OPTS2, PS_TEXFILTER_ANISO_OPTS2_OFF}, {PS_TEXFILTER_BILINEAR_IN_ANISO_ID, PS_TEXFILTER_BILINEAR_IN_ANISO_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_BILINEAR_IN_ANISO, PS_TEXFILTER_BILINEAR_IN_ANISO_OFF}, @@ -966,5 +985,6 @@ SettingWSTRINGNameString mapSettingWSTRING[TOTAL_WSTRING_SETTING_NUM] = {CUDA_EXCLUDED_GPUS_ID, CUDA_EXCLUDED_GPUS_STRING, 1, (const wchar_t **)g_valuesCUDA_EXCLUDED_GPUS, L"none"}, {D3DOGL_GPU_MAX_POWER_ID, D3DOGL_GPU_MAX_POWER_STRING, 1, (const wchar_t **)g_valuesD3DOGL_GPU_MAX_POWER, L"0"}, {ICAFE_LOGO_CONFIG_ID, ICAFE_LOGO_CONFIG_STRING, 0, NULL, L""}, + {PS_SHADERDISKCACHE_DLL_PATH_WCHAR_ID, PS_SHADERDISKCACHE_DLL_PATH_WCHAR_STRING, 0, NULL, L""}, }; diff --git a/vendor/nvapi/NvApiDriverSettings.h b/vendor/nvapi/NvApiDriverSettings.h index 100f9c8faa..08e8ddc331 100644 --- a/vendor/nvapi/NvApiDriverSettings.h +++ b/vendor/nvapi/NvApiDriverSettings.h @@ -57,7 +57,6 @@ #define OGL_OVERLAY_SUPPORT_STRING L"Enable overlay" #define OGL_QUALITY_ENHANCEMENTS_STRING L"High level control of the rendering quality on OpenGL" #define OGL_SINGLE_BACKDEPTH_BUFFER_STRING L"Unified back/depth buffer" -#define OGL_SLI_CFR_MODE_STRING L"Set CFR mode" #define OGL_SLI_MULTICAST_STRING L"Enable NV_gpu_multicast extension" #define OGL_THREAD_CONTROL_STRING L"Threaded optimization" #define OGL_TMON_LEVEL_STRING L"Event Log Tmon Severity Threshold" @@ -74,6 +73,8 @@ #define ANSEL_ALLOW_STRING L"NVIDIA Predefined Ansel Usage" #define ANSEL_ALLOWLISTED_STRING L"Ansel flags for enabled applications" #define ANSEL_ENABLE_STRING L"Enable Ansel" +#define APPIDLE_DYNAMIC_FRL_FPS_STRING L"Idle Application Max FPS Limit" +#define APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_STRING L"Idle Application Threshold Time out in seconds" #define APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING L"Application Profile Notification Popup Timeout" #define APPLICATION_STEAM_ID_STRING L"Steam Application ID" #define BATTERY_BOOST_APP_FPS_STRING L"Battery Boost Application FPS" @@ -128,6 +129,8 @@ #define MAXWELL_B_SAMPLE_INTERLEAVE_STRING L"Enable sample interleaving (MFAA)" #define PRERENDERLIMIT_STRING L"Maximum pre-rendered frames" #define PS_SHADERDISKCACHE_STRING L"Shader Cache" +#define PS_SHADERDISKCACHE_DLL_PATH_WCHAR_STRING L"shader cache path to dll" +#define PS_SHADERDISKCACHE_FLAGS_STRING L"shader cache control flags" #define PS_SHADERDISKCACHE_MAX_SIZE_STRING L"Shader disk cache maximum size" #define PS_TEXFILTER_ANISO_OPTS2_STRING L"Texture filtering - Anisotropic sample optimization" #define PS_TEXFILTER_BILINEAR_IN_ANISO_STRING L"Texture filtering - Anisotropic filter optimization" @@ -159,7 +162,6 @@ enum ESetting { OGL_OVERLAY_SUPPORT_ID = 0x206C28C4, OGL_QUALITY_ENHANCEMENTS_ID = 0x20797D6C, OGL_SINGLE_BACKDEPTH_BUFFER_ID = 0x20A29055, - OGL_SLI_CFR_MODE_ID = 0x20343843, OGL_SLI_MULTICAST_ID = 0x2092D3BE, OGL_THREAD_CONTROL_ID = 0x20C1221E, OGL_TMON_LEVEL_ID = 0x202888C1, @@ -176,6 +178,8 @@ enum ESetting { ANSEL_ALLOW_ID = 0x1035DB89, ANSEL_ALLOWLISTED_ID = 0x1085DA8A, ANSEL_ENABLE_ID = 0x1075D972, + APPIDLE_DYNAMIC_FRL_FPS_ID = 0x10835016, + APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_ID = 0x10835017, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6, APPLICATION_STEAM_ID_ID = 0x107CDDBC, BATTERY_BOOST_APP_FPS_ID = 0x10115C8C, @@ -230,6 +234,8 @@ enum ESetting { MAXWELL_B_SAMPLE_INTERLEAVE_ID = 0x0098C1AC, PRERENDERLIMIT_ID = 0x007BA09E, PS_SHADERDISKCACHE_ID = 0x00198FFF, + PS_SHADERDISKCACHE_DLL_PATH_WCHAR_ID = 0x0019A002, + PS_SHADERDISKCACHE_FLAGS_ID = 0x00F4889B, PS_SHADERDISKCACHE_MAX_SIZE_ID = 0x00AC8497, PS_TEXFILTER_ANISO_OPTS2_ID = 0x00E73211, PS_TEXFILTER_BILINEAR_IN_ANISO_ID = 0x0084CD70, @@ -242,9 +248,9 @@ enum ESetting { SET_VAB_DATA_ID = 0x00AB8687, VSYNCMODE_ID = 0x00A879CF, VSYNCTEARCONTROL_ID = 0x005A375C, - TOTAL_DWORD_SETTING_NUM = 96, - TOTAL_WSTRING_SETTING_NUM = 4, - TOTAL_SETTING_NUM = 100, + TOTAL_DWORD_SETTING_NUM = 98, + TOTAL_WSTRING_SETTING_NUM = 5, + TOTAL_SETTING_NUM = 103, INVALID_SETTING_ID = 0xFFFFFFFF }; @@ -371,14 +377,6 @@ enum EValues_OGL_SINGLE_BACKDEPTH_BUFFER { OGL_SINGLE_BACKDEPTH_BUFFER_DEFAULT = OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE }; -enum EValues_OGL_SLI_CFR_MODE { - OGL_SLI_CFR_MODE_DISABLE = 0x00, - OGL_SLI_CFR_MODE_ENABLE = 0x01, - OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x02, - OGL_SLI_CFR_MODE_NUM_VALUES = 3, - OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_DISABLE -}; - enum EValues_OGL_SLI_MULTICAST { OGL_SLI_MULTICAST_DISABLE = 0x00, OGL_SLI_MULTICAST_ENABLE = 0x01, @@ -1056,6 +1054,31 @@ enum EValues_PS_SHADERDISKCACHE { PS_SHADERDISKCACHE_DEFAULT = PS_SHADERDISKCACHE_ON }; +enum EValues_PS_SHADERDISKCACHE_FLAGS { + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEFAULT_COMPILES = 0x00000001, + PS_SHADERDISKCACHE_FLAGS_DISABLE_OPTIONAL_COMPILES = 0x00000002, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DRIVER_VERSIONING = 0x00000008, + PS_SHADERDISKCACHE_FLAGS_DUMP_HISTOGRAM = 0x00000010, + PS_SHADERDISKCACHE_FLAGS_DUMP_TIMELINE = 0x00000020, + PS_SHADERDISKCACHE_FLAGS_DISABLE_GARBAGE_COLLECTION = 0x00000040, + PS_SHADERDISKCACHE_FLAGS_ENABLE_ENCRYPTION = 0x00000080, + PS_SHADERDISKCACHE_FLAGS_DISABLE_CRC = 0x00000100, + PS_SHADERDISKCACHE_FLAGS_ENABLE_STATS_FILES = 0x00000200, + PS_SHADERDISKCACHE_FLAGS_DISABLE_STATS_RESET = 0x00000400, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEBUG_FORCED_COMPILE = 0x00000800, + PS_SHADERDISKCACHE_FLAGS_NO_COMPRESSION = 0x00001000, + PS_SHADERDISKCACHE_FLAGS_RLE_COMPRESSION = 0x00002000, + PS_SHADERDISKCACHE_FLAGS_LZMA_COMPRESSION = 0x00004000, + PS_SHADERDISKCACHE_FLAGS_BACKEND_MEM_MAP_FILES = 0x00010000, + PS_SHADERDISKCACHE_FLAGS_BACKEND_DLL = 0x00020000, + PS_SHADERDISKCACHE_FLAGS_FLOOD_CACHE_DIRECTORY = 0x00100000, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEDUPLICATION = 0x00200000, + PS_SHADERDISKCACHE_FLAGS_DELETE_PERFECT_CACHES = 0x00400000, + PS_SHADERDISKCACHE_FLAGS_ALL_BUILDS_MISMATCH_TEST = 0x00800000, + PS_SHADERDISKCACHE_FLAGS_NUM_VALUES = 20, + PS_SHADERDISKCACHE_FLAGS_DEFAULT = 0x0 +}; + enum EValues_PS_SHADERDISKCACHE_MAX_SIZE { PS_SHADERDISKCACHE_MAX_SIZE_MIN = 0x0, PS_SHADERDISKCACHE_MAX_SIZE_MAX = 0xffffffff, diff --git a/vendor/nvapi/amd64/nvapi64.lib b/vendor/nvapi/amd64/nvapi64.lib index 9f3729abad..1483b30007 100644 Binary files a/vendor/nvapi/amd64/nvapi64.lib and b/vendor/nvapi/amd64/nvapi64.lib differ diff --git a/vendor/nvapi/nvHLSLExtns.h b/vendor/nvapi/nvHLSLExtns.h index 9394036dad..3b5d3a0a0c 100644 --- a/vendor/nvapi/nvHLSLExtns.h +++ b/vendor/nvapi/nvHLSLExtns.h @@ -1625,6 +1625,123 @@ uint4 NvWaveMultiPrefixExclusiveXOr(uint4 val, uint mask) return NvWaveMultiPrefixInclusiveXOr(val, mask); } + +//----------------------------------------------------------------------------// +//------------------------- DXR Micro-map Extension --------------------------// +//----------------------------------------------------------------------------// + +float3x3 NvRtTriangleObjectPositions() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_TRIANGLE_OBJECT_POSITIONS; + + float3x3 ret; + ret[0][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][2] = asfloat(g_NvidiaExt.IncrementCounter()); + return ret; +} + +float3x3 NvRtMicroTriangleObjectPositions() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_TRIANGLE_OBJECT_POSITIONS; + + float3x3 ret; + ret[0][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][2] = asfloat(g_NvidiaExt.IncrementCounter()); + return ret; +} + +float3x2 NvRtMicroTriangleBarycentrics() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_TRIANGLE_BARYCENTRICS; + + float3x2 ret; + ret[0][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][1] = asfloat(g_NvidiaExt.IncrementCounter()); + return ret; +} + +bool NvRtIsMicroTriangleHit() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_IS_MICRO_TRIANGLE_HIT; + uint ret = g_NvidiaExt.IncrementCounter(); + return ret != 0; +} + +bool NvRtIsBackFacing() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_IS_BACK_FACING; + uint ret = g_NvidiaExt.IncrementCounter(); + return ret != 0; +} + +#if __SHADER_TARGET_MAJOR > 6 || (__SHADER_TARGET_MAJOR == 6 && __SHADER_TARGET_MINOR >= 5) + +float3 NvRtMicroVertexObjectPosition(RaytracingAccelerationStructure AccelerationStructure, uint InstanceIndex, uint GeometryIndex, uint PrimitiveIndex, uint2 UV) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_VERTEX_OBJECT_POSITION; + g_NvidiaExt[index].src0u.x = InstanceIndex; + g_NvidiaExt[index].src0u.y = GeometryIndex; + g_NvidiaExt[index].src0u.z = PrimitiveIndex; + g_NvidiaExt[index].src0u.w = UV.x; + g_NvidiaExt[index].src1u.x = UV.y; + uint handle = g_NvidiaExt.IncrementCounter(); + float3 ret; + ret.x = asfloat(g_NvidiaExt.IncrementCounter()); + ret.y = asfloat(g_NvidiaExt.IncrementCounter()); + ret.z = asfloat(g_NvidiaExt.IncrementCounter()); + + RayQuery<0> rq; + rq.TraceRayInline(AccelerationStructure, 0, handle, (RayDesc)0); + + return ret; +} + +float2 NvRtMicroVertexBarycentrics(RaytracingAccelerationStructure AccelerationStructure, uint InstanceIndex, uint GeometryIndex, uint PrimitiveIndex, uint2 UV) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_VERTEX_BARYCENTRICS; + g_NvidiaExt[index].src0u.x = InstanceIndex; + g_NvidiaExt[index].src0u.y = GeometryIndex; + g_NvidiaExt[index].src0u.z = PrimitiveIndex; + g_NvidiaExt[index].src0u.w = UV.x; + g_NvidiaExt[index].src1u.x = UV.y; + uint handle = g_NvidiaExt.IncrementCounter(); + float2 ret; + ret.x = asfloat(g_NvidiaExt.IncrementCounter()); + ret.y = asfloat(g_NvidiaExt.IncrementCounter()); + + RayQuery<0> rq; + rq.TraceRayInline(AccelerationStructure, 0, handle, (RayDesc)0); + + return ret; +} + +#endif + //----------------------------------------------------------------------------// //------------------------- DXR HitObject Extension --------------------------// //----------------------------------------------------------------------------// diff --git a/vendor/nvapi/nvShaderExtnEnums.h b/vendor/nvapi/nvShaderExtnEnums.h index cfa918b3e7..0913884176 100644 --- a/vendor/nvapi/nvShaderExtnEnums.h +++ b/vendor/nvapi/nvShaderExtnEnums.h @@ -114,6 +114,15 @@ #define NV_EXTN_OP_HIT_OBJECT_IS_NOP 84 #define NV_EXTN_OP_HIT_OBJECT_MAKE_NOP 85 +// Micro-map API +#define NV_EXTN_OP_RT_TRIANGLE_OBJECT_POSITIONS 86 +#define NV_EXTN_OP_RT_MICRO_TRIANGLE_OBJECT_POSITIONS 87 +#define NV_EXTN_OP_RT_MICRO_TRIANGLE_BARYCENTRICS 88 +#define NV_EXTN_OP_RT_IS_MICRO_TRIANGLE_HIT 89 +#define NV_EXTN_OP_RT_IS_BACK_FACING 90 +#define NV_EXTN_OP_RT_MICRO_VERTEX_OBJECT_POSITION 91 +#define NV_EXTN_OP_RT_MICRO_VERTEX_BARYCENTRICS 92 + //----------------------------------------------------------------------------// //-------------------- GET_SPECIAL subOpCode constants -----------------------// //----------------------------------------------------------------------------// diff --git a/vendor/nvapi/nvapi.h b/vendor/nvapi/nvapi.h index 9b4733b1b7..846ca2f636 100644 --- a/vendor/nvapi/nvapi.h +++ b/vendor/nvapi/nvapi.h @@ -41,7 +41,7 @@ /////////////////////////////////////////////////////////////////////////////// // -// Date: Apr 4, 2023 +// Date: Feb 1, 2024 // File: nvapi.h // // NvAPI provides an interface to NVIDIA devices. This file contains the @@ -338,6 +338,23 @@ typedef NV_EDID_V3 NV_EDID; //! \ingroup gpu NVAPI_INTERFACE NvAPI_GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID); +//! \ingroup gpu + +//! Used in NvAPI_DISP_GetEdidData + +#define NV_EDID_DATA_SIZE_MAX 1024 //!< This is the current size supported by Nvidia Display Driver and may change in future. + +typedef enum +{ + NV_EDID_FLAG_DEFAULT = 0, //!< the EDID which is actively used by the driver, it could be _RAW/_COOKED/_FORCED/_INF. + NV_EDID_FLAG_RAW = 1, //!< the EDID which is not modified by the driver. If there's no _FORCED edid engaged, it + //!< will be the unmodified monitor EDID from the I2C bus. Otherwise it is original _FORCED edid. + NV_EDID_FLAG_COOKED = 2, //!< the EDID has been modified by the driver for compatibility + NV_EDID_FLAG_FORCED = 3, //!< the EDID is forced by the end-user over s/w interface, + NV_EDID_FLAG_INF = 4, //!< the EDID is from monitor INF + NV_EDID_FLAG_HW = 5, //!< the EDID is from the monitor over I2C bus without any modification. +} NV_EDID_FLAG; + //! \ingroup gpu //! Used in NV_GPU_CONNECTOR_DATA typedef enum _NV_GPU_CONNECTOR_TYPE @@ -4218,6 +4235,329 @@ typedef NV_LICENSABLE_FEATURES_V4 NV_LICENSABLE_FEATURES; NVAPI_INTERFACE NvAPI_GPU_GetLicensableFeatures(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_LICENSABLE_FEATURES *pLicensableFeatures); +#define NVAPI_NVLINK_COUNTER_MAX_TYPES 32 +#define NVAPI_NVLINK_MAX_LINKS 32 + +//! \ingroup nvlink +//! @{ +//! Used in NvAPI_GPU_NVLINK_GetCaps() + +/* caps format is byte_index:bit_mask */ +#define NVAPI_NVLINK_CAPS_SUPPORTED 0x00000001 //!< Set if NVLink is present and supported on this GPU.This field is used for *global* caps only and NOT for per-link caps +#define NVAPI_NVLINK_CAPS_P2P_SUPPORTED 0x00000002 //!< Set if P2P over NVLink is supported on this GPU. +#define NVAPI_NVLINK_CAPS_SYSMEM_ACCESS 0x00000004 //!< Set if sysmem can be accessed over NVLink on this GPU. +#define NVAPI_NVLINK_CAPS_P2P_ATOMICS 0x00000008 //!< Set if P2P atomics are supported over NVLink on this GPU. +#define NVAPI_NVLINK_CAPS_SYSMEM_ATOMICS 0x00000010 //!< Set if sysmem atomic transcations are supported over NVLink on this GPU. +#define NVAPI_NVLINK_CAPS_PEX_TUNNELING 0x00000020 //!< Set if PEX tunneling over NVLink is supported on this GPU. +#define NVAPI_NVLINK_CAPS_SLI_BRIDGE 0x00000040 //!< Set if SLI over NVLink is supported on this GPU. +#define NVAPI_NVLINK_CAPS_SLI_BRIDGE_SENSABLE 0x00000080 //!< This bit is set if capable of sensing SLI bridges. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L0 0x00000100 //!< This bit is set if L0 is a supported power state on this GPU. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L1 0x00000200 //!< This bit is set if L1 is a supported power state on this GPU. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L2 0x00000400 //!< This bit is set if L2 is a supported power state on this GPU. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L3 0x00000800 //!< This bit is set if L3 is a supported power state on this GPU. + +#define NVAPI_NVLINK_CAPS_VALID 0x00001000 //!< Set if this link is supported on this GPU.This field is used for *per-link* caps only and NOT for global caps. + +#define NVAPI_NVLINK_CAPS_NVLINK_VERSION_INVALID (0x00000000) +#define NVAPI_NVLINK_CAPS_NVLINK_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_CAPS_NVLINK_VERSION_2_0 (0x00000002) + +#define NVAPI_NVLINK_CAPS_NCI_VERSION_INVALID (0x00000000) +#define NVAPI_NVLINK_CAPS_NCI_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_CAPS_NCI_VERSION_2_0 (0x00000002) + +typedef struct +{ + NvU32 version; //!< Version of this structure. Must always be first element in this structure. + NvU32 capsTbl; //!< This is bit field for getting different global caps.The individual bitfields are specified by NVAPI_NVLINK_CAPS_* + NvU8 lowestNvlinkVersion; //!< This field specifies the lowest supported NVLink version for this GPU. + NvU8 highestNvlinkVersion; //!< This field specifies the highest supported NVLink version for this GPU. + NvU8 lowestNciVersion; //!< This field specifies the lowest supported NCI version for this GPU. + NvU8 highestNciVersion; //!< This field specifies the highest supported NCI version for this GPU. + NvU32 linkMask; //!< This field provides a bitfield mask of NVLink links enabled on this GPU. +}NVLINK_GET_CAPS_V1; + +typedef NVLINK_GET_CAPS_V1 NVLINK_GET_CAPS; +#define NVLINK_GET_CAPS_VER1 MAKE_NVAPI_VERSION(NVLINK_GET_CAPS_V1, 1) + +#define NVLINK_GET_CAPS_VER NVLINK_GET_CAPS_VER1 +//! @} +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_NVLINK_GetCaps +// +//! DESCRIPTION: This function returns the NVLink capabilities supported by the GPU. +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 361 +//! +//! \param [in] hPhysicalGpu GPU selection +//! +//! \param [in,out] NVLINK_GET_CAPS This structure contains the output parameters. +//! Also need to specify the version. +//! +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE - The caller does not have administrative privileges +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \ingroup nvlink +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_NVLINK_GetCaps(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NVLINK_GET_CAPS *capsParams); + + +//! \ingroup nvlink +//! @{ +//! Used in NvAPI_GPU_NVLINK_GetStatus() + +#define NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_NONE (0x00000000) +#define NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_PCI (0x00000001) +#define NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_UUID (0x00000002) + +typedef enum _NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE +{ + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_EBRIDGE, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_NPU, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_GPU, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_SWITCH, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_TEGRA, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_NONE, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_UUID_INVALID, +} NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE; + +typedef struct +{ + NvU32 deviceIdFlags; //!< ID Flags, Bitmask that specifies which IDs are valid for the GPU. Refer NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_* for possible values. + //!< If NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_PCI is set, PCI information is valid. + //!< If NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_UUID is set, UUID is valid. + NvU16 domain; //!< domain, bus, device, function, pciDeviceId : PCI information for the GPU. + NvU16 bus; + NvU16 device; + NvU16 function; + NvU32 pciDeviceId; + NvU64 deviceType; //!< GPU Type. See NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_* for possible values. + NvU8 deviceUUID[16]; //!< GPU UUID +}NVLINK_DEVICE_INFO_V1; + +typedef enum _NVAPI_NVLINK_STATUS_LINK_STATE +{ + NVAPI_NVLINK_STATUS_LINK_STATE_UNKNOWN, + NVAPI_NVLINK_STATUS_LINK_STATE_INIT, + NVAPI_NVLINK_STATUS_LINK_STATE_HWCFG, + NVAPI_NVLINK_STATUS_LINK_STATE_SWCFG, + NVAPI_NVLINK_STATUS_LINK_STATE_ACTIVE, + NVAPI_NVLINK_STATUS_LINK_STATE_FAULT, + NVAPI_NVLINK_STATUS_LINK_STATE_RECOVERY, + NVAPI_NVLINK_STATUS_LINK_STATE_RECOVERY_AC, + NVAPI_NVLINK_STATUS_LINK_STATE_RECOVERY_AX, + NVAPI_NVLINK_STATUS_LINK_STATE_INVALID = 0xFFFFFFFF, +}NVAPI_NVLINK_STATUS_LINK_STATE; + +typedef enum _NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE +{ + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_UNKNOWN, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_HIGH_SPEED_1, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_LOW_POWER, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_TRAINING, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_SAFE_MODE, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_OFF, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_TEST, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_FAULT, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_INVALID = 0xFF, +}NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE; + +typedef enum _NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE +{ + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_UNKNOWN, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_HIGH_SPEED_1, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_LOW_POWER, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_TRAINING, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_SAFE_MODE, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_OFF, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_TEST, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_FAULT, + + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_INVALID= 0xFF, +} NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE; + + +#define NVAPI_NVLINK_STATUS_PHY_NVHS (0x00000001) +#define NVAPI_NVLINK_STATUS_PHY_GRS (0x00000002) +#define NVAPI_NVLINK_STATUS_PHY_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_NVLINK_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_NVLINK_VERSION_2_0 (0x00000002) +#define NVAPI_NVLINK_STATUS_NVLINK_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_NCI_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_NCI_VERSION_2_0 (0x00000002) +#define NVAPI_NVLINK_STATUS_NCI_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_NVHS_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_NVHS_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_GRS_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_GRS_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_CONNECTED_TRUE (0x00000001) +#define NVAPI_NVLINK_STATUS_CONNECTED_FALSE (0x00000000) + +#define NVAPI_NVLINK_STATUS_LOOP_PROPERTY_LOOPBACK (0x00000001) +#define NVAPI_NVLINK_STATUS_LOOP_PROPERTY_LOOPOUT (0x00000002) +#define NVAPI_NVLINK_STATUS_LOOP_PROPERTY_NONE (0x00000000) + +#define NVAPI_NVLINK_STATUS_REMOTE_LINK_NUMBER_INVALID (0x000000FF) + +#define NVAPI_NVLINK_REFCLK_TYPE_INVALID (0x00) +#define NVAPI_NVLINK_REFCLK_TYPE_NVHS (0x01) +#define NVAPI_NVLINK_REFCLK_TYPE_PEX (0x02) + + +typedef struct +{ + NvU32 capsTbl; //!< This is bit field for getting different global caps.The individual bitfields are specified by NVAPI_NVLINK_CAPS_*. + NvU8 phyType; //!< This field specifies the type of PHY (NVHS or GRS) being used for this link. + NvU8 subLinkWidth; //!< This field specifies the no. of lanes per sublink. + NvU32 linkState; //!< This field specifies the current state of the link.See NVAPI_NVLINK_GET_NVLINK_STATUS_LINK_STATE_* for possible values. + NvU8 rxSublinkStatus; //!< This field specifies the current state of RX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_RX_STATE_* for possible values. + NvU8 txSublinkStatus; //!< This field specifies the current state of TX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_TX_STATE_* for possible values. + NvU8 nvlinkVersion; //!< This field specifies the NVLink version supported by the link. + NvU8 nciVersion; //!< This field specifies the NCI version supported by the link. + NvU8 phyVersion; //!< This field specifies the version of PHY being used by the link. + NvU32 nvlinkCommonClockSpeedMhz; //!< This field gives the value of nvlink common clock in MHz. + NvU32 nvlinkRefClkSpeedMhz; //!< This field gives the value of nvlink refclk clock in MHz. + NvU8 nvlinkRefClkType; //!< This field specifies whether refclk is taken from NVHS reflck or PEX refclk for the current GPU.See NVAPI_NVLINK_REFCLK_TYPE_INVALID* for possible values. + NvU32 nvlinkLinkClockMhz; //!< This field gives the actual clock/speed at which links is running in MHz. + NvU32 connected:1 ; //!< This field specifies if any device is connected on the other end of the link. + NvU32 reserved:31; //!< Reserved for future use. + NvU8 loopProperty; //!< This field specifies if the link is a loopback/loopout link. See NVAPI_NVLINK_STATUS_LOOP_PROPERTY_* for possible values. + NvU8 remoteDeviceLinkNumber; //!< This field specifies the link number on the remote end of the link. + NVLINK_DEVICE_INFO_V1 remoteDeviceInfo; //!< This field stores the GPU information for the remote end of the link +}NVLINK_LINK_STATUS_INFO_V1; + +typedef struct +{ + NvU32 capsTbl; //!< This is bit field for getting different global caps.The individual bitfields are specified by NVAPI_NVLINK_CAPS_*. + NvU8 phyType; //!< This field specifies the type of PHY (NVHS or GRS) being used for this link. + NvU8 subLinkWidth; //!< This field specifies the no. of lanes per sublink. + NvU32 linkState; //!< This field specifies the current state of the link.See NVAPI_NVLINK_GET_NVLINK_STATUS_LINK_STATE_* for possible values. + NvU8 rxSublinkStatus; //!< This field specifies the current state of RX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_RX_STATE_* for possible values. + NvU8 txSublinkStatus; //!< This field specifies the current state of TX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_TX_STATE_* for possible values. + NvU8 nvlinkVersion; //!< This field specifies the NVLink version supported by the link. + NvU8 nciVersion; //!< This field specifies the NCI version supported by the link. + NvU8 phyVersion; //!< This field specifies the version of PHY being used by the link. + NvU32 nvlinkCommonClockSpeedMhz; //!< This field gives the value of nvlink common clock in MHz. + NvU32 nvlinkRefClkSpeedMhz; //!< This field gives the value of nvlink refclk clock in MHz. + NvU8 nvlinkRefClkType; //!< This field specifies whether refclk is taken from NVHS reflck or PEX refclk for the current GPU.See NVAPI_NVLINK_REFCLK_TYPE_INVALID* for possible values. + NvU32 nvlinkLinkClockMhz; //!< This field gives the actual clock/speed at which links is running in MHz. + NvU32 connected:1 ; //!< This field specifies if any device is connected on the other end of the link. + NvU32 reserved:31; //!< Reserved for future use. + NvU8 loopProperty; //!< This field specifies if the link is a loopback/loopout link. See NVAPI_NVLINK_STATUS_LOOP_PROPERTY_* for possible values. + NvU8 remoteDeviceLinkNumber; //!< This field specifies the link number on the remote end of the link. + NVLINK_DEVICE_INFO_V1 remoteDeviceInfo; //!< This field stores the device information for the remote end of the link + NvU8 localDeviceLinkNumber; //!< This field specifies the link number on the local end of the link. + NVLINK_DEVICE_INFO_V1 localDeviceInfo; //!< This field stores the device information for the local end of the link. + NvU32 nvlinkLineRateMbps; //!< Bit rate at which bits toggle on wires in megabits per second. + NvU32 reservedEx[8]; //!< Reserved for future use to avoid versioning. +}NVLINK_LINK_STATUS_INFO_V2; + +typedef struct +{ + NvU32 version; //!< Version of this structure. Must always be first element in this structure. + NvU32 linkMask; //!< This parameter specifies for which links we want the status. + NVLINK_LINK_STATUS_INFO_V1 linkInfo[NVAPI_NVLINK_MAX_LINKS]; //!< This structure stores the per-link status of different NVLink parameters. The link is identified by the index. +}NVLINK_GET_STATUS_V1; + +typedef struct +{ + NvU32 version; //!< Version of this structure. Must always be first element in this structure. + NvU32 linkMask; //!< This parameter specifies for which links we want the status. + NVLINK_LINK_STATUS_INFO_V2 linkInfo[NVAPI_NVLINK_MAX_LINKS]; //!< This structure stores the per-link status of different NVLink parameters. The link is identified by the index. +}NVLINK_GET_STATUS_V2; + + +typedef NVLINK_GET_STATUS_V2 NVLINK_GET_STATUS; +#define NVLINK_GET_STATUS_VER1 MAKE_NVAPI_VERSION(NVLINK_GET_STATUS_V1, 1) +#define NVLINK_GET_STATUS_VER2 MAKE_NVAPI_VERSION(NVLINK_GET_STATUS_V2, 2) + +#define NVLINK_GET_STATUS_VER NVLINK_GET_STATUS_VER2 +//! @} +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_NVLINK_GetStatus +// +//! DESCRIPTION: This function returns the NVLink status. +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 361 +//! +//! \param [in] hPhysicalGpu GPU selection +//! +//! \param [in,out] NVLINK_GET_STATUS This structure contains the input and output parameters. +//! linkMask is the input param while others are output parameters. +//! Also need to specify the version. +//! +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE - The caller does not have administrative privileges +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \ingroup nvlink +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_NVLINK_GetStatus(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NVLINK_GET_STATUS* statusParams); + + +typedef struct _NV_GPU_INFO_V1 +{ + NvU32 version; //!< Structure Version. + NvU32 bIsExternalGpu:1; //!< This flag is set for external GPU. + NvU32 reserved:31; //!< Reserved for future use +} NV_GPU_INFO_V1; + +typedef struct _NV_GPU_INFO_V2 +{ + NvU32 version; //!< Structure Version. + NvU32 bIsExternalGpu:1; //!< This flag is set for external GPU. + NvU32 reserved0:31; //!< Reserved for future use + NvU64 reserved1; //!< Reserved for future use + NvU32 rayTracingCores; //!< Number of "Ray Tracing Cores" supported by the GPU. + NvU32 tensorCores; //!< Number of "Tensor Cores" supported by the GPU. + NvU32 reserved2[14]; //!< Reserved for future use. +} NV_GPU_INFO_V2; + +#define NV_GPU_INFO_VER1 MAKE_NVAPI_VERSION(NV_GPU_INFO_V1, 1) +#define NV_GPU_INFO_VER2 MAKE_NVAPI_VERSION(NV_GPU_INFO_V2, 2) +#define NV_GPU_INFO_VER NV_GPU_INFO_VER2 +typedef NV_GPU_INFO_V2 NV_GPU_INFO; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetGPUInfo +// +//! DESCRIPTION: This API will return NVIDIA GPU related information. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 400 +//! +//! \param [in,out] pGpuInfo - This structure will be filled with required information. +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetGPUInfo(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_INFO *pGpuInfo); + + typedef struct _NV_GPU_VR_READY_V1 { @@ -4253,6 +4593,53 @@ typedef NV_GPU_VR_READY_V1 NV_GPU_VR_READY; /////////////////////////////////////////////////////////////////////////////// NVAPI_INTERFACE NvAPI_GPU_GetVRReadyData(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_VR_READY *pGpuVrReadyData); + +//! \ingroup gpu +#define NVAPI_GPU_MAX_BUILD_VERSION_LENGTH (0x0000040) + +//! \ingroup gpu +//! Used in NvAPI_GPU_GetGspFeatures(). +typedef struct _NV_GPU_GSP_INFO_V1 +{ + NvU32 version; //!< [in] Structure version + NvU8 firmwareVersion[NVAPI_GPU_MAX_BUILD_VERSION_LENGTH]; //!< [out] Contains GSP firmware version + NvU32 reserved; //!< Reserved for future use +} NV_GPU_GSP_INFO_V1; + +//! \ingroup gpu +//! Macro for constructing the version field of NV_GPU_GSP_INFO_V1 +#define NV_GPU_GSP_INFO_VER1 MAKE_NVAPI_VERSION(NV_GPU_GSP_INFO_V1, 1) +#define NV_GPU_GSP_INFO_VER NV_GPU_GSP_INFO_VER1 +typedef NV_GPU_GSP_INFO_V1 NV_GPU_GSP_INFO; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetGspFeatures +// +//! DESCRIPTION: If the device has GSP running, this function populates firmwareVersion field +//! with GSP firmware version and returns NVAPI_OK +//! Otherwise returns NVAPI_NOT_SUPPORTED +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 550 +//! +//! \param [in] hPhysicalGpu GPU selection +//! \param [out] pGspInfo GSP firmware version +//! +//! \retval NVAPI_INVALID_ARGUMENT pMemoryInfo is NULL +//! \retval NVAPI_OK call successful +//! \retval NVAPI_API_NOT_INTIALIZED nvapi not initialized +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_GPU_GSP_INFO structure version mismatch +//! \retval NVAPI_NOT_SUPPORTED GSP is not running/supported on this device +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetGspFeatures(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_GSP_INFO *pGspInfo); + //! Used in NvAPI_GPU_GetPerfDecreaseInfo. //! Bit masks for knowing the exact reason for performance decrease typedef enum _NVAPI_GPU_PERF_DECREASE @@ -4378,8 +4765,7 @@ typedef NV_GPU_PERF_PSTATES_INFO_V2 NV_GPU_PERF_PSTATES_INFO; // // FUNCTION NAME: NvAPI_GPU_GetPstatesInfoEx // -//! DESCRIPTION: This API retrieves all performance states (P-States) information. This is the same as -//! NvAPI_GPU_GetPstatesInfo(), but supports an input flag for various options. +//! DESCRIPTION: This API retrieves all performance states (P-States) information. //! //! P-States are GPU active/executing performance capability and power consumption states. //! @@ -8188,6 +8574,65 @@ NVAPI_INTERFACE NvAPI_DISP_SetDisplayConfig(__in NvU32 pathInfoCount, __in_ecoun +//! \ingroup dispcontrol +//! @{ +typedef struct _NV_EDID_DATA_V1 +{ + NvU32 version; //!< Structure version. + NvU8 *pEDID; //!< Pointer to EDID data. + NvU32 sizeOfEDID; //!< Size of EDID data. +} NV_EDID_DATA_V1; + +typedef struct _NV_EDID_DATA_V2 +{ + NvU32 version; //!< Structure version. + NvU8 *pEDID; //!< Pointer to EDID data. + NvU32 sizeOfEDID; //!< Size of EDID data. + NvU32 reserved[8]; //!< Reserved for future use. +} NV_EDID_DATA_V2; + +typedef NV_EDID_DATA_V2 NV_EDID_DATA; +#define NV_EDID_DATA_VER1 MAKE_NVAPI_VERSION(NV_EDID_DATA_V1, 1) +#define NV_EDID_DATA_VER2 MAKE_NVAPI_VERSION(NV_EDID_DATA_V2, 2) + +#define NV_EDID_DATA_VER NV_EDID_DATA_VER2 +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetEdidData +// +//! \code +//! DESCRIPTION: This API returns the EDID data for the specified display Id. +//! (NvAPI_GPU_GetConnectedDisplayIds() can be used to get the DisplayIds). +//! +//! USAGE: The caller has to call this API two times to fetch the required details as follows: +//! First Pass : Caller should call NvAPI_DISP_GetEdidData() with pEdidParams->pEDID set to NULL, +//! to get the size of the EDID buffer in pEdidParams->sizeOfEDID. +//! Second Pass: Allocate memory for the EDID buffer of the size - pEdidParams->sizeOfEDID, +//! and call the API again to get the EDID buffer populated. +//! +//! +//! \param [in] displayId - NVIDIA Display ID +//! \param [inout] pEdidParams - Pointer to the structure that contains - pointer to EDID buffer and its size +//! \param [inout] pFlag - The type of EDID to be retrieved (IN). +//! To only retrieve the EDID type, the user should send pEdidParams->pEDID as NULL and +//! pEdidParams->sizeOfEDID as 0. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 400 +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! NVAPI_INSUFFICIENT_BUFFER: Reallocate buffer with pEdidParams->sizeOfEDID and call again to get complete data. +//! In this case pEdidParams->pEDID contains undefined data. +//! This error occurs only when pEdidParams->pEDID is present. +//! \endcode +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetEdidData(__in NvU32 displayId, __inout NV_EDID_DATA *pEdidParams, __inout NV_EDID_FLAG *pFlag); +//! @} + typedef struct _NV_GET_ADAPTIVE_SYNC_DATA_V1 { NvU32 version ; //!< [in] structure version @@ -8518,6 +8963,89 @@ NVAPI_INTERFACE NvAPI_DISP_AcquireDedicatedDisplay(__in NvU32 displayId, __inout NVAPI_INTERFACE NvAPI_DISP_ReleaseDedicatedDisplay(__in NvU32 displayId); #endif // defined(__cplusplus) +//! SUPPORTED OS: Windows 11 and higher +//! +#if defined(__cplusplus) + +typedef struct _NV_MANAGED_DEDICATED_DISPLAY_METADATA +{ + NvU32 version; //!< [in] Version of this structure. + NvU32 displayId; //!< [in] DisplayId to identify the display connector the metadata operation is requested for. + NvU32 bSetPosition : 1; //!< [in] Set call: 1 in case the information in variables/fields "positionX" and "positionY" should be stored as metadata. 0 otherwise. + NvU32 bRemovePosition : 1; //!< [in] Set call: 1 in case the stored positionX and positionY metadata should be set to 'not defined', N/A. 0 otherwise. + NvU32 bPositionIsAvailable : 1; //!< [out] Query call: 1 in case the information in variables/fields "positionX" and "positionY" is valid (has been set before). 0 otherwise. + NvU32 bSetName : 1; //!< [in] Set call: 1 in case the information in variable/field "name" should be stored as metadata. 0 otherwise. + NvU32 bRemoveName : 1; //!< [in] Set call: 1 in case the stored name metadata should be set to 'not defined',N/A. 0 otherwise. + NvU32 bNameIsAvailable : 1; //!< [out] Query call: 1 in case the information in variable/field "name" is valid (has been set before). 0 otherwise. + NvU32 reserved : 26; //!< [in][out] Reserved for future use without adding versioning. + NvS32 positionX; //!< [in][out] Metadata for the virtual horizontal position for the display connector specified by displayId. + NvS32 positionY; //!< [in][out] Metadata for the virtual vertical position for the display connector specified by displayId. + NvAPI_ShortString name; //!< [in][out] Metadata for the virtual name of for the display connector specified by displayId. + //!< Valid characters are in the range of 32 ' ' (space) to 126 '~' (both included). +} NV_MANAGED_DEDICATED_DISPLAY_METADATA_V1; + +#define NV_MANAGED_DEDICATED_DISPLAY_METADATA_VER1 MAKE_NVAPI_VERSION(NV_MANAGED_DEDICATED_DISPLAY_METADATA_V1,1) +#define NV_MANAGED_DEDICATED_DISPLAY_METADATA_VER NV_MANAGED_DEDICATED_DISPLAY_METADATA_VER1 + +typedef NV_MANAGED_DEDICATED_DISPLAY_METADATA_V1 NV_MANAGED_DEDICATED_DISPLAY_METADATA; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetNvManagedDedicatedDisplayMetadata +// +//! DESCRIPTION: This API returns metadata which has been set for the display connector in question. +//! Main use case would be to query the data for an Nvidia managed dedicated display. +//! The function will work for any valid displayId though. +//! +//! \since Release: 550 +//! +//! \param [in/out] pDedicatedDisplayMetadata Data structure containing input and output data. +//! +//! \retval ::NVAPI_OK The call succeeded. +//! \retval ::NVAPI_ERROR The call failed. +//! \retval ::NVAPI_NO_IMPLEMENTATION The API is not implemented in current driver. +//! \retval ::NVAPI_NOT_SUPPORTED The API is not supported on the current operating system or gpu. +//! \retval ::NVAPI_OUT_OF_MEMORY There wasn't sufficient memory to complete the call. +//! \retval ::NVAPI_INVALID_POINTER An invalid pointer was passed as an argument. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI was not initialized. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the NV_MANAGED_DEDICATED_DISPLAY_METADATA structure is invalid. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetNvManagedDedicatedDisplayMetadata(__inout NV_MANAGED_DEDICATED_DISPLAY_METADATA* pDedicatedDisplayMetadata); +#endif // defined(__cplusplus) + +//! SUPPORTED OS: Windows 11 and higher +//! +#if defined(__cplusplus) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_SetNvManagedDedicatedDisplayMetadata +// +//! DESCRIPTION: This API allows to set metadata for the display connector in question. +//! Main use case would be to set the data for an Nvidia managed dedicated display. +//! The function will work for any valid displayId though. +//! +//! \since Release: 550 +//! +//! \param [in/out] pDedicatedDisplayMetadata Data structure containing input and output data. +//! +//! \retval ::NVAPI_OK The call succeeded. +//! \retval ::NVAPI_ERROR The call failed. +//! \retval ::NVAPI_NO_IMPLEMENTATION The API is not implemented in current driver. +//! \retval ::NVAPI_NOT_SUPPORTED The API is not supported on the current operating system or gpu. +//! \retval ::NVAPI_OUT_OF_MEMORY There wasn't sufficient memory to complete the call. +//! \retval ::NVAPI_INVALID_POINTER An invalid pointer was passed as an argument. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI was not initialized. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the NV_MANAGED_DEDICATED_DISPLAY_METADATA structure is invalid. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE The caller doesn't have the required administrator privileges to access this API. +//! \retval ::NVAPI_INVALID_ARGUMENT Characters in pDedicatedDisplayMetadata->name are out of the allowed range. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_SetNvManagedDedicatedDisplayMetadata(__inout NV_MANAGED_DEDICATED_DISPLAY_METADATA* pDedicatedDisplayMetadata); +#endif // defined(__cplusplus) + #if defined (_WINNT_) @@ -9885,6 +10413,8 @@ NVAPI_INTERFACE NvAPI_GSync_GetTopology(__in NvGSyncDeviceHandle hNvGSyncDevice, //! \retval ::NVAPI_INVALID_SYNC_TOPOLOGY 1.If any mosaic grid is partial. //! 2.If timing(HVisible/VVisible/refreshRate) applied of any display is different. //! 3.If There is a across GPU mosaic grid in system and that is not a part of pGsyncDisplays. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE The application will require Administrator privileges to access this API. +//! The application can be elevated to a higher permission level by selecting "Run as Administrator". //! //! \ingroup gsyncapi /////////////////////////////////////////////////////////////////////////////// @@ -10022,7 +10552,8 @@ NVAPI_INTERFACE NvAPI_GSync_GetControlParameters(__in NvGSyncDeviceHandle hNvGSy //! If there are return error codes with specific meaning for this API, they are listed below. //! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL. //! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. -//! \retval ::NVAPI_SYNC_MASTER_NOT_FOUND Control Parameters can only be set if there is a Sync Master enabled on the Gsync card. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE The application will require Administrator privileges to access this API. +//! The application can be elevated to a higher permission level by selecting "Run as Administrator". //! //! \ingroup gsyncapi /////////////////////////////////////////////////////////////////////////////// @@ -15681,6 +16212,35 @@ NVAPI_INTERFACE NvAPI_D3D_ImplicitSLIControl(__in IMPLICIT_SLI_CONTROL implicitS #endif //defined (__cplusplus) && ( defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d10_1_h__) ||defined(__d3d11_h__) ) + +#if defined (__cplusplus) && defined(__d3d12_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_GetNeedsAppFPBlendClamping +// +//! \code +//! DESCRIPTION: This function returns whether the application needs to do FP blend clamping itself +//! +//! \param [in] pDevice Current d3d device +//! \param [out] pAppClampNeeded If true, app needs to clamp. If false, HW does the clamping +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \since Release: 375 +//! +//! SUPPORTED OS: Windows 10 +//! +//! \endcode +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// + +NVAPI_INTERFACE NvAPI_D3D12_GetNeedsAppFPBlendClamping(__in ID3D12Device *pDevice, + __out bool *pAppClampNeeded); + +#endif //defined(__cplusplus) && defined(__d3d12_h__) + //! SUPPORTED OS: Windows 10 //! @@ -17074,7 +17634,8 @@ typedef NV_GET_SLEEP_STATUS_PARAMS_V1 NV_GET_SLEEP_STATUS_PARAMS; //! Note that it may not always reflect the previously requested sleep mode, //! as the feature may not be available on the platform, or the setting has //! been overridden by the control panel, for example. -//! bFsVrr indicates fullscreen GSYNC or GSYNC Compatible mode. +//! bFsVrr indicates fullscreen GSYNC or GSYNC Compatible mode. It is valid +//! only when the application is in the foreground. //! bCplVsyncOn indicates Control Panel VSYNC ON override. //! //! \since Release: 455 @@ -17412,6 +17973,26 @@ NVAPI_INTERFACE NvAPI_D3D12_NotifyOutOfBandCommandQueue(__in ID3D12CommandQueue #endif //defined(__cplusplus) && defined(__d3d12_h__)) +#if defined(__cplusplus) && defined(__d3d12_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_SetCreateCommandQueueLowLatencyHint +// +//! DESCRIPTION: Reserved call. +//! +//! \since Release: 530 +//! \param [in] pDevice The creating device +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_SetCreateCommandQueueLowLatencyHint(__in ID3D12Device *pDevice); +#endif //defined(__cplusplus) && defined(__d3d12_h__)) + #if defined (__cplusplus) && defined(__d3d12_h__) // Experimental API for internal use. DO NOT USE! @@ -17537,6 +18118,28 @@ NVAPI_INTERFACE NvAPI_D3D12_LaunchCuKernelChain(__in ID3D12GraphicsCommandList* __in const NVAPI_CU_KERNEL_LAUNCH_PARAMS* pKernels, __in NvU32 numKernels); +// Experimental API for internal use. DO NOT USE! +//! SUPPORTED OS: Windows 10 and higher +//! + +typedef struct _NVAPI_CU_KERNEL_LAUNCH_PARAMS_EX +{ + NVDX_ObjectHandle hFunction; + NVAPI_DIM3 gridDim; + NVAPI_DIM3 blockDim; + NvU32 dynSharedMemBytes; + + // either pParams/paramsSize is used or kernelParams is used + void const * pParams; + NvU32 paramSize; + void **kernelParams; +} NVAPI_CU_KERNEL_LAUNCH_PARAMS_EX; + +NVAPI_INTERFACE NvAPI_D3D12_LaunchCuKernelChainEx(__in ID3D12GraphicsCommandList* pCommandList, + __in const NVAPI_CU_KERNEL_LAUNCH_PARAMS_EX* pKernels, + __in NvU32 numKernels); + + // Experimental API for internal use. DO NOT USE! //! SUPPORTED OS: Windows 10 and higher //! @@ -17682,6 +18285,17 @@ typedef enum _NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAP_STANDARD = NV_BIT(0) //!< Standard Opacity Micromap support is available } NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS; +//! Flags specifying raytracing Displacement Micromap support. +//! Additional flags will be added as support becomes available. +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAPS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAP_NONE = 0x0, //!< Displacement Micromap support is not available. + //!< The application must not attempt to use any DMM entrypoints or flags. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAP_STANDARD = NV_BIT(0) //!< Standard Displacement Micromap support is available +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAPS; + //! List of Raytracing CAPS types that can be queried. //! //! \ingroup dx @@ -17689,6 +18303,7 @@ typedef enum _NVAPI_D3D12_RAYTRACING_CAPS_TYPE { NVAPI_D3D12_RAYTRACING_CAPS_TYPE_THREAD_REORDERING = 0, NVAPI_D3D12_RAYTRACING_CAPS_TYPE_OPACITY_MICROMAP = 1, + NVAPI_D3D12_RAYTRACING_CAPS_TYPE_DISPLACEMENT_MICROMAP = 2, NVAPI_D3D12_RAYTRACING_CAPS_TYPE_INVALID = -1 } NVAPI_D3D12_RAYTRACING_CAPS_TYPE; @@ -17724,6 +18339,283 @@ NVAPI_INTERFACE NvAPI_D3D12_GetRaytracingCaps( __in size_t dataSize); #endif // defined(__cplusplus) && defined(__d3d12_h__) +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! Flags specifying validation behaviour for raytracing operations. +//! \ingroup dx +//! See NvAPI_D3D12_EnableRaytracingValidation +typedef enum _NVAPI_D3D12_RAYTRACING_VALIDATION_FLAGS +{ + NVAPI_D3D12_RAYTRACING_VALIDATION_FLAG_NONE = 0x0, //!< No validation flags. +} NVAPI_D3D12_RAYTRACING_VALIDATION_FLAGS; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_EnableRaytracingValidation +// +//! DESCRIPTION: Enable raytracing validation for a device. +//! This function must be called before any other raytracing-related function +//! is invoked on the device. Raytracing validation can only be enabled when +//! the NV_ALLOW_RAYTRACING_VALIDATION envvar is set to 1. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device on which raytracing validation should be enabled. +//! \param [in] flags Raytracing validation flags. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as device argument +//! \retval ::NVAPI_INVALID_ARGUMENT An unsupported flag was specified +//! \retval ::NVAPI_INVALID_CALL The call was made too late (other raytracing-related calls have already been made) +//! \retval ::NVAPI_ACCESS_DENIED Validation is not allowed by envvar +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_EnableRaytracingValidation( + __in ID3D12Device5* pDevice, + __in NVAPI_D3D12_RAYTRACING_VALIDATION_FLAGS flags); + + + +//! Severity classification of validation messages. +//! \ingroup dx +//! See NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_CALLBACK +typedef enum _NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY +{ + NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY_ERROR = 0x0, //!< Error message (indicates likely bug) + NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY_WARNING = 0x1 //!< Warning message (indicates inadvisable usage or possible bug) +} NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY; + +//! Callback for raytracing validation messages. +//! \param [in] pUserData User data pointer as provided to callback registration. +//! \param [in] severity Severity of message. +//! \param [in] messageCode Type of reported validation message. +//! \param [in] message Human-readable description of what the message code means. +//! \param [in] messageDetails Additional human-readable context for validation message. May contain newlines. +//! \ingroup dx +//! See NvAPI_D3D12_RegisterRaytracingValidationMessageCallback +typedef void(__stdcall *NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_CALLBACK)(void* pUserData, NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY severity, const char* messageCode, const char* message, const char* messageDetails); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_RegisterRaytracingValidationMessageCallback +// +//! DESCRIPTION: Register a message callback for raytracing validation messages. +//! The provided callback may be invoked by the driver using any thread at any time until the callback is unregistered. +//! It is invalid to register/unregister callbacks from within the callback. +//! It is invalid to create or destroy objects for the device or record commands onto command lists from within the callback. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device from which to obtain raytracing validation messages. +//! \param [in] pfnMessageCallback Callback used to report validation messages. +//! \param [in] pUserData [optional] User data to pass as argument to message callback. +//! \param [out] pHandle Handle that may be used to unregister the callback. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as an argument +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_RegisterRaytracingValidationMessageCallback( + __in ID3D12Device5* pDevice, + __in NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_CALLBACK pfnMessageCallback, + __in_opt void* pUserData, + __out void** pHandle); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_UnregisterRaytracingValidationMessageCallback +// +//! DESCRIPTION: Unregister a previously registered message callback for raytracing validation messages. +//! The provided callback will not be invoked once the unregister call has returned. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device from which to stop obtaining raytracing validation messages. +//! \param [in] handle Handle to which callback should be unregistered, obtained at registration. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as device argument +//! \retval ::NVAPI_INVALID_ARGUMENT Callback handle not recognized +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_UnregisterRaytracingValidationMessageCallback( + __in ID3D12Device5* pDevice, + __in void* handle); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_FlushRaytracingValidationMessages +// +//! DESCRIPTION: Flush any validation messages that have not yet been reported. +//! This guarantees that any validation messages for work which is known to be complete on the GPU +//! at the time of the call are reported to registered callbacks. +//! This operation is lightweight if the flushed device does not have raytracing validation enabled. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device on which raytracing validation messages should be flushed. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as device argument +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_FlushRaytracingValidationMessages( + __in ID3D12Device5* pDevice); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! SUPPORTED OS: Windows 10 and higher +//! +#if defined(__cplusplus) && defined(__d3d12_h__) && (defined(__ID3D12Device5_INTERFACE_DEFINED__) || defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__)) + +// Types used by both device and command list functions. + +//! Flags specifying building instructions and hints when constructing a DMM Array. +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAGS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_NONE = 0x0, //!< No options specified for the DMM Array build. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_TRACE = NV_BIT(0), //!< Allow the DMM Array build to take a little longer in order to optimize for traversal performance. + //!< This flag is incompatible with #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_BUILD. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_BUILD = NV_BIT(1) //!< Spend as little time as possible on the DMM Array build with some potential loss to traversal performance. + //!< This flag is incompatible with #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_TRACE. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAGS; + +//! Specifies the input Displacement Micromap formats. +//! The DC1 (Displacement Compression 1) format follows the space-filling curve in barycentric space over the uniformly tessellated micro-triangles. +//! +//! \note This is a 16-bit value when used in #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT_DC1_64_TRIS_64_BYTES = 0x1, //!< 64 micro-triangles packed into 64 bytes + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT_DC1_256_TRIS_128_BYTES = 0x2, //!< 256 micro-triangles packed into 128 bytes + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT_DC1_1024_TRIS_128_BYTES = 0x3, //!< 1024 micro-triangles packed into 128 bytes + +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT; + +//! Number of DMMs of a specific configuration in a DMM Array or BLAS build. +//! Used to compute conservative buffer size estimates for DMM Array and BLAS builds. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT +{ + NvU32 count; //!< For DMM Array builds: total number of DMMs in the DMM Array with the particular \p subdivisionLevel and \p format specified in this descriptor. + //!< For BLAS builds: total number of DMMs with the \p subdivisionLevel and \p format combination that is referenced from the BLAS. + NvU32 subdivisionLevel; //!< Number of subdivisions for the DMM; valid inputs are [0, 5] (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DC1_MAX_SUBDIVISION_LEVEL). + //!< The total number of micro-triangles is 4subdivisionLevel. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT format; //!< Displacement Micromap format. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT; + +//! Describes one Displacement Micromap. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC +{ + NvU32 byteOffset; //!< Byte offset from the \c inputBuffer, specified in the input structure #NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS, to where the input DMM data is located. + NvU16 subdivisionLevel; //!< Number of subdivisions for the DMM; valid inputs are [0, 5] (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DC1_MAX_SUBDIVISION_LEVEL). + //!< The total number of micro-triangles is 4subdivisionLevel. + NvU16 format; //!< Format of the DMM of type #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC; + +//! Input structure to DMM Array construction. +//! Individual DMMs are accessed via indices when used in bottom-level acceleration structure (BLAS) construction. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAGS flags; //!< Flags which apply to all DMMs in the array. + NvU32 numDMMUsageCounts; //!< Number of DMM usage count entries in the \p pDMMUsageCounts array. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT* pDMMUsageCounts; //!< Usage counts for each subdivision level and format combination across all the DMM entries in the build. + D3D12_GPU_VIRTUAL_ADDRESS inputBuffer; //!< Address for raw DMM input data; it must be 256-byte aligned (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT) + //!< It is recommended to try to organize DMMs together in memory that are expected to be used close together spatially. + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE perDMMDescs; //!< GPU array with one #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC entry per DMM. +} NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS; + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && (defined(__ID3D12Device5_INTERFACE_DEFINED__) || defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__)) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) + +//! Conservative memory requirements for building a DMM Array. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO +{ + NvU64 resultDataMaxSizeInBytes; //!< Size required to hold the result of a DMM Array build based on the specified inputs. + NvU64 scratchDataSizeInBytes; //!< Scratch storage on GPU required during DMM Array build based on the specified inputs. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO; + +//! Parameters given to NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo(). +//! +//! \ingroup dx +typedef struct _NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER. + const NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS* pDesc; //!< [in] Description of the DMM Array build. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO* pInfo; //!< [out] Result of the query. +} NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1; +#define NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1, 1) +typedef NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1 NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS; +#define NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo +// +//! DESCRIPTION: Query conservative memory requirements for building a DMM (Displacement Micromap) Array. +//! The returned size is conservative for DMM Array builds containing +//! a lower or equal number of entries for each resolution and format combination. +//! +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pDevice Device on which the DMM Array will be built. +//! \param [in,out] pParams Wrapper around the inputs and outputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo( + __in ID3D12Device5* pDevice, + __inout NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) + //! SUPPORTED OS: Windows 10 and higher //! #if defined(__cplusplus) && defined(__d3d12_h__) && (defined(__ID3D12Device5_INTERFACE_DEFINED__) || defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__)) @@ -17856,6 +18748,9 @@ typedef enum _NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS_ENABLE_OMM_SUPPORT = NV_BIT(0), //!< [in] Change whether raytracing pipelines are created with support for Opacity Micromaps. //!< If a triangle with an OMM is encountered during traversal and the pipeline was not created with support for them, behavior is undefined. //!< Support should only be enabled if there are OMMs present, since it may incur a small penalty on traversal performance overall. + NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS_ENABLE_DMM_SUPPORT = NV_BIT(1), //!< [in] Change whether raytracing pipelines are created with support for Displacement Micromaps. + //!< If a triangle with a DMM is encountered during traversal and the pipeline was not created with support for them, behavior is undefined. + //!< Support should only be enabled if there are DMMs present, since it may incur a small penalty on traversal performance overall. } NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS; //! State used when creating new pipelines. @@ -17914,6 +18809,8 @@ typedef enum _NVAPI_D3D12_SERIALIZED_DATA_TYPE_EX // NVAPI_D3D12_SERIALIZED_DATA_TYPE_EX specific flags NVAPI_D3D12_SERIALIZED_DATA_RAYTRACING_OPACITY_MICROMAP_ARRAY_EX = 0x1, //!< Data blob contains an OMM Array. //!< Starting from offset 0, the first bytes of the OMM Array can be reinterpreted as \c D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER. + NVAPI_D3D12_SERIALIZED_DATA_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_EX = 0x2, //!< Data blob contains a DMM Array. + //!< Starting from offset 0, the first bytes of the DMM Array can be reinterpreted as \c D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER. } NVAPI_D3D12_SERIALIZED_DATA_TYPE_EX; @@ -17982,6 +18879,7 @@ typedef enum _NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS_EX //!< Specifying this build flag may result in some reductions in traversal performance. NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_OMM_OPACITY_STATES_UPDATE_EX = NV_BIT(8), //!< The acceleration structure (AS) supports updating OMM data (encoded opacity values). //!< Specifying this flag may reduce traversal performance. + NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_DATA_ACCESS_EX = NV_BIT(9), //!< Allows triangle and micro-triangle data to be accessed through the BLAS via shader intrinsics. } NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS_EX; @@ -17998,7 +18896,8 @@ typedef enum _NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_EX // NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_EX specific flags NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_OMM_TRIANGLES_EX = 0x2, //!< Shares most fields with the basic triangle geometry type, but allows an OMM Array to be attached to the geometry. //!< The basic triangle type and this OMM-enabled type geometries may be mixed in the same BLAS build. - + NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_DMM_TRIANGLES_EX = 0x3, //!< Triangle geometry with attached DMM data. + //!< This geometry cannot be mixed with other geometry types in the same BLAS. } NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_EX; @@ -18032,6 +18931,53 @@ typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_OMM_ATTACHMENT_DESC } NVAPI_D3D12_RAYTRACING_GEOMETRY_OMM_ATTACHMENT_DESC; +//! The edge vA..vB is decimated: after subdivision the number of micro-triangles on that edge is halved. +//! (i.e. the neighboring primitive can have a lower subdivision level without introducing cracks) +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAGS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAG_DECIMATE_01 = NV_BIT(0), + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAG_DECIMATE_12 = NV_BIT(1), + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAG_DECIMATE_20 = NV_BIT(2), + +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAGS; + +//! Geometry descriptor attachment with Displacement Micromaps. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_ATTACHMENT_DESC +{ + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE triangleMicromapIndexBuffer; //!< Optional buffer specifying which DMM index to use for each triangle; if \c NULL, there is a 1:1 mapping between input triangles and DMM Array entries. + //!< For BLAS updates, this input buffer must match that of the original build. + DXGI_FORMAT triangleMicromapIndexFormat; //!< Format of \c displacementMicromapIndexBuffer, either \c DXGI_FORMAT_R32_UINT or \c DXGI_FORMAT_R16_UINT. + NvU32 triangleMicromapBaseLocation; //!< Constant added to all DMM indices in \p displacementMicromapIndexBuffer. + + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE trianglePrimitiveFlagsBuffer; //!< Optional, per-triangle UINT8 mode flags (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAGS) + + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE vertexBiasAndScaleBuffer; //!< Optional displacement base vertex bias and displacement vector scale buffer. If not supplied, bias defaults to 0 and scale to 1. + DXGI_FORMAT vertexBiasAndScaleFormat; //!< Format of \c displacementBiasAndScaleBuffer. Supported formats are \c DXGI_FORMAT_R16G16_FLOAT and \c DXGI_FORMAT_R32G32_FLOAT + + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE vertexDisplacementVectorBuffer; //!< Per-vertex displacement vector buffer. This buffer is indexed using the index buffer from the base triangle geometry. + DXGI_FORMAT vertexDisplacementVectorFormat; //!< Format of \c displacementVectorBuffer. Supported formats are \c DXGI_FORMAT_R32G32B32_FLOAT, \c DXGI_FORMAT_R32G32B32A32_FLOAT, and \c DXGI_FORMAT_R16G16B16A16_FLOAT (The Alpha channel is ignored, and stride can be set accordingly). + + D3D12_GPU_VIRTUAL_ADDRESS displacementMicromapArray; //!< Pointer to a DMM Array used by this geometry. + //!< Unlike vertex, index, and transform buffers, this resource is dereferenced during raytracing. + + NvU32 numDMMUsageCounts; //!< Number of DMM usage count entries in the \p pDMMUsageCounts array. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT* pDMMUsageCounts; //!< Usage counts for each subdivision level and format combination across all the DMM entries referred-to by the DMM index buffer specified by this geometry. + +} NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_ATTACHMENT_DESC; + +//! Geometry triangle descriptor with attached augmented Displacement Micromaps. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_TRIANGLES_DESC +{ + D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC triangles; //!< Triangle mesh descriptor. + NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_ATTACHMENT_DESC dmmAttachment; //!< Displacement Micromap attachment descriptor. +} NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_TRIANGLES_DESC; + //! Geometry triangle descriptor with attached augmented Opacity Micromaps. //! //! \ingroup dx @@ -18057,6 +19003,8 @@ typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_DESC_EX //!< Otherwise, this parameter is unused (space repurposed in a union). NVAPI_D3D12_RAYTRACING_GEOMETRY_OMM_TRIANGLES_DESC ommTriangles; //!< Describes triangle geometry which may optionally use Opacity Micromaps, if \c type is #NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_OMM_TRIANGLES_EX. //!< Otherwise, this parameter is unused (space repurposed in a union). + NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_TRIANGLES_DESC dmmTriangles; //!< Describes micro-triangle geometry, if \c type is #NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_DMM_TRIANGLES_EX. + //!< Otherwise, this parameter is unused (space repurposed in a union). }; } NVAPI_D3D12_RAYTRACING_GEOMETRY_DESC_EX; @@ -18284,6 +19232,182 @@ NVAPI_INTERFACE NvAPI_D3D12_RelocateRaytracingOpacityMicromapArray( #if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) +//! Description of the inputs and memory areas used during the building of DMM Arrays. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_DESC +{ + D3D12_GPU_VIRTUAL_ADDRESS destDisplacementMicromapArrayData; //!< Output location for the DMM Array build. + //!< NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo() reports the amount of memory required for the result given a set of input parameters. + //!< The address must be aligned to 256 bytes (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT). + NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS inputs; //!< Description of the input data for the DMM Array build. + D3D12_GPU_VIRTUAL_ADDRESS scratchDisplacementMicromapArrayData; //!< Location where the build will store temporary data. + //!< NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo() reports the amount of scratch memory the implementation will need for a given set of input parameters. + //!< The address must be aligned to 256 bytes (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT). + //!< Contents of this memory going into a build on the GPU timeline are irrelevant and will not be preserved. + //!< After the build is complete on the GPU timeline, the memory is left with whatever undefined contents the build finished with. + //!< The memory pointed to must be in state \c D3D12_RESOURCE_STATE_UNORDERED_ACCESS. +} NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_DESC; + +//! Structure emitted by NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo(), and optionally NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray(), when \c type equals #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE_DESC +{ + NvU64 currentSizeInBytes; //!< Size of the DMM Array buffer. + //!< The queried size may be smaller than the size reported by NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo(). + //!< This allows the application to move and relocate the DMM Array to a smaller buffer to reclaim any unused memory after the DMM Array build is complete. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE_DESC; + +//! Type of postbuild info to emit after a DMM Array build. +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_TYPE +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE = 0x0, //!< Size of the current DMM Array. May be smaller than reported by the NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo() call. + //!< Unused memory can be reclaimed by copying the DMM Array into a new resource; see #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE_DESC. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_TYPE; + +//! Description of the postbuild information to generate from a DMM Array. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC +{ + D3D12_GPU_VIRTUAL_ADDRESS destBuffer; //!< Result storage. + //!< Size required and the layout of the contents written by the system depend on \p infoType. + //!< The memory pointed to must be in state \c D3D12_RESOURCE_STATE_UNORDERED_ACCESS. + //!< The memory must be aligned to the natural alignment for the members of the particular output structure being generated (e.g. 8 bytes for a struct with the largest member being \c NvU64). + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_TYPE infoType; //!< Type of postbuild information to retrieve. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC; + +//! Parameters given to NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray(). +//! +//! \ingroup dx +typedef struct _NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER. + const NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_DESC* pDesc; //!< [in] Description of the DMM Array build. + NvU32 numPostbuildInfoDescs; //!< [in] Size of postbuild info desc array. Set to 0 if none are needed. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC* pPostbuildInfoDescs; //!< [in] Optional array of descriptions for postbuild info to generate describing properties of the acceleration structure that was built. + //!< [in] Any given postbuild info type, \c D3D12_RAYTRACING_ACCEELRATION_STRUCTURE_POSTBUILD_INFO_TYPE, can only be selected for output by at most one array entry. +} NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1; +#define NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1, 1) +typedef NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS; +#define NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray +// +//! DESCRIPTION: Construct DMM Array for a collection of DMMs on the GPU. +//! The CPU-side input buffers are not referenced after this call. +//! The GPU-side input resources are not referenced after the build has concluded after ExecuteCommandList(). +//! Additionally, the application may optionally output postbuild information immediately after the build. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pCommandList Command list on which the command will execute. +//! \param [in] pParams Wrapper around the inputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_INVALID_COMBINATION pParams->pPostbuildInfoDescs was set to \c NULL while pParams->numPostbuildInfoDescs is non zero. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray( + __in ID3D12GraphicsCommandList4* pCommandList, + __in NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! Parameters given to NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray(). +//! +//! \ingroup dx +typedef struct _NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER. + D3D12_GPU_VIRTUAL_ADDRESS displacementMicromapArray; //!< [in] DMM Array current memory address; it must be 256-byte aligned (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT). +} NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1; +#define NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1, 1) +typedef NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS; +#define NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray +// +//! DESCRIPTION: Makes the DMM Array usable at its current location in memory. +//! A DMM Array that has been copied to a new location must be relocated using this function before it may be attached to any BLAS. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pCommandList Command list on which the command will execute. +//! \param [in] pParams Wrapper around the inputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray( + __in ID3D12GraphicsCommandList4* pCommandList, + __in const NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! Parameters given to NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo(). +//! +//! \ingroup dx +typedef struct _NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC* pDesc; //!< [in] Description of which postbuild info to emit. + NvU32 numSources; //!< [in] Number of DMM Arrays in \p pSources. + const D3D12_GPU_VIRTUAL_ADDRESS* pSources; //!< [in] List of DMM Arrays for which postbuild info should be emitted. +} NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1; +#define NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1, 1) +typedef NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1 NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS; +#define NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo +// +//! DESCRIPTION: Emits information about one or more DMM Arrays, only available after the DMM Array constructions have finished. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pCommandList Command list on which the command will execute. +//! \param [in] pParams Wrapper around the inputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo( + __in ID3D12GraphicsCommandList4* pCommandList, + __in const NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + //! Parameters given to NvAPI_D3D12_EmitRaytracingOpacityMicromapArrayPostbuildInfo(). //! //! \ingroup dx @@ -18443,6 +19567,16 @@ typedef enum _NVAPI_RAY_FLAGS_EX //!< If an instance is flagged with #NVAPI_D3D12_RAYTRACING_INSTANCE_FLAG_DISABLE_OMMS_EX, that takes precedence over this flag. } NVAPI_RAY_FLAG_EX; +//! Mandatory alignment for the address of a DMM Array. +//! +//! \ingroup dx +#define NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT 256 + +//! Highest subdivision-level allowed with DC1. +//! +//! \ingroup dx +#define NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DC1_MAX_SUBDIVISION_LEVEL 5 + #endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) @@ -18544,6 +19678,7 @@ NVAPI_INTERFACE NvAPI_D3D12_CreateCommittedRDMABuffer( __out void **ppRDMAAddress); #endif //defined(__cplusplus) && defined(__d3d12_h__) + //! SUPPORTED OS: Windows 10 and higher //! #if defined(__cplusplus) && defined(__d3d12_h__) diff --git a/vendor/nvapi/nvapi_lite_common.h b/vendor/nvapi/nvapi_lite_common.h index 21263566c1..c922ffb512 100644 --- a/vendor/nvapi/nvapi_lite_common.h +++ b/vendor/nvapi/nvapi_lite_common.h @@ -70,7 +70,7 @@ typedef signed long NvS32; /* -2147483648 to 2147483647 */ typedef signed int NvS32; /* -2147483648 to 2147483647 */ #endif -#ifndef __unix +#if !(NVOS_IS_UNIX || (defined(__unix))) // mac os 32-bit still needs this #if ( (defined(macintosh) && defined(__LP64__) && (__NVAPI_RESERVED0__)) || \ (!defined(macintosh) && defined(__NVAPI_RESERVED0__)) ) @@ -409,6 +409,7 @@ typedef enum _NvAPI_Status NVAPI_NOT_PERMITTED = -240, //!< Attempted operation is not permitted. NVAPI_CALLBACK_ALREADY_REGISTERED = -241, //!< The callback function has already been registered. NVAPI_CALLBACK_NOT_FOUND = -242, //!< The callback function is not found or not registered. + NVAPI_INVALID_OUTPUT_WIRE_FORMAT = -243, //!< Invalid Wire Format for the VR HMD } NvAPI_Status; /////////////////////////////////////////////////////////////////////////////// @@ -527,10 +528,14 @@ NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DIS typedef struct { NvU32 version; //!< Structure version - NvU64 dedicatedVideoMemory; //!< Size(in bytes) of the physical framebuffer. + NvU64 dedicatedVideoMemory; //!< Size(in bytes) of the physical framebuffer. Refers to the dedicated video memory on discrete GPUs. + //! It is more performant for GPU operations than the reserved systemVideoMemory. NvU64 availableDedicatedVideoMemory; //!< Size(in bytes) of the available physical framebuffer for allocating video memory surfaces. - NvU64 systemVideoMemory; //!< Size(in bytes) of system memory the driver allocates at load time. + NvU64 systemVideoMemory; //!< Size(in bytes) of system memory the driver allocates at load time. It is a substitute for dedicated video memory. + //!< Typically used with integrated GPUs that do not have dedicated video memory. NvU64 sharedSystemMemory; //!< Size(in bytes) of shared system memory that driver is allowed to commit for surfaces across all allocations. + //!< On discrete GPUs, it is used to utilize system memory for various operations. It does not need to be reserved during boot. + //!< It may be used by both GPU and CPU, and has an “on-demand” type of usage. NvU64 curAvailableDedicatedVideoMemory; //!< Size(in bytes) of the current available physical framebuffer for allocating video memory surfaces. NvU64 dedicatedVideoMemoryEvictionsSize; //!< Size(in bytes) of the total size of memory released as a result of the evictions. NvU64 dedicatedVideoMemoryEvictionCount; //!< Indicates the number of eviction events that caused an allocation to be removed from dedicated video memory to free GPU diff --git a/vendor/nvapi/nvapi_lite_surround.h b/vendor/nvapi/nvapi_lite_surround.h index e680dd2e77..43b7000886 100644 --- a/vendor/nvapi/nvapi_lite_surround.h +++ b/vendor/nvapi/nvapi_lite_surround.h @@ -60,8 +60,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////// NVAPI_INTERFACE NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId); #define NV_MOSAIC_MAX_DISPLAYS (64) -//! SUPPORTED OS: Windows 7 and higher -//! /////////////////////////////////////////////////////////////////////////////// // // FUNCTION NAME: NvAPI_Mosaic_GetDisplayViewportsByResolution @@ -77,10 +75,10 @@ NVAPI_INTERFACE NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId); //! \param [in] srcHeight Height of full display topology. If both //! width and height are 0, the current //! resolution is used. -//! \param [out] viewports Array of NV_RECT viewports which represent -//! the displays as identified in -//! NvAPI_Mosaic_EnumGridTopologies. If the -//! requested resolution is a single-wide +//! \param [out] viewports Array of NV_RECT viewports. +//! SUPPORTED OS: Windows 7 and higher +//! +//! If the requested resolution is a single-wide //! resolution, only viewports[0] will //! contain the viewport details, regardless //! of which display is driving the display. diff --git a/vendor/nvapi/x86/nvapi.lib b/vendor/nvapi/x86/nvapi.lib index 6bb2307a02..7e80aa8814 100644 Binary files a/vendor/nvapi/x86/nvapi.lib and b/vendor/nvapi/x86/nvapi.lib differ