Before the creation of the EXT_texture_storage extension,
OES_required_internalformat used to guarantee minimal FBO and texture
precisions to OpenGL ES 1 and 2 implementations using sized internal
formats.
Note that new external format and type combinations (like for instance
GL_RGB and GL_UNSIGNED_BYTE for the GL_RGB565 sized internal format)
should be available when OES_required_internalformat is supported.
This isn't supported by this wrapper for now because of the implicit
conversion in gl_texture_2d_init() that forces a specific type when
EXT_texture_storage isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
QCOM_render_sRGB_R8_RG8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT and GL_SRG8_EXT FBO formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_sRGB_RG8 allows OpenGL ES 3 implementations to support
GL_SRG8_EXT texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_sRGB_R8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
APPLE_texture_packed_float allows OpenGL ES 2 implementations to
support GL_R11F_G11F_B10F and GL_RGB9_A5 texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
NV_packed_float allows OpenGL ES 2 implementations to support
GL_R11F_G11F_B10F FBO and texture format.
Note that GL_HALF_FLOAT should be available (the spec is a bit
confusing) as type combination with the GL_RGB external format when
both NV_packed_float and OES_texture_half_float are supported on
OpenGL ES 2. This isn't supported by this wrapper for now because of
the implicit conversion in gl_texture_2d_init() that forces a specific
type when EXT_texture_storage isn't available.
NV_packed_float_linear would require a new utility function to
retrieve whether a texture can be linearly interpolated by the texture
samplers or not. This hasn't been added for the other formats because
there's no users for now but this might be added later.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_color_buffer_float allows OpenGL ES implementations to support
GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F and
GL_R11F_G11F_B10F FBO formats. All of these are supported by default
from OpenGL ES 3.2.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OES_texture_float allows OpenGL ES 2 implementations to support
GL_R32F, GL_RG32F, GL_RGB32F and GL_RGBA32F texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OES_texture_half_float allows OpenGL ES 2 implementations to support
GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OpenGL ES 2 implementations support texture immutability and sized
internal formats using the GL_EXT_texture_storage extension.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add gl_texture_is_format_supported(), gl_texture_2d_init(),
gl_texture_2d_upload() and gl_texture_fini() utilities. The creation
function accepts all the coloured sized internal format from OpenGL ES
3 using glTexStorage2D() to create immutable textures and reduce API
overhead.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Validate the colour-renderable sized internal formats passed to
gl_fbo_init() using a new gl_fbo_is_format_supported() utility. Sized
internal formats are now required. More formats will progressively be
added depending on the OpenGL ES version and the supported extensions.
Support for RGBA8 FBOs is now required by the GL renderer.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Avoid duplicating the inclusion of the GLES headers by including them
once in gl-renderer-internal.h.
Upgrade GLES3 header to gl32.h.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
These utility functions are used (or will be used) in different source
files. This prevents gl-renderer.c from growing too much (the coming
texture utilities are quite verbose) by moving generic functions out.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Next commits will add support for a bunch of extensions. The extension
flag enumeration is sorted alhpabetically. This commit makes some
space for the coming flags and presets the current values in order to
avoid useless diff lines and ease code review.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.
This reverts commit 8634c7e349.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This flag ensures support for both the GL_ANDROID_native_fence_sync
and the GL_EXT_disjoint_timer_query extensions at run-time. The GL
features log now reports that flag so the warning log has been
removed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Storing GL function pointers along with their associated extension
name allows to better track the function pointers declared.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Now that the GL extensions are stored in the gl_extensions bitfield,
there's no need to use booleans anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit ensures GL_OES_EGL_image is available before setting up
dma-buf renderer functions because it's not implied by the presence of
the EGL_EXT_image_dma_buf_import extension.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
GL_OES_texture_3D isn't used because of the complexity implied for
correct OpenGL ES 2 support (see commit 734c2278), so there's no need
to check for it. The check also now avoids checking for
GL_EXT_color_buffer_half_float on OpenGL ES 3.2 which includes support
for 16-bit FP renderbuffers by default.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The GL renderer supports OpenGL ES from version 2.0 to 3.2. It's meant
to correctly link on systems with only OpenGL ES 2, so OpenGL ES 3
symbols can't be used directly. eglGetProcAddress() is currently
defined to not support the querying of non-extension OpenGL ES
functions. Support for that is exposed by the
KHR_get_all_proc_addresses extension. This commit ensures OpenGL ES 3
function addresses can be retrieved by eglGetProcAddress() by checking
for that extension at run-time.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new gl_extensions bitfield is added to the renderer to store the
flags supported by the GL implementation. This allows the GL renderer
to easily check for extension support whenever needed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Get the EGL_WL_bind_wayland_display extension function addresses after
checking for extension availability.
Let the EGL display setup end before trying to bind the Wayland
display in gl-renderer.c. The EGL features log will now report the
extension as supported even if the bind subsequently fails, in which
case a warning is logged.
This commit also avoids calling query_buffer() if the display isn't
bound in fill_buffer_info(), it would otherwise fail or even segfault
if the EGL_WL_bind_wayland_display extension isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This feature flag is for explicit sync support.
We replace the explicit sync warning by logging supported fence syncs
along with the report EGL features report.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Get eglCreateImageKHR() and eglDestroyImageKHR() function addresses
depending on EGL_KHR_image_base availability.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This second feature flag ensures that either the
EGL_EXT_swap_buffers_with_damage or EGL_EXT_swap_buffers_with_damage
extension is available.
Some function pointer addresses are currently retrieved depending on
the availabilty of their associated extension and some others are
retrieved unconditionally. For consistency reasons, we'll try from now
on in this commit set to first load function pointers depending on the
associated extension availability and then flag features once all the
addresses are retrieved.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit introduces feature flags. While an extension flag only
ensures the availability of an extension at run-time, a feature flag
ensures the availability of a minimal OpenGL ES version and/or
extensions in order to easily check for the availability of a specific
feature at run-time.
This first feature ensures the availability of either the
EGL_KHR_no_config_context or EGL_MESA_configless_context extensions.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new GET_PROC_ADDRESS() macro is added to get a function address at
run-time using eglGetProcAddress() and to assert() the address isn't
NULL at once.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Storing EGL function pointers along with their associated extension
name allows to better track the function pointers declared.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Now that the EGL extensions are stored in the egl_*_extensions
bitfields, there's no need to use booleans anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The egl_display_extensions bitfield is added to store the display
extensions supported by the EGL implementation.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The egl_device_extensions bitfield is added to store the device
extensions supported by the EGL implementation.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new egl_client_extensions bitfield is added to the renderer to store
the client flags supported by the EGL implementation. This allows the
GL renderer to easily check for extension support whenever needed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This new utility parses extension strings and fills a bitfield of
matched flags. This will be used to store EGL and GL extension flags.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.
With this change windowed-output-api.h also includes the helpers header.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Revert active unit to default value right after use so that other
functions can assume the default state. A best practices section is
added to the internal header for reference.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Provide a fixed allocation to each texture unit in order to prevent
conflicts. This fixes a conflict between colour transforms and the
wireframe debug mode.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The GL renderer is able to use a gbm_device to allocate gbm_bos, which can be
used as DMABUFs.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Support importing dmabuf buffers as renderbuffers and binding them to
FBOs. These can then be rendered to directly, or they can be blitted
into from the shadow render buffer.
How to best create those dmabuf buffers in the backend is an open
question and may vary depending on what external API the backend is
interfacing with.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The batches debug mode tints each batch of a repaint pass in a
different color in order to highlight batches.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The wireframe debug mode needs to clear the current renderbuffer in
order to clean up old wireframes lying around. This commit makes this
system generic for upcoming debug modes with similar needs.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
In order to avoid the complexity of handling multiple debug modes at
the same time, this commit makes wireframe a proper debug mode. It
also uses the new tinting system to make the white wireframe pop over
a darkened damaged region.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>