Merge pull request #1981 from jpark37/optimize-backdrop
libobs: UI: Remove DrawBackdrop() to save fullscreen pass
This commit is contained in:
19
libobs/obs.c
19
libobs/obs.c
@@ -1645,7 +1645,10 @@ void obs_render_main_view(void)
|
||||
obs_view_render(&obs->data.main_view);
|
||||
}
|
||||
|
||||
void obs_render_main_texture(void)
|
||||
static void obs_render_main_texture_internal(enum gs_blend_type src_c,
|
||||
enum gs_blend_type dest_c,
|
||||
enum gs_blend_type src_a,
|
||||
enum gs_blend_type dest_a)
|
||||
{
|
||||
struct obs_core_video *video;
|
||||
gs_texture_t *tex;
|
||||
@@ -1665,7 +1668,7 @@ void obs_render_main_texture(void)
|
||||
gs_effect_set_texture(param, tex);
|
||||
|
||||
gs_blend_state_push();
|
||||
gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA);
|
||||
gs_blend_function_separate(src_c, dest_c, src_a, dest_a);
|
||||
|
||||
while (gs_effect_loop(effect, "Draw"))
|
||||
gs_draw_sprite(tex, 0, 0, 0);
|
||||
@@ -1673,6 +1676,18 @@ void obs_render_main_texture(void)
|
||||
gs_blend_state_pop();
|
||||
}
|
||||
|
||||
void obs_render_main_texture(void)
|
||||
{
|
||||
obs_render_main_texture_internal(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA,
|
||||
GS_BLEND_ONE, GS_BLEND_INVSRCALPHA);
|
||||
}
|
||||
|
||||
void obs_render_main_texture_src_color_only(void)
|
||||
{
|
||||
obs_render_main_texture_internal(GS_BLEND_ONE, GS_BLEND_ZERO,
|
||||
GS_BLEND_ONE, GS_BLEND_INVSRCALPHA);
|
||||
}
|
||||
|
||||
gs_texture_t *obs_get_main_texture(void)
|
||||
{
|
||||
struct obs_core_video *video;
|
||||
|
@@ -649,6 +649,9 @@ EXPORT void obs_render_main_view(void);
|
||||
/** Renders the last main output texture */
|
||||
EXPORT void obs_render_main_texture(void);
|
||||
|
||||
/** Renders the last main output texture ignoring background color */
|
||||
EXPORT void obs_render_main_texture_src_color_only(void);
|
||||
|
||||
/** Returns the last main output texture. This can return NULL if the texture
|
||||
* is unavailable. */
|
||||
EXPORT gs_texture_t *obs_get_main_texture(void);
|
||||
|
Reference in New Issue
Block a user