MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
mxvk_opencv_compat.hpp
Go to the documentation of this file.
1/**
2 * @file mxvk_opencv_compat.hpp
3 * @brief Small compatibility wrappers around OpenCV CUDA APIs.
4 *
5 * Keeping these helpers in one place limits the blast radius when OpenCV
6 * changes CUDA stream or HostMem APIs in future releases.
7 */
8#pragma once
9
10#ifdef MXVK_CUDA
11#include <cuda_runtime_api.h>
12#include <opencv2/core/cuda.hpp>
13#include <opencv2/core/cuda_stream_accessor.hpp>
14
15namespace mxvk {
16
17 [[nodiscard]] inline cudaStream_t cuda_stream_handle(cv::cuda::Stream &stream) { return cv::cuda::StreamAccessor::getStream(stream); }
18
19 [[nodiscard]] inline cv::Mat host_mem_mat_header(cv::cuda::HostMem &hostMem) { return hostMem.createMatHeader(); }
20
21 [[nodiscard]] inline cv::cuda::GpuMat host_mem_gpu_header(cv::cuda::HostMem &hostMem) { return hostMem.createGpuMatHeader(); }
22
23} // namespace mxvk
24#endif
Utilities for loading and saving PNG images.
Definition mxvk.hpp:31