mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
gfx/shader: Allow specifying effect for direct rendering (#501)
This commit is contained in:
parent
4e21830627
commit
e7dd44e3ec
2 changed files with 7 additions and 5 deletions
|
@ -508,11 +508,14 @@ void gfx::shader::shader::prepare_render()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx::shader::shader::render()
|
void gfx::shader::shader::render(gs_effect* effect)
|
||||||
{
|
{
|
||||||
if (!_shader)
|
if (!_shader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!effect)
|
||||||
|
effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
|
||||||
|
|
||||||
if (!_rt_up_to_date) {
|
if (!_rt_up_to_date) {
|
||||||
auto op = _rt->render(width(), height());
|
auto op = _rt->render(width(), height());
|
||||||
vec4 zero = {0, 0, 0, 0};
|
vec4 zero = {0, 0, 0, 0};
|
||||||
|
@ -534,9 +537,8 @@ void gfx::shader::shader::render()
|
||||||
_rt_up_to_date = true;
|
_rt_up_to_date = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gs_effect_set_texture(gs_effect_get_param_by_name(obs_get_base_effect(OBS_EFFECT_DEFAULT), "image"),
|
gs_effect_set_texture(gs_effect_get_param_by_name(effect, "image"), _rt->get_texture()->get_object());
|
||||||
_rt->get_texture()->get_object());
|
while (gs_effect_loop(effect, "Draw")) {
|
||||||
while (gs_effect_loop(obs_get_base_effect(OBS_EFFECT_DEFAULT), "Draw")) {
|
|
||||||
gs_draw_sprite(nullptr, 0, width(), height());
|
gs_draw_sprite(nullptr, 0, width(), height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace gfx {
|
||||||
|
|
||||||
void prepare_render();
|
void prepare_render();
|
||||||
|
|
||||||
void render();
|
void render(gs_effect* effect);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_size(uint32_t w, uint32_t h);
|
void set_size(uint32_t w, uint32_t h);
|
||||||
|
|
Loading…
Reference in a new issue