static inline void render_display_begin(struct obs_display *display) { struct vec4 clear_color; gs_load_swapchain(display ? display->swap : NULL); if (display->size_changed) { gs_resize(display->cx, display->cy); display->size_changed = false; } gs_begin_scene(); vec4_from_rgba(&clear_color, display->background_color); clear_color.w = 1.0f; gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH | GS_CLEAR_STENCIL, &clear_color, 1.0f, 0); gs_enable_depth_test(false); /* gs_enable_blending(false); */ gs_set_cull_mode(GS_NEITHER); gs_ortho(0.0f, (float)display->cx, 0.0f, (float)display->cy, -100.0f, 100.0f); gs_set_viewport(0, 0, display->cx, display->cy); }
static inline void set_render_size(uint32_t width, uint32_t height) { gs_enable_depth_test(false); gs_set_cull_mode(GS_NEITHER); gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f); gs_set_viewport(0, 0, width, height); }
static inline void render_video(struct obs_core_video *video, bool raw_active, const bool gpu_active, int cur_texture, int prev_texture) { gs_begin_scene(); gs_enable_depth_test(false); gs_set_cull_mode(GS_NEITHER); render_main_texture(video, cur_texture); if (raw_active || gpu_active) { render_output_texture(video, cur_texture, prev_texture); #ifdef _WIN32 if (gpu_active) { gs_flush(); } #endif } if (raw_active || gpu_active) { if (video->gpu_conversion) { if (video->using_nv12_tex) render_convert_texture_nv12(video, cur_texture, prev_texture); else render_convert_texture(video, cur_texture, prev_texture); } #ifdef _WIN32 if (gpu_active) { gs_flush(); output_gpu_encoders(video, raw_active, prev_texture); } #endif if (raw_active) stage_output_texture(video, cur_texture, prev_texture); } gs_set_render_target(NULL, NULL); gs_enable_blending(true); gs_end_scene(); }
static inline void render_video(struct obs_core_video *video, int cur_texture, int prev_texture) { gs_begin_scene(); gs_enable_depth_test(false); gs_set_cull_mode(GS_NEITHER); render_main_texture(video, cur_texture); render_output_texture(video, cur_texture, prev_texture); if (video->gpu_conversion) render_convert_texture(video, cur_texture, prev_texture); stage_output_texture(video, cur_texture, prev_texture); gs_set_render_target(NULL, NULL); gs_enable_blending(true); gs_end_scene(); }