-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nvofapi: NvOFAPICreateInstanceCuda - stub #253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments, lets strip some of the ceremony . For completeness, could add a very brief corresponding nvofapi_cuda.cpp
file like https://github.com/jp7677/dxvk-nvapi/blob/master/tests/nvofapi_vk.cpp
Not tested, but this is probably all that is needed (excluding comments why not having included the nvofapi_cuda header): Code
diff --git a/src/meson.build b/src/meson.build
index 2d35672..8e0b999 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -51,6 +51,7 @@ nvofapi_src = files([
'nvofapi.cpp',
'nvofapi_d3d12.cpp',
'nvofapi_vk.cpp',
+ 'nvofapi_cuda.cpp',
])
# Only build 64-bit versions of nvofapi
diff --git a/src/nvofapi_cuda.cpp b/src/nvofapi_cuda.cpp
new file mode 100644
index 0000000..eeaeae3
--- /dev/null
+++ b/src/nvofapi_cuda.cpp
@@ -0,0 +1,17 @@
+#include "nvofapi_private.h"
+#include "util/util_log.h"
+#include "util/util_statuscode.h"
+
+extern "C" {
+
+ using namespace dxvk;
+
+ NV_OF_STATUS __cdecl NvOFAPICreateInstanceCuda(uint32_t apiVer, void* functionList) {
+ constexpr auto n = __func__;
+
+ if (log::tracing())
+ log::trace(n, apiVer, log::fmt::ptr(functionList));
+
+ return OFNotAvailable(n);
+ }
+}
diff --git a/src/nvofapi_entrypoints.h b/src/nvofapi_entrypoints.h
index 17cbc7f..188f497 100644
--- a/src/nvofapi_entrypoints.h
+++ b/src/nvofapi_entrypoints.h
@@ -34,4 +34,7 @@ extern "C" {
NV_OF_STATUS NVOFAPI OFSessionGetLastError(NvOFHandle hOf, char lastError[], uint32_t* size);
NV_OF_STATUS NVOFAPI OFSessionGetCaps(NvOFHandle hOf, NV_OF_CAPS capsParam, uint32_t* capsVal, uint32_t* size);
+
+ // Overwrite CUDA entrypoint to avoid dependency to cuda.h
+ NV_OF_STATUS NVOFAPI NvOFAPICreateInstanceCuda(uint32_t apiVer, void* functionList);
}
diff --git a/tests/meson.build b/tests/meson.build
index e4ba6ce..429ac40 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -67,12 +67,14 @@ nvofapi_src = files([
'../src/nvofapi.cpp',
'../src/nvofapi_d3d12.cpp',
'../src/nvofapi_vk.cpp',
+ '../src/nvofapi_cuda.cpp',
])
nvofapi_tests_src = files([
'nvofapi_main.cpp',
'nvofapi_d3d12.cpp',
'nvofapi_vk.cpp',
+ 'nvofapi_cuda.cpp',
])
target_name = 'nvofapi'+target_suffix+'-tests'
diff --git a/tests/nvofapi_cuda.cpp b/tests/nvofapi_cuda.cpp
new file mode 100644
index 0000000..cc3ad00
--- /dev/null
+++ b/tests/nvofapi_cuda.cpp
@@ -0,0 +1,10 @@
+#include "nvofapi_tests_private.h"
+#include "nvofapi/mock_factory.h"
+
+using namespace trompeloeil;
+
+TEST_CASE("CreateInstanceVk returns not-available", "[.cuda]") {
+ struct NV_OF_CUDA_API_FUNCTION_LIST {
+ } functionList;
+ REQUIRE(NvOFAPICreateInstanceCuda(80, &functionList) == NV_OF_ERR_OF_NOT_AVAILABLE);
+}
diff --git a/tests/nvofapi_main.cpp b/tests/nvofapi_main.cpp
index d62e6ab..9b5a105 100644
--- a/tests/nvofapi_main.cpp
+++ b/tests/nvofapi_main.cpp
@@ -2,7 +2,7 @@
#include "../inc/catch_amalgamated.hpp"
#include "nvofapi/section_listener.h"
-CATCH_REGISTER_TAG_ALIAS("[@unit-tests]", "[d3d12],[vk]")
-CATCH_REGISTER_TAG_ALIAS("[@all]", "[d3d12],[vk]")
+CATCH_REGISTER_TAG_ALIAS("[@unit-tests]", "[d3d12],[vk],[cuda]")
+CATCH_REGISTER_TAG_ALIAS("[@all]", "[d3d12],[vk],[cuda]")
CATCH_REGISTER_LISTENER(SectionListener)
diff --git a/tests/nvofapi_tests_private.h b/tests/nvofapi_tests_private.h
index 3860e10..8783a1b 100644
--- a/tests/nvofapi_tests_private.h
+++ b/tests/nvofapi_tests_private.h
@@ -5,6 +5,7 @@
#endif // defined(__GNUC__) || defined(__clang__)
#include "../src/nvofapi_private.h"
+#include "../src/nvofapi_entrypoints.h"
#include "../src/nvofapi_globals.h"
#include "../inc/catch_amalgamated.hpp"
But still very meh that it hacks around the actual header |
So.. non-elegant solution is to make a |
a58b327
to
b0208db
Compare
Return not-available because OpticalFlow using CUDA is not implemented. The game Indiana Jones and The Great Circle will still crash if manually spoofing AD100 or greater, so the workaround spoofing GA100 is still needed for this game. Signed-off-by: Sveinar Søpler <[email protected]>
This will return an error with a logtext indicating to upgrade DLSS version since the new DLSS4 version do not use opticalflow for DLSS anymore ref NVIDIA