libobs: UI: Remove DrawBackdrop() to save fullscreen pass
It's a waste of GPU time to do two fullscreen passes to render final mix previews. Use blend states to simulate the black background of DrawBackdrop() for the following situations: - Main preview window (Studio Mode off) - Studio Mode: Program This does not effect: - Studio Mode: Preview (still uses DrawBackdrop) - Fullscreen Projector (uses GPU clear to black) - Windowed Projector (uses GPU clear to black) intel GPA, SetStablePowerState, Intel HD Graphics 530, 1920x1080 Before: DrawBackdrop: ~529 us main texture: ~367 us (Cheaper than drawing a black quad?) After: [DrawBackdrop optimized away] main texture: ~383 us
This commit is contained in:
@@ -1330,9 +1330,7 @@ void OBSBasic::RenderProgram(void *data, uint32_t cx, uint32_t cy)
|
||||
gs_set_viewport(window->programX, window->programY, window->programCX,
|
||||
window->programCY);
|
||||
|
||||
window->DrawBackdrop(float(ovi.base_width), float(ovi.base_height));
|
||||
|
||||
obs_render_main_texture();
|
||||
obs_render_main_texture_src_color_only();
|
||||
gs_load_vertexbuffer(nullptr);
|
||||
|
||||
/* --------------------------------------- */
|
||||
|
@@ -3341,15 +3341,16 @@ void OBSBasic::RenderMain(void *data, uint32_t cx, uint32_t cy)
|
||||
gs_set_viewport(window->previewX, window->previewY, window->previewCX,
|
||||
window->previewCY);
|
||||
|
||||
window->DrawBackdrop(float(ovi.base_width), float(ovi.base_height));
|
||||
|
||||
if (window->IsPreviewProgramMode()) {
|
||||
window->DrawBackdrop(float(ovi.base_width),
|
||||
float(ovi.base_height));
|
||||
|
||||
OBSScene scene = window->GetCurrentScene();
|
||||
obs_source_t *source = obs_scene_get_source(scene);
|
||||
if (source)
|
||||
obs_source_video_render(source);
|
||||
} else {
|
||||
obs_render_main_texture();
|
||||
obs_render_main_texture_src_color_only();
|
||||
}
|
||||
gs_load_vertexbuffer(nullptr);
|
||||
|
||||
|
Reference in New Issue
Block a user