What this changes:
* Before, a Version::GLES310 shader was created with `#version 450`
directive, which is wrong, because an implementation might support
GLES 3.1 but not GL 4.5 so this was not working and also the syntax
is a bit different so this wasn't helpful at all.
* Similarly, Context::isVersionSupported(Version::GLES310) was checking
for support of OpenGL 4.5. Now it just checks for
`ARB_ES3_1_compatibility` extension.
* Added a small isVersionES() utility that just tells whether given
version is ES or not.
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.
Added `--magnum-disable-extensions` option next to the already existing
`--magnum-disable-workarounds`. Specified extensions are not used
automatically and also report as disabled and unsupported when asked using
Context::isExtensionSupported() and Context::isExtensionDisabled().
The engine can now list all driver workarounds that were used during the
initialization. Any listed workaround can then be disabled from the
command-line using `--magnum-disable-workarounds` command-line
parameter. The disabling and querying API is private and undocumented,
because the driver workarounds should be disabled only by end-users and
not application developers. The workaround list is now empty, but will
be filled up in the following commits and the workarounds will be
probably documented only privately in Implementation/driverSpecific.hpp,
as it is really something that should be used only to debug driver
problems.
The parameterless Platform::Context::Context() constructor and
Platform::Context::tryCreate() function are deprecated in favor
functions that take argc/argv pair. The Context class now accepts
arguments starting with --magnum-* prefix. Currently there are none
except for the implicit --magnum-help, but that will change with the
following commits.
In some cases the GL context creation might success without error, but
the created version is one that we don't want (e.g. software GDI
rasterizer on Windows). Previously the Context class constructor just
exited the application and it was impossible to react on that from the
application side (for example reducing some context feature
requirements).
Now there is Platform::Context::tryCreate(), which returns either
created instance or `nullptr` if the instance creation failed with some
error. That is now used in all Platform::*Application implementations.
ES 2.0 extensions to match ES3/desktop functionality. The enums from
NV_pack_subimage are not available in gl.xml from Khronos, I would need
to use hardcoded value.
Just added them to the list, nothing integrated or implemented yet. Also
added some more stuff into OpenGL mapping table, as I apparently forgot
some entries.
Useful in this case:
std::optional<Platform::Context> context;
context = Platform::Context{};
This was currently possible only with calling context.emplace(), which
in my opinion is confusing and looks like a no-op. Move assignment is
still not allowed, because having two separate state trackers (and
deleting one of them) currently makes no sense.
It is superseded by core functionality. The only annoyance is that you
need to use TextureFormat::SRGB in ES2 and TextureFormat::SRGB8 in ES3,
but that's with many other formats anyway. Also apparently the unsized
format is still allowed in core desktop GL, which is a shame.
For more clarity it's now better to explicitly list all extensions for
each API even though they might get duplicated. For WebGL they also link
to WebGL spec, which might contain a bit more info.
It doesn't make any sense -- WebGL 2 doesn't provide any equivalent
functionality for this and so I don't even know what values should this
return (3.0? 2.0?). Instead I just check for "WebGL 2" string prefix and
treat it as ES 3.0.
This was the actual problem. Most of ES extensions are not available in
WebGL, thus the GL headers and the code was far more bloated than it
needed to be. The GL header is now reduced and the previous 13 commits
were disabling features that aren't actually available in WebGL.
The final executable size is reduced by ~50 kB, which actually isn't
much, but still something.
Some ES extensions (ANGLE_depth_texture and ANGLE_instanced_arrays) have
now WEBGL_* prefix. I'm still using the original prefix in the
implementation because there are headers for these, but in public docs
and elsewhere they are exposed with WEBGL_*.
In OpenGL ES 2.0 there is EXT_draw_buffers, which I overlooked somehow,
so I added it to extension list and included in the implementation. It
combines NV_draw_buffers and NV_fbo_color_attachments, so the
implementation now selects one of the two based on which extension is
supported, preferring the EXT one. Updated the documentation to be
less confusing, fixed extension links. Also the single-output
mapForDraw() is not handled separately on ES anymore and just calls
DrawBuffers implementation with single parameter, resulting in less
generated code.
EXT_draw_buffers can also be called on default framebuffer and
apparently in ES there is no way to map front framebuffer for drawing,
so I removed it from the DefaultFramebuffer::DrawAttachment enum.
Full support for EXT_transform_feedback, transform feedback objects
from ARB_transform_feedback2 and equivalent OpenGL ES 3.0 functionality.
Example usage is in src/Magnum/Test/TransformFeedbackGLTest.cpp, I'll
add some example later.
According to reports on delphigl.de this extension is far more supported
in comparison to the NV version (and also there's much less FF cruft in
the specification).