- GLuint cbcr_full_tex, cbcr_copy_tex, y_copy_tex;
- if (global_flags.x264_bit_depth > 8) {
- cbcr_full_tex = resource_pool->create_2d_texture(GL_RG16, global_flags.width, global_flags.height);
- y_copy_tex = resource_pool->create_2d_texture(GL_R16, global_flags.width, global_flags.height);
- cbcr_copy_tex = resource_pool->create_2d_texture(GL_RG16, global_flags.width / 2, global_flags.height / 2);
+ GLuint y_tex, cbcr_full_tex, cbcr_tex;
+ GLuint y_copy_tex, cbcr_copy_tex = 0;
+ GLuint y_display_tex, cbcr_display_tex;
+ GLenum y_type = (global_flags.x264_bit_depth > 8) ? GL_R16 : GL_R8;
+ GLenum cbcr_type = (global_flags.x264_bit_depth > 8) ? GL_RG16 : GL_RG8;
+ const bool is_zerocopy = video_encoder->is_zerocopy();
+ if (is_zerocopy) {
+ cbcr_full_tex = resource_pool->create_2d_texture(cbcr_type, global_flags.width, global_flags.height);
+ y_copy_tex = resource_pool->create_2d_texture(y_type, global_flags.width, global_flags.height);
+ cbcr_copy_tex = resource_pool->create_2d_texture(cbcr_type, global_flags.width / 2, global_flags.height / 2);
+
+ y_display_tex = y_copy_tex;
+ cbcr_display_tex = cbcr_copy_tex;
+
+ // y_tex and cbcr_tex will be given by VideoEncoder.