attempt to use fbo clear function

This commit is contained in:
itsmattkc
2019-12-10 21:32:21 +11:00
parent 91c7d8aa4d
commit f5d66436fa
8 changed files with 13 additions and 32 deletions
-13
View File
@@ -19,19 +19,6 @@ QIODevice *AudioBackend::GetAudioPullDevice()
return &pull_device_;
}
void AudioBackend::InvalidateCache(const rational &start_range, const rational &end_range)
{
/*
// Truncate to length if necessary
int max_length_in_bytes = params().time_to_bytes(viewer_node()->Length());
if (pcm_data_.size() > max_length_in_bytes) {
pcm_data_.resize(max_length_in_bytes);
}
*/
AudioRenderBackend::InvalidateCache(start_range, end_range);
}
bool AudioBackend::InitInternal()
{
// Initiate one thread per CPU core
-3
View File
@@ -15,9 +15,6 @@ public:
virtual QIODevice* GetAudioPullDevice() override;
public slots:
virtual void InvalidateCache(const rational &start_range, const rational &end_range) override;
protected:
virtual bool InitInternal() override;
@@ -29,6 +29,10 @@ void AudioRenderBackend::SetParameters(const AudioRenderingParams &params)
void AudioRenderBackend::InvalidateCache(const rational &start_range, const rational &end_range)
{
if (!params_.is_valid()) {
return;
}
RenderBackend::InvalidateCache(start_range, end_range);
rational start_range_adj = qMax(rational(0), start_range);
@@ -88,14 +88,14 @@ void OpenGLFramebuffer::Release()
context_->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}
void OpenGLFramebuffer::Attach(OpenGLTexturePtr texture)
void OpenGLFramebuffer::Attach(OpenGLTexturePtr texture, bool clear)
{
if (context_ == nullptr) {
return;
}
texture_ = texture;
AttachInternal(texture_->texture(), false);
AttachInternal(texture_->texture(), clear);
}
void OpenGLFramebuffer::Detach()
@@ -43,7 +43,7 @@ public:
void Release();
void Attach(OpenGLTexturePtr texture);
void Attach(OpenGLTexturePtr texture, bool clear = false);
void Detach();
+2 -9
View File
@@ -111,13 +111,10 @@ void OpenGLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable
// Set viewport for texture size
functions_->glViewport(0, 0, footage_tex_ref->texture()->width(), footage_tex_ref->texture()->height());
buffer_.Attach(associated_tex_ref->texture());
buffer_.Attach(associated_tex_ref->texture(), true);
buffer_.Bind();
footage_tex_ref->texture()->Bind();
functions_->glClearColor(0.0, 0.0, 0.0, 0.0);
functions_->glClear(GL_COLOR_BUFFER_BIT);
// Blit old texture to new texture through OCIO shader
color_processor->ProcessOpenGL();
@@ -156,13 +153,9 @@ void OpenGLWorker::RunNodeAccelerated(const Node *node, const NodeValueDatabase
// Create the output texture
OpenGLTextureCache::ReferencePtr output_ref = texture_cache_->Get(video_params());
buffer_.Attach(output_ref->texture());
buffer_.Attach(output_ref->texture(), true);
buffer_.Bind();
functions_->glClearColor(0.0, 0.0, 0.0, 0.0);
functions_->glClear(GL_COLOR_BUFFER_BIT);
// Lock the shader so no other thread interferes as we set parameters and draw (and we don't interfere with any others)
shader->Lock();
shader->bind();
+1 -1
View File
@@ -256,7 +256,7 @@ void RenderBackend::CacheNext()
if (!WorkerIsBusy(worker)) {
TimeRange cache_frame = cache_queue_.takeFirst();
//qDebug() << "Rendering" << cache_frame.in().toDouble() << "-" << cache_frame.out().toDouble();
qDebug() << "Rendering" << cache_frame.in().toDouble();
NodeDependency dep = NodeDependency(node_connected_to_viewer, cache_frame.in(), cache_frame.out());
+3 -3
View File
@@ -81,13 +81,13 @@ void VideoRenderBackend::InvalidateCache(const rational &start_range, const rati
rational compare = cache_queue_.at(i).in();
rational compare_diff = compare - last_time;
if (compare_diff > diff) {
cache_queue_.insert(i, new_range);
if (compare == r) {
added = true;
break;
}
if (compare == r) {
if (compare_diff > diff) {
cache_queue_.insert(i, new_range);
added = true;
break;
}