diff --git a/NVIDIA/NVIDIA.cpp b/NVIDIA/NVIDIA.cpp index df86178..0c48200 100644 --- a/NVIDIA/NVIDIA.cpp +++ b/NVIDIA/NVIDIA.cpp @@ -8,7 +8,7 @@ __declspec(dllexport) void SetNVLLConfigure(ReflexMode, uint32_t); __declspec(dllexport) void GetNVLLFrame(); __declspec(dllexport) void WaitNVLL(); - __declspec(dllexport) void SetNVLLFlag(ReflexMarker); + __declspec(dllexport) void SetNVLLFlag(PCLMarker); __declspec(dllexport) void NotifyNVLL(uint32_t); __declspec(dllexport) bool IsNVLLAvailable(); } @@ -24,9 +24,9 @@ void InitNVLL(void* d3dDevice) { Preferences pref = {}; - pref.featuresToLoad = new Feature[1]{ kFeatureReflex }; + pref.featuresToLoad = new Feature[2]{ kFeatureReflex, kFeaturePCL }; pref.numFeaturesToLoad = sizeof(*pref.featuresToLoad) / sizeof(Feature); - pref.engineVersion = "1.1.0"; + pref.engineVersion = "1.2.0"; pref.renderAPI = RenderAPI::eD3D11; if (SL_FAILED(r, slInit(pref))) { @@ -61,16 +61,16 @@ slGetNewFrameToken(frame, &frameIndex); } -void SetNVLLFlag(ReflexMarker marker) +void SetNVLLFlag(PCLMarker marker) { - slReflexSetMarker(marker, *frame); + slPCLSetMarker(marker, *frame); } void NotifyNVLL(uint32_t statsWindowMessage) { if (state.statsWindowMessage == statsWindowMessage) { - slReflexSetMarker(ReflexMarker::ePCLatencyPing, *frame); + slPCLSetMarker(PCLMarker::ePCLatencyPing, *frame); } } diff --git a/NVIDIA/NVIDIA.vcxproj b/NVIDIA/NVIDIA.vcxproj index 9f71a09..deb071b 100644 --- a/NVIDIA/NVIDIA.vcxproj +++ b/NVIDIA/NVIDIA.vcxproj @@ -157,6 +157,7 @@ + diff --git a/NVIDIA/NVIDIA.vcxproj.filters b/NVIDIA/NVIDIA.vcxproj.filters index 4033769..bf85f42 100644 --- a/NVIDIA/NVIDIA.vcxproj.filters +++ b/NVIDIA/NVIDIA.vcxproj.filters @@ -39,6 +39,9 @@ 헤더 파일 + + 헤더 파일 + diff --git a/NVIDIA/sl_pcl.h b/NVIDIA/sl_pcl.h new file mode 100644 index 0000000..e6cab73 --- /dev/null +++ b/NVIDIA/sl_pcl.h @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#pragma once + +#include + +namespace sl +{ + +//! Hot-key which should be used instead of custom message for PC latency marker +enum class PCLHotKey: int16_t +{ + eUsePingMessage = 0, + eVK_F13 = 0x7C, + eVK_F14 = 0x7D, + eVK_F15 = 0x7E, +}; + +// {cfa32f9b-023c-420e-9056-6832b74f89b4} +SL_STRUCT(PCLOptions, StructType({ 0xcfa32f9b, 0x023c, 0x420e, { 0x90, 0x56, 0x68, 0x32, 0xb7, 0x4f, 0x89, 0xb4 } }), kStructVersion1) + //! Specifies the hot-key which should be used instead of custom message for PC latency marker + //! Possible values: VK_F13, VK_F14, VK_F15 + PCLHotKey virtualKey = PCLHotKey::eUsePingMessage; + //! ThreadID for PCL messages + uint32_t idThread = 0; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +// {cfa32f9b-023c-420e-9056-6832b74f89b5} +SL_STRUCT(PCLState, StructType({ 0xcfa32f9b, 0x023c, 0x420e, { 0x90, 0x56, 0x68, 0x32, 0xb7, 0x4f, 0x89, 0xb5 } }), kStructVersion1) + //! Specifies PCL Windows message id (if PCLOptions::virtualKey is 0) + uint32_t statsWindowMessage; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +enum class PCLMarker: uint32_t +{ + eSimulationStart = 0, + eSimulationEnd = 1, + eRenderSubmitStart = 2, + eRenderSubmitEnd = 3, + ePresentStart = 4, + ePresentEnd = 5, + //eInputSample = 6, // Deprecated + eTriggerFlash = 7, + ePCLatencyPing = 8, + eOutOfBandRenderSubmitStart = 9, + eOutOfBandRenderSubmitEnd = 10, + eOutOfBandPresentStart = 11, + eOutOfBandPresentEnd = 12, + eControllerInputSample = 13, + eDeltaTCalculation = 14, + + eMaximum +}; + +// c++23 has to_underlying implementation +#if __cplusplus == 202302L +using to_underlying = std::to_underlying; +#else +// Return `enum class` member as value of underlying type (i.e. an int). Basically same as: +// static_cast>(value); +// See c++23s std::to_underlying() +template +constexpr auto to_underlying(T value) +{ + return std::underlying_type_t(value); +} +#endif + +// {cfa32f9b-023c-420e-9056-6832b74f89b6} +SL_STRUCT(PCLHelper, StructType({ 0xcfa32f9b, 0x023c, 0x420e, { 0x90, 0x56, 0x68, 0x32, 0xb7, 0x4f, 0x89, 0xb6 } }), kStructVersion1) + PCLHelper(PCLMarker m) : BaseStructure(PCLHelper::s_structType, kStructVersion1), marker(m) {}; + PCLMarker get() const { return marker; }; +private: + PCLMarker marker; +}; + + +} + +//! Provides PCL settings +//! +//! Call this method to get stats etc. +//! +//! @param state Reference to a structure where states are returned +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +using PFun_slPCLGetState = sl::Result(sl::PCLState& state); + +//! Sets PCL marker +//! +//! Call this method to set specific PCL marker +//! +//! @param marker Specifies which marker to use +//! @param frame Specifies current frame +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is thread safe. +using PFun_slPCLSetMarker = sl::Result(sl::PCLMarker marker, const sl::FrameToken& frame); + +//! Sets PCL options +//! +//! Call this method to set PCL options. +//! +//! @param options Specifies options to use +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +using PFun_slPCLSetOptions = sl::Result(const sl::PCLOptions& options); + +//! HELPERS +//! +inline sl::Result slPCLGetState(sl::PCLState& state) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeaturePCL, slPCLGetState); + return s_slPCLGetState(state); +} + +inline sl::Result slPCLSetMarker(sl::PCLMarker marker, const sl::FrameToken& frame) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeaturePCL, slPCLSetMarker); + return s_slPCLSetMarker(marker, frame); +} + +inline sl::Result slPCLSetOptions(const sl::PCLOptions& options) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeaturePCL, slPCLSetOptions); + return s_slPCLSetOptions(options); +} diff --git a/Qwilight/Assets/x64/sl.pcl.dll b/Qwilight/Assets/x64/sl.pcl.dll new file mode 100644 index 0000000..dd2d79f --- /dev/null +++ b/Qwilight/Assets/x64/sl.pcl.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdf56e4463051a8f4396fcdebf9ef3bdfc90962e7abf2573261b3a9a5d6e8b43 +size 167904 diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj index dfb842a..9e89612 100644 --- a/Qwilight/Qwilight.csproj +++ b/Qwilight/Qwilight.csproj @@ -277,6 +277,9 @@ Always + + Always + Always diff --git a/Qwilight/System/DrawingSystem/DrawingSystem.cs b/Qwilight/System/DrawingSystem/DrawingSystem.cs index ea94b65..b7e984e 100644 --- a/Qwilight/System/DrawingSystem/DrawingSystem.cs +++ b/Qwilight/System/DrawingSystem/DrawingSystem.cs @@ -130,6 +130,7 @@ Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "Microsoft.Graphics.Canvas.dll"), Path.Combine(AppContext.BaseDirectory, "Microsoft.Graphics.Canvas.dll")); Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.common.dll"), Path.Combine(AppContext.BaseDirectory, "sl.common.dll")); Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.interposer.dll"), Path.Combine(AppContext.BaseDirectory, "sl.interposer.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.pcl.dll"), Path.Combine(AppContext.BaseDirectory, "sl.pcl.dll")); Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.reflex.dll"), Path.Combine(AppContext.BaseDirectory, "sl.reflex.dll")); Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "NVIDIA.dll"), Path.Combine(AppContext.BaseDirectory, "NVIDIA.dll"));