MXVK Vulkan Framework 0.24.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) {
18 return cv::cuda::StreamAccessor::getStream(stream);
19 }
20
21 [[nodiscard]] inline cv::Mat host_mem_mat_header(cv::cuda::HostMem &hostMem) {
22 return hostMem.createMatHeader();
23 }
24
25 [[nodiscard]] inline cv::cuda::GpuMat host_mem_gpu_header(cv::cuda::HostMem &hostMem) {
26 return hostMem.createGpuMatHeader();
27 }
28
29} // namespace mxvk
30#endif
Utilities for loading and saving PNG images.
Definition mxvk.hpp:30