Each backend's are final and called by the backend in use; the Null
backend uses the base classes, which count nothing. Bounding box values
are read into and written from the caller's arrays, and GL's queries
are one class for each kind of query object.
OGLBoundingBox::Read calls glMemoryBarrier on the non-GLES path, but that entry
point comes from ARB_shader_image_load_store. On a desktop context below GL 4.2
the pointer is null, while bSupportsBBox can still be true because it is set
from bSupportsFragmentStoresAndAtomics. Saving a state reads the bounding box
and calls the null pointer.
Add bSupportsImageLoadStore to the condition, the same check
UsePersistentStagingBuffers() in OGLTexture.cpp already uses for that function.
Drivers without it fall to the glMapBufferRange path below.
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
We also need to ensure the the CPU does not receive stale values
which have been updated by the GPU. Apparently the buffer here
is not coherent on NVIDIA drivers. Not sure if this is a driver
bug/spec violation or not, one would think that
glGetBufferSubData() would invalidate any caches as needed, but
this path is only used on NVIDIA anyway, so it's fine. A point
to note is that according to ARB_debug_report, it's moved from
video to host memory, which would explain why it needs the
cache invalidate.