diff --git a/source/filters/filter-transform.cpp b/source/filters/filter-transform.cpp index 42b36f3..cfab01a 100644 --- a/source/filters/filter-transform.cpp +++ b/source/filters/filter-transform.cpp @@ -399,18 +399,29 @@ void filter::transform::transform_instance::deactivate() void filter::transform::transform_instance::video_tick(float) { + uint32_t width = 0; + uint32_t height = 0; + + // Grab parent and target. + obs_source_t* target = obs_filter_get_target(m_self); + if (target) { + // Grab width an height of the target source (child filter or source). + width = obs_source_get_base_width(target); + height = obs_source_get_base_height(target); + } + + // If size mismatch, force an update. + if (width != m_source_size.first) { + m_update_mesh = true; + } else if (height != m_source_size.second) { + m_update_mesh = true; + } + // Update Mesh if (m_update_mesh) { - uint32_t width = 0; - uint32_t height = 0; + m_source_size.first = width; + m_source_size.second = height; - // Grab parent and target. - obs_source_t* target = obs_filter_get_target(m_self); - if (target) { - // Grab width an height of the target source (child filter or source). - width = obs_source_get_base_width(target); - height = obs_source_get_base_height(target); - } if (width == 0) { width = 1; } diff --git a/source/filters/filter-transform.hpp b/source/filters/filter-transform.hpp index b528778..510bb69 100644 --- a/source/filters/filter-transform.hpp +++ b/source/filters/filter-transform.hpp @@ -68,6 +68,7 @@ namespace filter { std::shared_ptr m_source_rendertarget; std::shared_ptr m_source_texture; bool m_source_rendered; + std::pair m_source_size; // Mipmapping bool m_mipmap_enabled;