MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / choose_format

Function choose_format

src/render.cpp:79–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static const wlr_drm_format *choose_format(wlr_renderer *renderer, wf::buffer_allocation_hints_t hints)
80{
81 auto supported_render_formats =
82 wlr_renderer_get_texture_formats(wf::get_core().renderer, renderer->render_buffer_caps);
83
84 // FIXME: in the wlroots vulkan renderer, we need to have SRGB writing support for optimal performance.
85 // The issue is that not all modifiers support SRGB. Until the wlroots issue
86 // (https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3986) is fixed, we need to somehow filter out
87 // formats that don't support SRGB. Simplest way is to patch wlroots as indicated in the issue.
88 if (renderer->WLR_PRIVATE.impl->get_render_formats)
89 {
90 static bool initialized = false;
91 static wlr_drm_format_set performant_formats{};
92 if (!initialized)
93 {
94 auto render_fmts = renderer->WLR_PRIVATE.impl->get_render_formats(renderer);
95 wlr_drm_format_set_intersect(&performant_formats, supported_render_formats, render_fmts);
96 }
97
98 if (auto format = choose_format_from_set(&performant_formats, hints))
99 {
100 return format;
101 }
102 }
103
104 return choose_format_from_set(supported_render_formats, hints);
105}
106
107static wf::dimensions_t sanitize_buffer_size(wf::dimensions_t size, float max_allowed_size)
108{

Callers 1

allocateMethod · 0.85

Calls 1

choose_format_from_setFunction · 0.85

Tested by

no test coverage detected