mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
BugFix Strong data testing before setting program parameters
This commit is contained in:
@@ -376,7 +376,7 @@ void ImageFilter::draw (FrameBuffer *input)
|
||||
bool forced = false;
|
||||
|
||||
// if input changed (typically on first draw)
|
||||
if (input_ != input) {
|
||||
if (input_ != input || buffers_.first == nullptr || buffers_.second == nullptr) {
|
||||
// keep reference to input framebuffer
|
||||
input_ = input;
|
||||
// create first-pass surface and shader, taking as texture the input framebuffer
|
||||
@@ -499,15 +499,21 @@ void ImageFilter::updateParameters()
|
||||
|
||||
void ImageFilter::setProgramParameters(const std::map< std::string, float > ¶meters)
|
||||
{
|
||||
program_.setParameters(parameters);
|
||||
for (const auto &p : parameters) {
|
||||
if (p.second == NAN || p.first.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
program_.setParameters(parameters);
|
||||
updateParameters();
|
||||
}
|
||||
|
||||
void ImageFilter::setProgramParameter(const std::string &p, float value)
|
||||
{
|
||||
program_.setParameter(p, value);
|
||||
if (value == NAN || p.empty())
|
||||
return;
|
||||
|
||||
program_.setParameter(p, value);
|
||||
updateParameters();
|
||||
}
|
||||
|
||||
@@ -721,7 +727,7 @@ void BlurFilter::draw (FrameBuffer *input)
|
||||
setMethod( BLUR_GAUSSIAN );
|
||||
|
||||
// if input changed (typically on first draw)
|
||||
if (input_ != input) {
|
||||
if (input_ != input || buffers_.first == nullptr || buffers_.second == nullptr) {
|
||||
// keep reference to input framebuffer
|
||||
input_ = input;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user