Minimal updates (just the include guards) so Git is hopefully able to
detect the rename and track the history properly.
Everything except Magnum::GL doesn't compile now.
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.
There will be numerous additions to this one so it made sense to make it
a static library instead of a header-only library. That also allows
CMake users to just link to Magnum::OpenGLTester instead of going
through the pain of a huge branching in order to find a correct
windowless application just to run their tests. It could have been done
even without the static library using a INTERFACE target, but that
wouldn't work on CMake < 3.0 (which, unfortunately, quite a few people
are still stuck with).
Unfortunately it's already heavily used elsewhere so I had to go through
the pain of deprecating the old implementation. The old implementation
was header-only so it can't be just typedef'd to the new one as there
would be linker failures. So the old header is just kept as it was, with
only the macros reduced.
103% of use cases use the returned value directly without checking, so
we might as well do the check ourselves. Added new function hasCurrent()
and added deprecated backward-compatibility conversion and -> operators.
Wow, that creeped to a lot of places.
Last dinosaur from the pointer age.
Pain and misery. Majority of functionality for 3D compressed images now
suddenly fails the test -- this is either very vaguely specified or I am
very bad at understanding things or there are bugs in my NVidia drivers.
This was awful feature. Kill me now.
Yeah, sorry, I know, the enums are renamed for second or third time in a
row, first they were Image::Format, then ImageFormat, then ColorFormat
and now PixelFormat. But this time it's final and last time they are
renamed and now everything is finally consistent:
* ColorFormat::DepthComponent -- depth is not a color, thus
PixelFormat::DepthComponent makes a lot more sense.
* There will be PixelStorage classes, which will be stored in images
alonside PixelFormat/PixelType enums, making everything nicely
aligned.
* The GL documentation about glTexImage2D() etc. denotes the <format>
and <type> parameters as format and type of *pixel* data, so now we
are _finally_ consistent with the official naming.
I wonder why did I not choose PixelFormat originally. Anyway, the old
<Magnum/ColorFormat.h> header, ColorFormat, ColorType and
CompressedColorFormat types are now aliases to the new ones, are marked
as deprecated and will be removed in some future release (as always, I'm
waiting at least six months before removing the deprecated
functionality).
Apart from different include (<Magnum/Math/Color.h> instead of
<Magnum/Color.h>) there shouldn't be any visible change to the user. The
BasicColor3 and BasicColor4 classes are now Math::Color3 and
Math::Color4. The Color3, Color4, Color3ub and Color4ub typedefs in
Magnum namespace stayed the same.
BasicColor3 and BasicColor4 is now an alias to Math::Color3 and
Math::Color4, is marked as deprecated and will be removed in future
release. The same goes for the <Magnum/Color.h> include, which now just
includes the <Magnum/Math/Color.h> header.
With pixel pack/unpack support it will be possible to create views onto
sub-images, renamed the class to reflect that.
The old Magnum/ImageReference.h and ImageReference types are now aliases
to ImageView.h and ImageView types, are marked as deprecated and will be
removed in future release.
Similarly to what's now done with NoInit tags for Containers::Array and
all math types such as Vector, there's now NoCreate tag for creating
wrappers without actually creating the underlying OpenGL object. The
instance is then equivalent to moved-from state. Useful to avoid
needless creation/deletion of OpenGL object in case you would overwrite
the instance later anyway:
Mesh mesh{NoCreate};
std::unique_ptr<Buffer> indices, vertices;
std::tie(mesh, indices, vertices) = MeshTools:compile(...);
I wanted to preserve the parameter-less constructor of tests, but WINAPI
requires fairly ugly entagled set of functions, passing HWND around,
which required storing it in a global var and hoping it is properly
initialized when querying it for it to be passed to application
constructor.
When this was done, it was now fairly easy to support passing also
argv/argc to application constructor, which in the future will enable
selective disabling of extensions for even better test coverage.
This however needed slightly different main() function and thus we now
have MAGNUM_GL_TEST_MAIN() instead of CORRADE_TEST_MAIN(). Using the
latter will result in an assert inside std::optional.
Similar to Framebuffer::read(), it's now possible to get texture image
also in single statement:
Image2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte});
in comparison to the previous way:
Image2D image{ColorFormat::RGBA, ColorType::UnsignedByte};
texture.image(0, image);
The previous way is still kept in the API and not deprecated, as it
might be more usable in some cases.
As glGen*() only reserves object name without creating it, it must be
ensured that the object is created before calling functions which expect
already created object (such as glObjectLabel() or glBindTextures()).
Allows me to remove quite a lot hacks in the tests.
With ARB_multi_bind it is needed to associate the texture with some
target before calling glBindTextures(), otherwise the texture is
treated as invalid.