aboutsummaryrefslogtreecommitdiff
path: root/render/gles2/texture.c
AgeCommit message (Collapse)Author
2021-04-22render: remove NULL checks in wlr_texture_impl.destroySimon Ser
The NULL check already exists in wlr_texture_destroy, no need to duplicate it in each impl
2021-04-22render/gles2: destroy textures on renderer teardownSimon Ser
2021-04-15render/gles2: prevent imported DMA-BUF textures from being mutatedSimon Ser
The compositor shouldn't write to client buffers if the client attaches a DMA-BUF to a wl_surface, then attaches a shm buffer. Make gles2_texture_write_pixels return an error to prevent this from happening.
2021-04-08render: remove wlr_texture_to_dmabufSimon Ser
This is unused in wlroots, and the use-cases for compositors are pretty niche since they can access the original DMA-BUF via the wlr_buffer.
2021-03-25render/gles2: remove depth and bpp gles2_pixel_format, use drm pixel formatSimon Zeni
2021-02-23render: use DRM formats in wlr_texture_from_pixelsSimon Ser
2021-02-23render/gles2: replace wlr_gles2_texture.wl_format with drm_formatSimon Ser
2021-02-23render/gles2: convert format table to DRM formatsSimon Ser
2021-02-19render/gles2: check buffer stride when uploading textureSimon Ser
If the stride is too small, the driver could end up segfaulting (e.g. radeonsi segfaults in __memmove_sse2_unaligned_erms).
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-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-12render/egl: remove surface and buffer age args from make_currentSimon Ser
These aren't used anymore.
2020-12-15render/gles2: require GL_EXT_unpack_subimageSimon Ser
We implicitly depended on this extension.
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-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-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-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-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-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-01-29Require libdrm >= 2.4.95emersion
2018-10-16Use enum wl_shm_format for gles2 texture formatsnyorain
Also rephrase the write_pixels comment.
2018-10-15Remove fmt parameter from wlr_texture_write_pixelsnyorain
It's not allowed to change the format of a texture so remove the confusing parameter.
2018-08-03gles2: change context when it is not currentMariusz Bialonczyk
Texture functions, that create and manipulate textures should switch the current context if necessary. thanks to: @emersion Fixes #934
2018-07-12render: add wlr_texture_is_opaqueemersion
2018-07-09util: add wlr_ prefix to log symbolsemersion
2018-06-17Merge branch 'master' into screencontentemersion
2018-06-09Rename egl.exts to match the extension namesVincent Vanlaer
2018-06-08render/egl: only request high priority context on DRMemersion
2018-05-31Merge branch 'master' into screencontentemersion
2018-05-30render: remove wlr_renderer_check_import_dmabufemersion
It's possible to implement it outside the renderer, by creating a texture and destroying it right away. This reduces the API surface of the renderer.
2018-05-30Only allow one modifier per DMA-BUF, split attributes struct in render/emersion
2018-05-29render: add wlr_texture_to_dmabufemersion
2018-04-25Make sure we don't use others' prefixesemersion
2018-04-25render/egl: allow passing NULL to surface and image destructorsemersion
2018-04-01Untie wlr_gles2_renderer and wlr_gles2_textureemersion
2018-03-31render/egl: add wlr_egl_create_image_from_wl_drmemersion
This allows external renderers and potential future GL-based renderers to re-use this function.
2018-03-24Redesign wlr_textureemersion
- Textures are now immutable (apart from those created from raw pixels), no more invalid textures - Move all wl_drm stuff in wlr_renderer - Most of wlr_texture fields are now private - Remove some duplicated DMA-BUF code in the DRM backend - Add more assertions - Stride is now always given as bytes rather than pixels - Drop wl_shm functions Fun fact: this patch has been written 10,000 meters up in the air.
2018-03-23linux-dmabuf: Support multi plane formats like NV12Guido Günther
2018-03-23Merge branch 'master' into gles2-renderer-redesignemersion
2018-03-21render/egl: use EGL_KHR_debugemersion
2018-03-20render/gles2: remove global state, use OpenGL debug extensionemersion
2018-03-20gles2_texture_bind: use texture's target typeGuido Günther
Hardcoding GL_TEXTURE_2D leads to rendering errors when using GL_TEXTURE_EXTERNAL_OES textures.