diff --git a/zluda_rtc/src/lib.rs b/zluda_rtc/src/lib.rs index 427a2e0d..670fdfb3 100644 --- a/zluda_rtc/src/lib.rs +++ b/zluda_rtc/src/lib.rs @@ -13,6 +13,8 @@ fn unsupported() -> nvrtcResult { nvrtcResult::NVRTC_ERROR_INTERNAL_ERROR } +const NVRTC_VERSION_MAJOR: i32 = 11; +const NVRTC_VERSION_MINOR: i32 = 8; const SUPPORTED_OPTIONS: [&'static str; 1] = ["--std"]; fn to_nvrtc(status: hiprtc_sys::hiprtcResult) -> nvrtcResult { @@ -37,6 +39,15 @@ unsafe fn get_error_string(result: nvrtcResult) -> *const ::std::os::raw::c_char hiprtcGetErrorString(to_hiprtc(result)) } +unsafe fn version( + major: *mut i32, + minor: *mut i32, +) -> nvrtcResult { + *major = NVRTC_VERSION_MAJOR; + *minor = NVRTC_VERSION_MINOR; + nvrtcResult::NVRTC_SUCCESS +} + unsafe fn create_program( prog: *mut nvrtcProgram, src: *const std::ffi::c_char, diff --git a/zluda_rtc/src/nvrtc.rs b/zluda_rtc/src/nvrtc.rs index 2473091a..502e75f8 100644 --- a/zluda_rtc/src/nvrtc.rs +++ b/zluda_rtc/src/nvrtc.rs @@ -53,9 +53,7 @@ pub unsafe extern "system" fn nvrtcVersion( major: *mut ::std::os::raw::c_int, minor: *mut ::std::os::raw::c_int, ) -> nvrtcResult { - *major = 11; - *minor = 8; - nvrtcResult::NVRTC_SUCCESS + crate::version(major, minor) } #[doc = " \\ingroup query\n \\brief nvrtcGetNumSupportedArchs sets the output parameter \\p numArchs\n with the number of architectures supported by NVRTC. This can\n then be used to pass an array to ::nvrtcGetSupportedArchs to\n get the supported architectures.\n\n \\param [out] numArchs number of supported architectures.\n \\return\n - \\link #nvrtcResult NVRTC_SUCCESS \\endlink\n - \\link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \\endlink\n\n see ::nvrtcGetSupportedArchs"]