Some downstream user might want to use the very handy comp_buffer_init()
helper to create buffers, but the latter does not cover the case when
the buffer needs to be exportable for API interoperability.
Add a new comp_buffer_init_exportable() helper to cover that case, this
is done in a way that is not particularly invasive for existing users of
comp_buffer_init(), as all the logic about the exportability is handled
by the new function.
Newer wayland protocols have a new filed in xdg_toplevel_listener which
is not initialized:
-----------------------------------------------------------------------
[215/315] Building C object src/xrt/compositor/CMakeFiles/comp_main.dir/main/comp_window_wayland.c.o
.../src/xrt/compositor/main/comp_window_wayland.c:182:1: warning: missing field 'configure_bounds' initializer [-Wmissing-field-initializers]
};
^
1 warning generated.
-----------------------------------------------------------------------
Detect the version when this is needed and initialize the field to
silence the warning.
Some variables are only used in asserts, so they may be unused
depending on the build type:
-----------------------------------------------------------------------
[68/315] Building C object src/xrt/auxiliary/CMakeFiles/aux_util.dir/util/u_sink_combiner.c.o
.../src/xrt/auxiliary/util/u_sink_combiner.c:188:11: warning: unused variable 'diff_ns' [-Wunused-variable]
int64_t diff_ns = frames[0]->timestamp - frames[1]->timestamp;
^
1 warning generated.
[205/315] Building C object src/xrt/compositor/CMakeFiles/comp_main.dir/main/comp_renderer.c.o
.../src/xrt/compositor/main/comp_renderer.c:872:17: warning: unused variable 'layer_count' [-Wunused-variable]
const uint32_t layer_count = c->base.slot.layer_count;
^
1 warning generated.
-----------------------------------------------------------------------
Mark them as XRT_MAYBE_UNUSED to fix the build warnings.
The size field in comp_buffer was never assigned, and also never used as
all comp_buffer users rely on the allocation_size field.
Use the size field to store the size originally requested when creating
the buffer which could be different from the value returned in the
allocation_size field.
Having both sizes available allows a user to check if allocation_size is
in fact different from the requested size.
This also fixes two errors:
* VK_IMAGE_USAGE_SAMPLED_BIT was not always added to depth formats.
* VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT was added to image
views for sampling, where the spec only allows one of them.