aboutsummaryrefslogtreecommitdiff
path: root/include/render/gles2.h
AgeCommit message (Collapse)Author
2022-11-15render/gles2: query glGetGraphicsResetStatusKHRSimon Ser
Call glGetGraphicsResetStatusKHR in wlr_renderer_begin to figure out when a GPU reset occurs. Destroy the renderer when this happens (the OpenGL context is defunct).
2022-10-25render/gles2: remove stale gles2_texture_from_wl_drm() prototypeSimon Ser
This function doesn't exist anymore.
2022-05-07render/gles: add support for some 16-bpc unsigned shm formatsManuel Stoeckl
These formats require EXT_texture_norm16, which in turn needs OpenGL ES 3.1. The EXT_texture_norm16 extension does not support passing gl_internalformat = GL_RGBA to glTexImage2D, as can be done for formats available in OpenGL ES 2.0, so this commit adds a field to wlr_gles2_pixel_format to provide a more specific internalformat parameter to glTexImage2D.
2021-11-17Remove support for DMA-BUF flagsSimon Ser
They are never used in practice, which makes all of our flag handling effectively dead code. Also, APIs such as KMS don't provide a good way to deal with the flags. Let's just fail the DMA-BUF import when clients provide flags.
2021-08-12render/gles2: make wlr_gles2_texture a wlr_buffer addonSimon Ser
2021-08-12render/gles2: make wlr_gles2_buffer an addonSimon Ser
Saves us from walking a list.
2021-07-30render/gles2: add a few 10-bit and FP16 formatsManuel Stoeckl
The half-float formats depend on GL_OES_texture_half_float_linear, not just the GL_OES_texture_half_float extension, because the latter does not include support for linear magni/minification filters. The new 2101010 and 16161616F formats are only available on little- endian builds, since their gl_types are larger than a byte and thus endianness dependent.
2021-07-30render/gles2: hide shm formats without GL supportManuel Stoeckl
This change introduces a new function to check whether the renderer has the needed GL extensions to read a given pixel format.
2021-07-12render/gles2: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-01render: drop wlr_renderer_impl.texture_from_dmabufSimon Ser
2021-07-01render: drop wlr_renderer_impl.texture_from_pixelsSimon Ser
2021-05-30render/gles2: fix texture cleanup on destroySimon Ser
When importing a DMA-BUF wlr_buffer as a wlr_texture, the GLES2 renderer caches the result, in case the buffer is used for texturing again in the future. When the wlr_texture is destroyed by the caller, the wlr_buffer is unref'ed, but the wlr_gles2_texture is kept around. This is fine because wlr_gles2_texture listens for wlr_buffer's destroy event to avoid any use-after-free. However, with this logic wlr_texture_destroy doesn't "really" destroy the wlr_gles2_texture. It just decrements the wlr_buffer ref'count. Each wlr_texture_destroy call must have a matching prior wlr_texture_create_from_buffer call or the ref'counting will go south. Wehn destroying the renderer, we don't want to decrement any wlr_buffer ref'count. Instead, we want to go through any cached wlr_gles2_texture and destroy our GL state. So instead of calling wlr_texture_destroy, we need to call our internal gles2_texture_destroy function. Closes: https://github.com/swaywm/wlroots/issues/2941
2021-05-17render/gles2: implement texture_from_bufferSimon Ser
Make it so wlr_gles2_texture is ref'counted (via wlr_buffer). This is similar to wlr_gles2_buffer or wlr_drm_fb work. When creating a wlr_texture from a wlr_buffer, first check if we already have a texture for the buffer. If so, increase the wlr_buffer ref'count and make sure any changes made by an external process are made visible (by invalidating the texture). When destroying a wlr_texture created from a wlr_buffer, decrease the ref'count, but keep the wlr_texture around in case the caller uses it again. When the wlr_buffer is destroyed, cleanup the wlr_texture.
2021-04-22render/gles2: destroy textures on renderer teardownSimon Ser
2021-04-08render: drop support for ellipsesSimon Ser
For anything more complicated than quads, compositors can easily ship their own shaders. Closes: https://github.com/swaywm/wlroots/issues/2759
2021-03-25render/gles2: remove depth and bpp gles2_pixel_format, use drm pixel formatSimon Zeni
2021-03-10output: improve transform matrix calculationSimon Zeni
Compute only the transform matrix in the output. The projection matrix will be calculated inside the gles2 renderer when we start rendering. The goal is to help the pixman rendering process.
2021-02-23render: use DRM formats in wlr_texture_from_pixelsSimon Ser
2021-02-23render: use DRM formats in wlr_renderer_get_shm_texture_formatsSimon 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
2020-11-15render: introduce wlr_renderer_get_drm_fdSimon 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-06-24render/gles2: use glGetAttribLocation instead of hardcoded indicesSimon Zeni
2020-06-08render: Add wlr_renderer_blit_dmabuf()Andri Yngvason
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
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-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-07-17Use -fmacro-prefix-map to strip build pathManuel Stoeckl
This commit matches sway's 2dc4978d8af326c310057ca8fd22a4c7f5d09335. To help ensure a reproducible build (when debug info is disabled), the meson build script now uses the -fmacro-prefix-map command line argument supported by GCC to strip the build-path dependent bytes of each __FILE__ string used by wlr_log and related functions. A rather ugly algorithm is used to compute the relative path between the build and source folders, because meson has no specific function for this. When the compiler does not support -fmacro-prefix-map, fall back to shifting the start of each __FILE__ string by the length of the relative path to the source directory.
2019-04-22Fix missing headers when building without X11Alyssa Ross
The deleted includes are redundant, because other headers will include the necessary files. Additionally, they cause build failures, because including EGL/egl.h or EGL/eglext.h directly, instead of through wlr/render/egl.h or wlr/render/interface.h, will mean that MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL headers will attempt to pull in unnecessary X11 headers that may not exist on the system. For the headers produced by glgen.sh, the includes couldn't simply be deleted, because no other header would include the EGL headers. Neither wlr/render/egl.h or wlr/render/interface.h felt appropriate to include, so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before the EGL includes.
2019-02-28Remove glEGLImageTargetTexture2DOESGuido Günther
It's declared via render/glapi.txt.
2018-11-04render/gles2: check for GL_OES_EGL_image_externalemersion
2018-11-04render/gles2: remove assumptions about supported formatsemersion
We were assuming GL_BGRA_EXT was always supported. We now check that it's supported for rendering. We fail if it isn't because this format is specified as "always supported" by the Wayland protocol. We also check if it's supported for reading pixels. A new preferred_read_format function returns the preferred format that can be used to read pixels. This is used by the screencopy protocol.
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-09util: add wlr_ prefix to log symbolsemersion
2018-06-13gles2 renderer: introduce struct wlr_gles2_tex_shaderNeKit
2018-06-07Fix GLES2 renderer to use glGetUniformLocations locationsNeKit
This is needed as uniform locations are driver implementation-specific.
2018-04-25Make sure we don't use others' prefixesemersion
2018-04-12Make wlr_renderer_scissor take normal coords instead of upside-down onesemersion
2018-04-01Untie wlr_gles2_renderer and wlr_gles2_textureemersion
2018-03-28Merge pull request #744 from emersion/texture-redesignTony Crisci
Redesign wlr_texture
2018-03-27render: remove GL calls from wlr_eglemersion
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.