Fails. Problem spotted on WebGL 2 and is an unfortunate consequence of
these events:
1. Neither EXT_DSA nor ARB_DSA is available, but VAOs are available,
which means virtually all ES 3 and WebGL 2 implementations and also
ES 2 / WebGL 1 with OES_VAO available.
2. Index buffer gets created with TargetHint::ElementArray, bound to
GL_ELEMENT_ARRAY_BUFFER and filled with data.
3. Mesh object with VAO inside is created and the index buffer from
above gets bound to GL_ELEMENT_ARRAY_BUFFER again to attach it to the
VAO.
4. Another index buffer, possibly for another mesh, gets created with
TargetHint::ElementArray and bound to GL_ELEMENT_ARRAY_BUFFER in
order to be filled with data. But because the VAO from above is still
bound, the index buffer attachment is then stomped on.
5. Rendering such mesh will use a different index buffer, most probably
causing some out-of-range GL error and nothing rendered.
* SDL2 is now a system package, no need to build it manually
* GLFW needs a bunch of new dependencies
* Android needs to use 12.04 and so we download proper CMake manually
(the one from kubuntu-backports doesn't work yet)
* Enabled ES3 build on Linux as all the symbols are now there
SVGA3D has broken handling of glTex[ture][Sub]Image*D() for 1D arrays,
2D arrays, 3D textures and cube map textures where it uploads just the
first slice in the last dimension. This is only with copies from host
memory, not with buffer images. Seems to be fixed in Mesa 13, but I have
no such system to verify that on. Relevant commit in the Mesa sources:
2aa9ff0cda
This is one of the uglier workarounds -- I had to reintroduce multiple
code paths for glTexImage() which were removed when implementing ARB_DSA
and the workaround consists of basically a bunch of functions that are
slicing the image and calling the original implementations with each
slice.
For some reason a buffer *allocated* with this function caused
Mesh::draw() to draw nothing. I gave up on investigating the root cause
-- using non-DSA glBufferData() "just works", so in case of this driver
the "svga3d-broken-dsa-bufferdata" workaround uses the non-DSA code
path.
DetectedDriver::AMD is now DetectedDriver::Amd,
DetectedDriver::ProbablyAngle is now just DetectedDriver::Angle. The old
names are still present, but deprecated and will be removed in the
future.
The GL queries are needed only if the user-provided pixel storage
doesn't contain enough information, in particular dimensions and byte
size of compression block.
So in case they are present, no query for compressed image size is done
for full image queries (just saving one API call) and no queries for
block dimensions and byte size for subimage queries (saving four API
calls and not requiring ARB_internalformat_query2).
The documentation was fixed and tests were updated to take the
ARB_internalformat_query2 requirement into account.
There were various issues with the tests at the moment:
* In order to test non-default pixel storage parameters, out-of-bound
array slices were passed to GL functions. That of course cause ASan
to complain (and maybe also some drivers to crash).
* Only the non-default pixel storage parameters were tested.
Unfortunately this is a heavily buggy area in all the drivers, so
when such a test failed, it was not immediately clear whether the
failure is related just to driver not understanding pixel storage
properly or something deeper and made debugging much much harder than
it should be.
* For compressed textures, default and non-default pixel storage has
grossly different code paths and these should be tested both by
default.
* Some test cases had a patched-in code testing for both default and
non-default pixel storage, but the code was so hidden that I didn't
even know it was there -- it should be separate test cases.
All the tests are now instanced, testing both the simple case and
some pixel storage case, they are also reordered and cleaned up a bit.
For some reason I thought it's size of one face pre-ARB_DSA and size of
all six faces on ARB_DSA. NVidia drivers (which return different size
based on whether the texture is immutable, which is totally crazy)
didn't help with that at all. Now I realized this while fixing test
failures on Mesa. IIRC I couldn't find a clear explanation in the spec
anyway, so I'll just bite the bullet and assume *this* is the correct
way now. Mesa tests now pass instead of saying that my provided buffer
size is too small.