decklink-output-ui: Render texrender once per frame
To prevent rendering the texrender more than necessary, only render it once per frame in a tick callback.
This commit is contained in:
parent
0a3cd9021b
commit
b28f99d4cd
@ -105,6 +105,16 @@ OBSData load_preview_settings()
|
||||
void on_preview_scene_changed(enum obs_frontend_event event, void *param);
|
||||
void render_preview_source(void *param, uint32_t cx, uint32_t cy);
|
||||
|
||||
static void preview_tick(void *param, float sec)
|
||||
{
|
||||
UNUSED_PARAMETER(sec);
|
||||
|
||||
auto ctx = (struct preview_output *)param;
|
||||
|
||||
if (ctx->texrender)
|
||||
gs_texrender_reset(ctx->texrender);
|
||||
}
|
||||
|
||||
void preview_output_stop()
|
||||
{
|
||||
obs_output_stop(context.output);
|
||||
@ -122,6 +132,7 @@ void preview_output_stop()
|
||||
obs_leave_graphics();
|
||||
|
||||
video_output_close(context.video_queue);
|
||||
obs_remove_tick_callback(preview_tick, &context);
|
||||
|
||||
preview_output_running = false;
|
||||
doUI->PreviewOutputStateChanged(false);
|
||||
@ -132,6 +143,7 @@ void preview_output_start()
|
||||
OBSData settings = load_preview_settings();
|
||||
|
||||
if (settings != nullptr) {
|
||||
obs_add_tick_callback(preview_tick, &context);
|
||||
context.output = obs_output_create("decklink_output",
|
||||
"decklink_preview_output",
|
||||
settings, NULL);
|
||||
@ -231,8 +243,6 @@ void render_preview_source(void *param, uint32_t cx, uint32_t cy)
|
||||
uint32_t width = obs_source_get_base_width(ctx->current_source);
|
||||
uint32_t height = obs_source_get_base_height(ctx->current_source);
|
||||
|
||||
gs_texrender_reset(ctx->texrender);
|
||||
|
||||
if (gs_texrender_begin(ctx->texrender, width, height)) {
|
||||
struct vec4 background;
|
||||
vec4_zero(&background);
|
||||
|
Loading…
x
Reference in New Issue
Block a user