mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
filter-shader: Fix some crashes
This commit is contained in:
parent
bb2f43a629
commit
d5dffbbe03
2 changed files with 13 additions and 13 deletions
|
@ -68,8 +68,11 @@ void filter::shader::shader_instance::video_tick(float_t sec_since_last)
|
|||
obs_data_release(data);
|
||||
}
|
||||
|
||||
obs_source_t* tgt = obs_filter_get_target(_self);
|
||||
_fx->set_size(obs_source_get_width(tgt), obs_source_get_height(tgt));
|
||||
if (obs_source_t* tgt = obs_filter_get_target(_self); tgt != nullptr) {
|
||||
_fx->set_size(obs_source_get_width(tgt), obs_source_get_height(tgt));
|
||||
} else if (obs_source* src = obs_filter_get_parent(_self); src != nullptr) {
|
||||
_fx->set_size(obs_source_get_base_width(src), obs_source_get_base_height(src));
|
||||
}
|
||||
}
|
||||
|
||||
void filter::shader::shader_instance::video_render(gs_effect_t* effect)
|
||||
|
@ -80,7 +83,7 @@ void filter::shader::shader_instance::video_render(gs_effect_t* effect)
|
|||
}
|
||||
|
||||
{
|
||||
gs::debug_marker _marker_cache{gs::debug_color_cache, "%s Cache"};
|
||||
gs::debug_marker _marker_cache{gs::debug_color_source, "%s: Capture", obs_source_get_name(_self)};
|
||||
auto op = _rt->render(_fx->width(), _fx->height());
|
||||
|
||||
gs_ortho(0, static_cast<float_t>(_fx->width()), 0, static_cast<float_t>(_fx->height()), -1, 1);
|
||||
|
@ -109,15 +112,15 @@ void filter::shader::shader_instance::video_render(gs_effect_t* effect)
|
|||
}
|
||||
}
|
||||
|
||||
_fx->prepare_render();
|
||||
_fx->set_input_a(_rt->get_texture());
|
||||
_fx->render();
|
||||
{
|
||||
gs::debug_marker _marker_cache{gs::debug_color_render, "%s: Render", obs_source_get_name(_self)};
|
||||
|
||||
_fx->prepare_render();
|
||||
_fx->set_input_a(_rt->get_texture());
|
||||
_fx->render();
|
||||
}
|
||||
}
|
||||
|
||||
void filter::shader::shader_instance::transition_start() {}
|
||||
|
||||
void filter::shader::shader_instance::transition_stop() {}
|
||||
|
||||
std::shared_ptr<filter::shader::shader_factory> filter::shader::shader_factory::factory_instance = nullptr;
|
||||
|
||||
filter::shader::shader_factory::shader_factory()
|
||||
|
|
|
@ -47,9 +47,6 @@ namespace filter::shader {
|
|||
|
||||
virtual void video_tick(float_t sec_since_last) override;
|
||||
virtual void video_render(gs_effect_t* effect) override;
|
||||
|
||||
virtual void transition_start() override;
|
||||
virtual void transition_stop() override;
|
||||
};
|
||||
|
||||
class shader_factory : public obs::source_factory<filter::shader::shader_factory, filter::shader::shader_instance> {
|
||||
|
|
Loading…
Reference in a new issue