scopes: don't use shared context

OpenGL shared contexts (through Qt at least) seem to be buggy. Scopes have been
shifted to a non-shared approach as a result.
This commit is contained in:
itsmattkc
2020-04-28 17:08:52 +10:00
parent 690bdb6581
commit 4906bb7d53
17 changed files with 90 additions and 188 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ void OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, NodeValueTable*
VideoRenderingParams footage_params(frame->width(), frame->height(), frame->format());
footage_tex_ref = texture_cache_.Get(ctx_, footage_params, frame->data(), frame->linesize_pixels());
footage_tex_ref = texture_cache_.Get(ctx_, footage_params, frame);
if (ocio_method == ColorManager::kOCIOFast) {
if (!color_processor->IsEnabled()) {
@@ -74,6 +74,11 @@ void OpenGLTexture::Create(QOpenGLContext *ctx, int width, int height, const Pix
}
void OpenGLTexture::Create(QOpenGLContext *ctx, FramePtr frame)
{
Create(ctx, frame.get());
}
void OpenGLTexture::Create(QOpenGLContext *ctx, Frame *frame)
{
Create(ctx, frame->width(), frame->height(), frame->format(), frame->data(), frame->linesize_pixels());
}
@@ -120,6 +125,16 @@ const GLuint &OpenGLTexture::texture() const
return texture_;
}
void OpenGLTexture::Upload(FramePtr frame)
{
Upload(frame.get());
}
void OpenGLTexture::Upload(Frame *frame)
{
Upload(frame->data(), frame->linesize_pixels());
}
void OpenGLTexture::Upload(const void *data, int linesize)
{
if (!IsCreated()) {
@@ -44,6 +44,7 @@ public:
void Create(QOpenGLContext* ctx, int width, int height, const PixelFormat::Format &format, const void *data, int linesize);
void Create(QOpenGLContext* ctx, int width, int height, const PixelFormat::Format &format);
void Create(QOpenGLContext* ctx, FramePtr frame);
void Create(QOpenGLContext* ctx, Frame* frame);
bool IsCreated() const;
@@ -59,6 +60,8 @@ public:
const GLuint& texture() const;
void Upload(FramePtr frame);
void Upload(Frame* frame);
void Upload(const void *data, int linesize);
public slots:
@@ -29,6 +29,16 @@ OpenGLTextureCache::~OpenGLTextureCache()
}
}
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoRenderingParams &params, FramePtr frame)
{
return Get(ctx, params, frame.get());
}
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoRenderingParams &params, Frame *frame)
{
return Get(ctx, params, frame->data(), frame->linesize_pixels());
}
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoRenderingParams &params, const void *data, int linesize)
{
OpenGLTexturePtr texture = nullptr;
@@ -57,6 +57,8 @@ public:
DISABLE_COPY_MOVE(OpenGLTextureCache)
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, FramePtr frame);
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, Frame* frame);
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, const void *data, int linesize);
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params);