libobs: Ensure active copy surfaces are active

Stale surfaces can cause improper downloads from GPU, and lead to video
corruption in certain cases.
This commit is contained in:
jpark37 2022-06-02 21:58:42 -07:00 committed by Jim
parent 3c390d8b5b
commit 1ac758a2ef

View file

@ -392,22 +392,25 @@ stage_output_texture(struct obs_core_video *video, int cur_texture,
if (!video->gpu_conversion) {
gs_stagesurf_t *copy = copy_surfaces[0];
if (copy) {
if (copy)
gs_stage_texture(copy, video->output_texture);
video->active_copy_surfaces[cur_texture][0] = copy;
}
video->active_copy_surfaces[cur_texture][0] = copy;
for (size_t i = 1; i < NUM_CHANNELS; ++i)
video->active_copy_surfaces[cur_texture][i] = NULL;
video->textures_copied[cur_texture] = true;
} else if (video->texture_converted) {
for (size_t i = 0; i < channel_count; i++) {
gs_stagesurf_t *copy = copy_surfaces[i];
if (copy) {
if (copy)
gs_stage_texture(copy, convert_textures[i]);
video->active_copy_surfaces[cur_texture][i] =
copy;
}
video->active_copy_surfaces[cur_texture][i] = copy;
}
for (size_t i = channel_count; i < NUM_CHANNELS; ++i)
video->active_copy_surfaces[cur_texture][i] = NULL;
video->textures_copied[cur_texture] = true;
}