mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 22:23:31 +00:00
Optimize CUDA GL interop and provide fallback
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
|
||||
#include "renderer.h"
|
||||
|
||||
#include <ffnvcodec/dynlink_loader.h>
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/hwcontext_cuda.h>
|
||||
}
|
||||
|
||||
class CUDARenderer : public IFFmpegRenderer {
|
||||
public:
|
||||
CUDARenderer();
|
||||
@@ -12,10 +18,25 @@ public:
|
||||
virtual bool needsTestFrame() override;
|
||||
virtual bool isDirectRenderingSupported() override;
|
||||
|
||||
// Helper function used by SDLRenderer to read our CUDA frame
|
||||
static bool copyCudaFrameToBoundTexture(AVFrame* frame);
|
||||
|
||||
private:
|
||||
AVBufferRef* m_HwContext;
|
||||
};
|
||||
|
||||
#define NV12_PLANES 2
|
||||
|
||||
// Helper class used by SDLRenderer to read our CUDA frame
|
||||
class CUDAGLInteropHelper {
|
||||
public:
|
||||
CUDAGLInteropHelper(AVHWDeviceContext* context);
|
||||
~CUDAGLInteropHelper();
|
||||
|
||||
bool registerBoundTextures();
|
||||
void unregisterTextures();
|
||||
|
||||
bool copyCudaFrameToTextures(AVFrame* frame);
|
||||
|
||||
private:
|
||||
CudaFunctions* m_Funcs;
|
||||
AVCUDADeviceContext* m_Context;
|
||||
CUgraphicsResource m_Resources[NV12_PLANES];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user