MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / convert

Method convert

src/platform/linux/graphics.cpp:959–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
992void free_frame(AVFrame *frame) {

Callers

nothing calls this directly

Calls 3

hexFunction · 0.85
to_string_viewMethod · 0.80
handleMethod · 0.80

Tested by

no test coverage detected