plugin: If CUDA is requested, ensure it is loaded first

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-17 13:28:13 +02:00
parent 0f92a4b499
commit 5279993f4b
2 changed files with 12 additions and 0 deletions

View file

@ -975,6 +975,9 @@ if(HAVE_NVIDIA_CUDA)
"source/nvidia/cuda/nvidia-cuda-stream.hpp"
"source/nvidia/cuda/nvidia-cuda-stream.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_NVIDIA_CUDA
)
endif()
if(REQUIRE_OBSFE AND HAVE_OBSFE)

View file

@ -24,6 +24,10 @@
#include "obs/gs/gs-vertexbuffer.hpp"
#include "obs/obs-source-tracker.hpp"
#ifdef ENABLE_NVIDIA_CUDA
#include "nvidia/cuda/nvidia-cuda-obs.hpp"
#endif
#ifdef ENABLE_ENCODER_FFMPEG
#include "encoders/encoder-ffmpeg.hpp"
#endif
@ -89,6 +93,11 @@ try {
// Initialize Source Tracker
streamfx::obs::source_tracker::initialize();
#ifdef ENABLE_NVIDIA_CUDA
// Initialize CUDA if features requested it.
auto cuda = ::streamfx::nvidia::cuda::obs::get();
#endif
// GS Stuff
{
_gs_fstri_vb = std::make_shared<streamfx::obs::gs::vertex_buffer>(uint32_t(3), uint8_t(1));