MCPcopy Create free account
hub / github.com/SFML/SFML / createSurface

Method createSurface

src/SFML/Window/DRM/DRMContext.cpp:717–744  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

715
716////////////////////////////////////////////////////////////
717void DRMContext::createSurface(Vector2u size, bool scanout)
718{
719 static constexpr std::uint32_t fmt = GBM_FORMAT_ARGB8888;
720 std::uint32_t flags = GBM_BO_USE_RENDERING;
721
722 m_scanOut = scanout;
723 if (m_scanOut)
724 flags |= GBM_BO_USE_SCANOUT;
725
726 if (!gbm_device_is_format_supported(gbmDevice, fmt, flags))
727 err() << "Warning: GBM surface format not supported." << std::endl;
728
729 m_gbmSurface = gbm_surface_create(gbmDevice, size.x, size.y, fmt, flags);
730
731 if (!m_gbmSurface)
732 {
733 err() << "Failed to create gbm surface." << std::endl;
734 return;
735 }
736
737 eglCheck(
738 m_surface = eglCreateWindowSurface(m_display, m_config, reinterpret_cast<EGLNativeWindowType>(m_gbmSurface), nullptr));
739
740 if (m_surface == EGL_NO_SURFACE)
741 {
742 err() << "Failed to create EGL Surface" << std::endl;
743 }
744}
745
746
747////////////////////////////////////////////////////////////

Callers 1

processEventsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected