further improved gizmos
This commit is contained in:
@@ -342,7 +342,7 @@ struct TextureToBind {
|
||||
Texture::Interpolation interpolation;
|
||||
};
|
||||
|
||||
void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, VideoParams destination_params)
|
||||
void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, VideoParams destination_params, bool clear_destination)
|
||||
{
|
||||
// If this node is iterative, we'll pick up which input here
|
||||
QString iterative_name;
|
||||
@@ -541,8 +541,10 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
||||
DetachTextureAsDestination();
|
||||
}
|
||||
|
||||
// Clear the destination, whatever it is
|
||||
ClearDestination();
|
||||
// Clear the destination if the caller requested it
|
||||
if (clear_destination) {
|
||||
ClearDestination();
|
||||
}
|
||||
} else {
|
||||
// Always draw to output_tex, which gets swapped with input_tex every iteration
|
||||
AttachTextureAsDestination(output_tex.get());
|
||||
|
||||
@@ -68,7 +68,8 @@ protected slots:
|
||||
virtual void Blit(QVariant shader,
|
||||
olive::ShaderJob job,
|
||||
olive::Texture* destination,
|
||||
olive::VideoParams destination_params) override;
|
||||
olive::VideoParams destination_params,
|
||||
bool clear_destination) override;
|
||||
|
||||
private:
|
||||
static GLint GetInternalFormat(VideoParams::Format format, int channel_layout);
|
||||
|
||||
@@ -56,14 +56,14 @@ TexturePtr Renderer::CreateTexture(const VideoParams ¶ms, const void *data,
|
||||
return CreateTexture(params, Texture::k2D, data, linesize);
|
||||
}
|
||||
|
||||
void Renderer::BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, Texture *destination, const QMatrix4x4 &matrix)
|
||||
void Renderer::BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, Texture *destination, bool clear_destination, const QMatrix4x4 &matrix)
|
||||
{
|
||||
BlitColorManagedInternal(color_processor, source, source_is_premultiplied, destination, destination->params(), matrix);
|
||||
BlitColorManagedInternal(color_processor, source, source_is_premultiplied, destination, destination->params(), clear_destination, matrix);
|
||||
}
|
||||
|
||||
void Renderer::BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, VideoParams params, const QMatrix4x4& matrix)
|
||||
void Renderer::BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, VideoParams params, bool clear_destination, const QMatrix4x4& matrix)
|
||||
{
|
||||
BlitColorManagedInternal(color_processor, source, source_is_premultiplied, nullptr, params, matrix);
|
||||
BlitColorManagedInternal(color_processor, source, source_is_premultiplied, nullptr, params, clear_destination, matrix);
|
||||
}
|
||||
|
||||
void Renderer::Destroy()
|
||||
@@ -225,7 +225,7 @@ bool Renderer::GetColorContext(ColorProcessorPtr color_processor, Renderer::Colo
|
||||
|
||||
void Renderer::BlitColorManagedInternal(ColorProcessorPtr color_processor, TexturePtr source,
|
||||
bool source_is_premultiplied, Texture *destination,
|
||||
VideoParams params, const QMatrix4x4& matrix)
|
||||
VideoParams params, bool clear_destination, const QMatrix4x4& matrix)
|
||||
{
|
||||
ColorContext color_ctx;
|
||||
if (!GetColorContext(color_processor, &color_ctx)) {
|
||||
@@ -262,9 +262,9 @@ void Renderer::BlitColorManagedInternal(ColorProcessorPtr color_processor, Textu
|
||||
}
|
||||
|
||||
if (destination) {
|
||||
BlitToTexture(color_ctx.compiled_shader, job, destination);
|
||||
BlitToTexture(color_ctx.compiled_shader, job, destination, clear_destination);
|
||||
} else {
|
||||
Blit(color_ctx.compiled_shader, job, params);
|
||||
Blit(color_ctx.compiled_shader, job, params, clear_destination);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-8
@@ -48,20 +48,22 @@ public:
|
||||
|
||||
void BlitToTexture(QVariant shader,
|
||||
olive::ShaderJob job,
|
||||
olive::Texture* destination)
|
||||
olive::Texture* destination,
|
||||
bool clear_destination = true)
|
||||
{
|
||||
Blit(shader, job, destination, destination->params());
|
||||
Blit(shader, job, destination, destination->params(), clear_destination);
|
||||
}
|
||||
|
||||
void Blit(QVariant shader,
|
||||
olive::ShaderJob job,
|
||||
olive::VideoParams params)
|
||||
olive::VideoParams params,
|
||||
bool clear_destination = true)
|
||||
{
|
||||
Blit(shader, job, nullptr, params);
|
||||
Blit(shader, job, nullptr, params, clear_destination);
|
||||
}
|
||||
|
||||
void BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, Texture* destination, const QMatrix4x4& matrix = QMatrix4x4());
|
||||
void BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, VideoParams params, const QMatrix4x4& matrix = QMatrix4x4());
|
||||
void BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, Texture* destination, bool clear_destination = true, const QMatrix4x4& matrix = QMatrix4x4());
|
||||
void BlitColorManaged(ColorProcessorPtr color_processor, TexturePtr source, bool source_is_premultiplied, VideoParams params, bool clear_destination = true, const QMatrix4x4& matrix = QMatrix4x4());
|
||||
|
||||
void Destroy();
|
||||
|
||||
@@ -89,7 +91,8 @@ protected slots:
|
||||
virtual void Blit(QVariant shader,
|
||||
olive::ShaderJob job,
|
||||
olive::Texture* destination,
|
||||
olive::VideoParams destination_params) = 0;
|
||||
olive::VideoParams destination_params,
|
||||
bool clear_destination) = 0;
|
||||
|
||||
private:
|
||||
struct ColorContext {
|
||||
@@ -115,7 +118,8 @@ private:
|
||||
|
||||
void BlitColorManagedInternal(ColorProcessorPtr color_processor, TexturePtr source,
|
||||
bool source_is_premultiplied,
|
||||
Texture* destination, VideoParams params, const QMatrix4x4 &matrix);
|
||||
Texture* destination, VideoParams params, bool clear_destination,
|
||||
const QMatrix4x4 &matrix);
|
||||
|
||||
QHash<QString, ColorContext> color_cache_;
|
||||
|
||||
|
||||
@@ -148,13 +148,14 @@ void RendererThreadWrapper::DownloadFromTexture(Texture *texture, void *data, in
|
||||
Q_ARG(int, linesize));
|
||||
}
|
||||
|
||||
void RendererThreadWrapper::Blit(QVariant shader, ShaderJob job, Texture *destination, VideoParams destination_params)
|
||||
void RendererThreadWrapper::Blit(QVariant shader, ShaderJob job, Texture *destination, VideoParams destination_params, bool clear_destination)
|
||||
{
|
||||
QMetaObject::invokeMethod(inner_, "Blit", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(QVariant, shader),
|
||||
OLIVE_NS_ARG(ShaderJob, job),
|
||||
OLIVE_NS_ARG(Texture*, destination),
|
||||
OLIVE_NS_ARG(VideoParams, destination_params));
|
||||
OLIVE_NS_ARG(VideoParams, destination_params),
|
||||
Q_ARG(bool, clear_destination));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ protected slots:
|
||||
virtual void Blit(QVariant shader,
|
||||
olive::ShaderJob job,
|
||||
olive::Texture* destination,
|
||||
olive::VideoParams destination_params) override;
|
||||
olive::VideoParams destination_params,
|
||||
bool clear_destination) override;
|
||||
|
||||
private:
|
||||
Renderer* inner_;
|
||||
|
||||
@@ -104,7 +104,7 @@ void RenderProcessor::Run()
|
||||
|
||||
if (output_color_transform) {
|
||||
// Yes color transform, blit color managed
|
||||
render_ctx_->BlitColorManaged(output_color_transform, texture, true, blit_tex.get(), matrix);
|
||||
render_ctx_->BlitColorManaged(output_color_transform, texture, true, blit_tex.get(), true, matrix);
|
||||
} else {
|
||||
// No color transform, just blit
|
||||
ShaderJob job;
|
||||
|
||||
Reference in New Issue
Block a user