libobs: Add obs_render_main_texture
(Note: This commit also modifies UI and test) This makes it so that main preview panes are rendered with the main output texture rather than re-rendering the main view. The view will render all objects again, whereas the output texture will be a single texture render of the same exact thing. Also fixes some abnormal artifacting when scaling the main preview pane.
This commit is contained in:
@@ -614,14 +614,14 @@ void *obs_graphics_thread(void *param)
|
||||
last_time = tick_sources(obs->video.video_time, last_time);
|
||||
profile_end(tick_sources_name);
|
||||
|
||||
profile_start(render_displays_name);
|
||||
render_displays();
|
||||
profile_end(render_displays_name);
|
||||
|
||||
profile_start(output_frame_name);
|
||||
output_frame();
|
||||
profile_end(output_frame_name);
|
||||
|
||||
profile_start(render_displays_name);
|
||||
render_displays();
|
||||
profile_end(render_displays_name);
|
||||
|
||||
frame_time_ns = os_gettime_ns() - frame_start;
|
||||
|
||||
profile_end(video_thread_name);
|
||||
|
26
libobs/obs.c
26
libobs/obs.c
@@ -1430,6 +1430,32 @@ void obs_render_main_view(void)
|
||||
obs_view_render(&obs->data.main_view);
|
||||
}
|
||||
|
||||
void obs_render_main_texture(void)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
gs_texture_t *tex;
|
||||
gs_effect_t *effect;
|
||||
gs_eparam_t *param;
|
||||
int last_tex;
|
||||
|
||||
if (!obs) return;
|
||||
|
||||
last_tex = video->cur_texture == 0
|
||||
? NUM_TEXTURES - 1
|
||||
: video->cur_texture - 1;
|
||||
|
||||
if (!video->textures_rendered[last_tex])
|
||||
return;
|
||||
|
||||
tex = video->render_textures[last_tex];
|
||||
effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
|
||||
param = gs_effect_get_param_by_name(effect, "image");
|
||||
gs_effect_set_texture(param, tex);
|
||||
|
||||
while (gs_effect_loop(effect, "Draw"))
|
||||
gs_draw_sprite(tex, 0, 0, 0);
|
||||
}
|
||||
|
||||
void obs_set_master_volume(float volume)
|
||||
{
|
||||
struct calldata data = {0};
|
||||
|
@@ -550,8 +550,12 @@ EXPORT signal_handler_t *obs_get_signal_handler(void);
|
||||
EXPORT proc_handler_t *obs_get_proc_handler(void);
|
||||
|
||||
/** Renders the main view */
|
||||
DEPRECATED
|
||||
EXPORT void obs_render_main_view(void);
|
||||
|
||||
/** Renders the last main output texture */
|
||||
EXPORT void obs_render_main_texture(void);
|
||||
|
||||
/** Sets the master user volume */
|
||||
EXPORT void obs_set_master_volume(float volume);
|
||||
|
||||
|
Reference in New Issue
Block a user