| 957 | } |
| 958 | |
| 959 | int sws_t::convert(gl::frame_buf_t &fb) { |
| 960 | gl::ctx.BindTexture(GL_TEXTURE_2D, loaded_texture); |
| 961 | |
| 962 | GLenum attachments[] { |
| 963 | GL_COLOR_ATTACHMENT0, |
| 964 | GL_COLOR_ATTACHMENT1 |
| 965 | }; |
| 966 | |
| 967 | for (int x = 0; x < sizeof(attachments) / sizeof(decltype(attachments[0])); ++x) { |
| 968 | gl::ctx.BindFramebuffer(GL_FRAMEBUFFER, fb[x]); |
| 969 | gl::ctx.DrawBuffers(1, &attachments[x]); |
| 970 | |
| 971 | #ifndef NDEBUG |
| 972 | auto status = gl::ctx.CheckFramebufferStatus(GL_FRAMEBUFFER); |
| 973 | if (status != GL_FRAMEBUFFER_COMPLETE) { |
| 974 | BOOST_LOG(error) << "Pass "sv << x << ": CheckFramebufferStatus() --> [0x"sv << util::hex(status).to_string_view() << ']'; |
| 975 | return -1; |
| 976 | } |
| 977 | #endif |
| 978 | |
| 979 | gl::ctx.UseProgram(program[x].handle()); |
| 980 | gl::ctx.Viewport(offsetX / (x + 1), offsetY / (x + 1), out_width / (x + 1), out_height / (x + 1)); |
| 981 | gl::ctx.DrawArrays(GL_TRIANGLES, 0, 3); |
| 982 | } |
| 983 | |
| 984 | gl::ctx.BindTexture(GL_TEXTURE_2D, 0); |
| 985 | |
| 986 | gl::ctx.Flush(); |
| 987 | |
| 988 | return 0; |
| 989 | } |
| 990 | } // namespace egl |
| 991 | |
| 992 | void free_frame(AVFrame *frame) { |
nothing calls this directly
no test coverage detected