aboutsummaryrefslogtreecommitdiff
path: root/render/gles2
AgeCommit message (Collapse)Author
2021-02-05render/gles2: remove YUV blocklistSimon Ser
Mesa provides YUV shaders, and can import multi-planar YUV DMA-BUFs as a single EGLImage. Remove the arbitrary limitation. If the driver doesn't support importing YUV as a single EGLImage, the import will fail and the result will be the same anyways.
2021-02-01render/wlr_texture: clamp texture coordinates to edge by defaultQuantum
Clamping texture coordinates prevents OpenGL from blending the left and right edge (or top and bottom edge) when scaling textures with GL_LINEAR filtering. This prevents visual artifacts like swaywm/sway#5809. Per discussion on IRC, this behaviour is made default. Compositors that want the wrapping behaviour (e.g. for tiled patterns) can override this by doing: struct wlr_gles2_texture_attribs attribs; wlr_gles2_texture_get_attribs(texture, &attribs); glBindTexture(attribs.target, attribs.tex); glTexParameteri(attribs.target, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(attribs.target, GL_TEXTURE_WRAP_T, GL_REPEAT); glBindTexture(attribs.target, 0);
2021-01-29render/egl: remove *config_attribs and wlr_egl->configBrandon Dowdy
Breaking changes: Both "EGLint *config_attribs" and "wlr_egl->config" no longer exist.
2021-01-16render/gles2: make EGL context current in bind_bufferSimon Ser
Instead of requiring callers to manually make the EGL context current before binding a buffer and unsetting it after unbinding a buffer, do it inside wlr_renderer_bind_buffer. This hides renderer-specific implementation details inside the wlr_renderer interface. Non-GLES2 renderers may not use EGL. This removes all EGL dependencies from the backends. References: https://github.com/swaywm/wlroots/issues/2618 References: https://github.com/swaywm/wlroots/pull/2615#issuecomment-756687006
2021-01-15render: extract gles2 build files to subdirSimon Ser
This will make it easier to toggle when we make our GLES2 renderer optional.
2021-01-15render/gles2: restore EGL context after texture operationsSimon Ser
It can be surprising and unexpected that texture operations (such as texture upload and import) change the current EGL context, especially when it's done under-the-hood by wlroots in response to wl_surface requests. To prevent surprises, save and restore the previous EGL context.
2021-01-14render/gles2: save/restore EGL context in destroy_bufferSimon Ser
It can be surprising that destroying a buffer changes the EGL context, especially since this can be triggered from anywhere wlr_buffer_unlock is called. Prevent this from happening by saving and restoring the EGL context.
2021-01-12render/egl: remove surface and buffer age args from make_currentSimon Ser
These aren't used anymore.
2021-01-12render/egl: replace init/finish with create/destroySimon Ser
This ensures wlr_gles2_renderer can properly take ownership of the wlr_egl. Closes: https://github.com/swaywm/wlroots/issues/2612
2021-01-12render/gles2: fix EGL use-after-freeSimon Ser
The wlr_egl was cleaned up too early. While at it, also fix a memory leak. Fixes: b899a412e3eb ("backend: remove wlr_egl from all backends")
2021-01-07backend: remove wlr_egl from all backendsSimon Zeni
2020-12-15render/gles2: require GL_EXT_unpack_subimageSimon Ser
We implicitly depended on this extension.
2020-12-09render/gles2: query alpha size from render bufferSimon Ser
If we're using a render buffer, query the alpha size from it. Closes: https://github.com/swaywm/wlroots/issues/2527
2020-12-09render/gles2: don't eglGetConfigAttrib on EGL_NO_CONFIG_KHRSimon Ser
If we don't have an EGL config, don't try to query anything from it.
2020-11-30render: rename wlr_renderer_get_formatsSimon Ser
Rename wlr_renderer_get_formats to wlr_renderer_get_shm_texture_formats. This makes it clear those formats are only suitable for shm import.
2020-11-30render: rename wlr_renderer_get_dmabuf_formatsSimon Ser
Rename wlr_renderer_get_dmabuf_formats to wlr_renderer_get_dmabuf_texture_formats. This makes it clear the formats are only suitable for creating wlr_textures.
2020-11-30render: introduce wlr_renderer_get_dmabuf_render_formatsSimon Ser
It describes which DMA-BUF formats can be used to render.
2020-11-30render: remove wlr_renderer_format_supportedSimon Ser
Instead, callers can just use wlr_renderer_get_formats and iterate over the list. This function was unused in wlroots.
2020-11-15render: introduce wlr_renderer_get_drm_fdSimon Ser
2020-11-15render/gles2: fix y-inverted output when rendering to bufferSimon Ser
2020-11-15render/gles2: implement wlr_renderer_bind_bufferSimon Ser
2020-07-28render/gles2: remove gles2_procsSimon Ser
Move the global into wlr_gles2_renderer. This removes global state and allows us to have multiple renderers with different GL loaders.
2020-07-28render/gles2: make push/pop debug functions take a wlr_rendererSimon Ser
2020-07-28render/gles2: keep ref to wlr_gles2_renderer in wlr_gles2_textureSimon Ser
2020-07-28render/gles2: make wlr_gles2_texture_from_* privateSimon Ser
These functions are unused by compositors (see e.g. [1]) and prevent wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an issue for proper teardown [2] and for accessing GLES2 extensions. [1]: https://github.com/swaywm/wlroots/pull/1962#issuecomment-569511830 [2]: https://github.com/swaywm/wlroots/pull/1962
2020-07-01render: gles2: Fix y-inversion in gles2_blit_dmabuf()Andri Yngvason
2020-06-24render/gles2: use glGetAttribLocation instead of hardcoded indicesSimon Zeni
2020-06-17render: add wlr_render_subtexture_with_matrixSimon Ser
This renders only a subset of the texture, instead of the full texture.
2020-06-17render/gles2: use .x/.y instead of .s/.tSimon Ser
texcoord is a vector of coordinates, with the first member being the X axis value and the second member being the Y axis value. It makes more sense to use the accessors with the same names.
2020-06-08render: Fix blit_dmabuf() breakage due to API changeAndri Yngvason
2020-06-08render: Add wlr_renderer_blit_dmabuf()Andri Yngvason
2020-06-06render: choose DMA-BUF texture target via eglQueryDmaBufModifiersEXTSimon Ser
EGL_EXT_image_dma_buf_import_modifiers tells us whether we should use GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES. Using the right texture target can fix some failures and/or improve performance on some drivers. This does the same as a Weston commit [1]. [1]: https://gitlab.freedesktop.org/wayland/weston/commit/40c519a3e613 Closes: https://github.com/swaywm/wlroots/issues/2173
2020-06-02render: stop making EGL context current in wlr_egl_initSimon Ser
This leaves an EGL context current behind. wlr_gles2_renderer_create was assuming the EGL context was already current because of this (because it called a GL function right off the bat).
2020-05-19render/egl: introduce wlr_egl_unset_currentSimon Ser
This function can be called after wlr_egl_make_current to cleanup the EGL context. This avoids having lingering EGL contexts that make things work by chance. Closes: https://github.com/swaywm/wlroots/issues/2197
2020-04-28render/texture: add width and height fieldsSimon Ser
Instead of requiring compositors to call wlr_texture_get_size each time they want to access the texture's size, expose this information as wlr_texture fields.
2020-04-22render/gles2: add wlr_gles2_renderer_check_extSimon Ser
2020-04-09render: only expose linux-dmabuf if EGL extension is supportedSimon Ser
Only expose linux-dmabuf extension if EGL_EXT_image_dmabuf_import_ext is supported. Closes: https://github.com/swaywm/wlroots/issues/2076
2020-04-09render/gles2: only call wlr_egl_bind_display if supportedSimon Ser
This allows us to hard-fail if the extension is advertised but we fail to enable it.
2020-03-23Return failure of wlr_renderer_init_wl_display()Isaac Freund
This makes it easier for the user of this library to properly handle failure of this function. The signature of wlr_renderer_impl.init_wl_display was also modified to allow for proper error propagation.
2020-03-09render/gles2: remove duplicated format listSimon Ser
2020-01-13render/gles2: unbind textures after useSimon Ser
Keeping textures bound results in hard-to-debug situations where some GL operations incorrectly affect the texture.
2019-12-20Refactor EGL/GL API loadingSimon Ser
Remove glapi.sh code generation, replace it with hand-written loading code that checks extension strings before calling eglGetProcAddress. The GLES2 renderer still uses global state because of: - {PUSH,POP}_GLES2_DEBUG macros - wlr_gles2_texture_from_* taking a wlr_egl instead of the renderer
2019-11-26render/gles2: do not set GL_TEXTURE_MAG_FILTERRonan Pigott
2019-11-20Add -Wmissing-prototypesSimon Ser
This requires functions without a prototype definition to be static. This allows to detect dead code, export less symbols and put shared functions in headers.
2019-11-11Introduce wlr_renderer_get_eglDrew DeVault
2019-11-07render/gles2: provide public API to access GL textureSimon Ser
Prior to this commit, compositors needed to render the texture to an intermediate off-screen buffer using wlr_renderer APIs if they wanted to use a custom rendering path (e.g. render to a 3D scene). A new wlr_gles2_texture_get_attribs exposes the GL texture target and ID so that compositors can render wlr_textures with their own shaders. An example of a compositor doing so is available at [1]. [1]: https://git.sr.ht/~sircmpwn/wxrc/tree/3db905b7842ac42cf1878876e647005b41f00a52/src/render.c#L227
2019-11-06render/gles: Simplify textures a bitScott Anderson
We don't need our own enum for types. Instead we just use GL_TEXTURE_{2D,EXTERNAL_OES}, which already describes usage. Also fixes a situation where we were using GL_TEXTURE_2D in a situation we should not have. wl_drm buffers are always GL_TEXTURE_EXTERNAL_OES, no matter if they're RGB or any other format.
2019-10-16render/gles2: don't unset the current EGL surface when destroying textureSimon Ser
When a texture is destroyed between wlr_egl_make_current and wlr_egl_swap_buffers, it resets the current EGL surface to NULL. This makes wlr_egl_swap_buffers fail. If the EGL context is already current, there's no need to reset it.
2019-08-31render/gles2: fix calculation for partial gles2 pixel read (#1809)Filip Sandborg
2019-05-07render/gles2: print GL_RENDERERSimon Ser
This is often the name of the GPU and can help debugging graphics issues.