fixed issues with some opengl implementations
This commit is contained in:
@@ -29,6 +29,8 @@ set(OLIVE_SOURCES
|
||||
render/rendermodes.h
|
||||
render/renderframebuffer.h
|
||||
render/renderframebuffer.cpp
|
||||
render/renderservice.h
|
||||
render/renderservice.cpp
|
||||
render/rendertexture.h
|
||||
render/rendertexture.cpp
|
||||
render/sampleformat.h
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
RenderInstance::RenderInstance(const int& width,
|
||||
const int& height,
|
||||
const int ÷r,
|
||||
const int& divider,
|
||||
const olive::PixelFormat& format,
|
||||
const olive::RenderMode& mode) :
|
||||
share_ctx_(nullptr),
|
||||
@@ -36,6 +36,14 @@ RenderInstance::RenderInstance(const int& width,
|
||||
mode_(mode),
|
||||
divider_(divider)
|
||||
{
|
||||
// Create offscreen surface
|
||||
surface_.create();
|
||||
}
|
||||
|
||||
RenderInstance::~RenderInstance()
|
||||
{
|
||||
// Destroy offscreen surface
|
||||
surface_.destroy();
|
||||
}
|
||||
|
||||
void RenderInstance::SetShareContext(QOpenGLContext *share)
|
||||
@@ -65,13 +73,9 @@ bool RenderInstance::Start()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create offscreen surface
|
||||
surface_.create();
|
||||
|
||||
// Make context current on that surface
|
||||
if (!ctx_->makeCurrent(&surface_)) {
|
||||
qWarning() << tr("Failed to makeCurrent() on offscreen surface in thread %1").arg(reinterpret_cast<quintptr>(this));
|
||||
surface_.destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,11 +104,7 @@ void RenderInstance::Stop()
|
||||
buffer_.Destroy();
|
||||
|
||||
// Destroy context
|
||||
|
||||
delete ctx_;
|
||||
|
||||
// Destroy offscreen surface
|
||||
surface_.destroy();
|
||||
}
|
||||
|
||||
bool RenderInstance::IsStarted()
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
*
|
||||
* RenderInstance contains everything that Nodes will need to draw with on a per-thread basis.
|
||||
*
|
||||
* In OpenGL,
|
||||
* Due to its usage of QOffscreenSurface, a RenderInstance instance must be constructed in the main (GUI) thread. From
|
||||
* there it is safe to call Start() on in another thread.
|
||||
*/
|
||||
class RenderInstance : public QObject
|
||||
{
|
||||
@@ -45,6 +46,28 @@ public:
|
||||
const olive::PixelFormat& format,
|
||||
const olive::RenderMode& mode);
|
||||
|
||||
virtual ~RenderInstance() override;
|
||||
|
||||
/**
|
||||
* @brief Deleted copy constructor
|
||||
*/
|
||||
RenderInstance(const RenderInstance& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief Deleted move constructor
|
||||
*/
|
||||
RenderInstance(RenderInstance&& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief Deleted copy assignment
|
||||
*/
|
||||
RenderInstance& operator=(const RenderInstance& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief Deleted move assignment
|
||||
*/
|
||||
RenderInstance& operator=(RenderInstance&& other) = delete;
|
||||
|
||||
void SetShareContext(QOpenGLContext* share);
|
||||
|
||||
bool Start();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "renderservice.h"
|
||||
|
||||
RenderService* RenderService::render_service_;
|
||||
|
||||
RenderService::RenderService()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef RENDERSERVICE_H
|
||||
#define RENDERSERVICE_H
|
||||
|
||||
|
||||
class RenderService
|
||||
{
|
||||
public:
|
||||
RenderService();
|
||||
|
||||
static RenderService* CreateInstance();
|
||||
static RenderService* GetInstance();
|
||||
static RenderService* DestroyInstance();
|
||||
|
||||
private:
|
||||
static RenderService* render_service_;
|
||||
|
||||
};
|
||||
|
||||
#endif // RENDERSERVICE_H
|
||||
Reference in New Issue
Block a user