3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2026-02-10 10:25:44 +00:00
Commit Graph

43 Commits

Author SHA1 Message Date
918e2bb9be renderer/gl: add internal gl formats and reduce internal driver format conversions (#12879)
* format: add internal formats for drm formats

cross referenced with weston and added internal formats and types for a
lot of missing ones. also added a isFormatYUV helper.

* framebuffer: ensure we use right internalformat

ensure we use the right internal format to avoid internal driver
blitting, also since we only attach the GL_STENCIL_ATTACHMENT we might
just aswell only use the GL_STENCIL_INDEX8 to not confuse drivers that
we want a depth aswell.

* texture: use external on yuv or non linear mods

using external makes us use the gpu's internal detiler.
and this is makes intel a lot happier then having to format convert it
to a linear format internally.

* shaders: add external support to CM frag

add external support to CM frag, and correct ext.frag typo.

* formats: remove duplicates and fix a typo in cm.frag

remove duplicate formats and a typo in cm.frag

* formats: add swizzle logic to all formats

add swizzle logic from weston for all formats and use it in shm texture
paths.

* format: more format changes

use monitor drm format instead of forcing something different.

* shader: remove external from cm.frag

drivers want this resolved at compiletime cant use both
samplerExternalOES and sampler2d and then runtime branch it.

* screencopy: swizzle textures in screencopy

swizzle textures in screencopy, to get the right colors when copying.

* screencopy: restore old behaviour

try restore old behaviour before the gles3 format changes.
glReadPixels had the wrong format, so i went to far trying to mitigate
it. should be like before now.
2026-01-07 19:53:42 +01:00
6fce2d7288 renderer/opengl: invalidate intermediate FBs post render, avoid stencil if possible (#12848) 2026-01-05 22:37:54 +01:00
0b3b012817 framebuffer: revert viewport (#12842)
to much stuff are relying on the viewport being set like this, just
revert it to not regress further. this needs a overhaul.
2026-01-04 11:44:19 +01:00
17bc3b83db renderer/fb: dont forget to set m_drmFormat (#12833)
fab3370 accidently removed the setting of m_drmFormat, causing it to
think format changed on each alloc.
2026-01-03 16:48:43 +01:00
fab3370254 renderer: minor framebuffer and renderbuffer changes (#12831)
* framebuffer: dont release if format or size changes

we dont have to release and recreate both the texture and framebuffer if
size or format changes, we can just bind the texture and call glTexImage2D
with the new format and size.

* framebuffer: set the alloced viewport size

if monitor size mismatch with the allocated m_size its going to set a
mismatched viewport and cause rendering issues. and if they are
mismatching there is a missing alloc call.

* renderbuffer: cleanup unneded binds

the renderbuffer is attached to the fbo and trying to rebind it in
bind() is causing unnecessery state changes, just bind the fbo.

add safeguard in the destructor, the constructor can return early on
failure and leave m_rbo empty or m_image as EGL_NO_IMAGE_KHR.
2026-01-03 15:13:01 +01:00
6175ecd4c4 debug: move to hyprutils' logger (#12673) 2025-12-18 17:23:24 +00:00
beee22a95e refactor: Use new hyprutils casts (#11377) 2025-08-14 15:44:56 +01:00
f4f090e4b2 renderer: reduce a lot of glcalls and cache various states (#10757)
* opengl: cache viewport state

according to nvidia docs calling glViewPort unnecessarily on the same
already set viewport is wasteful and can cause state changes when not
needed. cache it in a struct and only call it when the viewport is
actually changing.

* opengl: cache glenable/gldisable state

avoid making multiple glenable/gldisable calls on already set caps, can
cause state changes and incur driver overhead.

* opengl: cache glscissor box

only call glscissor if the box actually has changed, try to avoid state
changes.

* opengl: cache gluniform calls

cache the gluniform calls, the uniform values are cached in driver per
program only the drawcalls setting the uniform yet again with the same
value on same location is causing more overhead then caching it ourself
and just no oping on it if no changes.

* shader: rewrite handling of uniforms and state

this is way faster as we don't need to mess with maps (hashing, etc) and instead can just use an array

* opengl: stuff and 300 shaders

* opengl: typo

* opengl: get the uniform locations properly

now that the legacy shaders are gone get the uniformlocations for
SKIP_CM etc, so they can be properly set and used depending on if
cm_enabled is set to false or true, before it was falling back to a
legacy shader that didnt even have those uniforms.

* opengl: check epsilon on float and remove extra glcall

seems an extra unset glcall was added, remove it. and check the float
epsilon on the glfloat.

* opengl: remove instanced shader draw

remove the instanced boolean from the vertex shader, might be neglible
differences, needs more benchmark/work to see if its even worth it.

* texture: cache texture paramaters

parameters where occasionally set twice or more on same texture, short
version wrap it and cache it. and move gpu churn to cpu churn.

add a bind/unbind to texture aswell.

* texture: use fast std::array caching

cache the texparameter values in fast array lookups
and incase we dont want it cached, apply it anyways.

* shader: fix typo and hdr typo

actually use Matrix4x2fv in the 4x2fv cache function, and send the
proper float array for hdr.

* texture: make caching not linear lookup

make caching of texture params not linear.

* minor style changes

* opengl: revert drawarrays

revert the mostly code style reduce loc change of drawarrays, and focus
on the caching. its a if else case going wrong here breaking
blur/contrast amongst others drawing.

---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2025-06-25 12:42:32 +02:00
5ceb0ec15d core: drop the legacy renderer (#10408)
* core: drop the legacy renderer

the legacy renderer is broken and barely used, drop it.

* Nix: drop support for legacyRenderer

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-05-15 10:13:24 +01:00
60cd5b7a48 renderer: always render snapshots as 8bit
fixes issues with transparent windows on 10b
2025-05-09 22:16:21 +01:00
997fefbc11 render: refactor class member vars (#10292)
* render: refactor class member vars

* render: fix clang format
2025-05-05 23:44:49 +02:00
50e1bec85f helpers: refactor class member vars (#10218) 2025-04-30 23:45:20 +02:00
99ab3e19d9 framebuffer: Fix framebuffer size check (#10068) 2025-04-13 22:40:15 +02:00
f7fcbe32c9 renderer: various fixes towards improving gpu calls robustness (#9188)
ensure framebuffer textures are detached and deleted, avoid leaving framebuffers bound when not needed

* render: avoid calling glDeleteProgram on no program

its safe to do so but it adds a bunch of unnecessery lines in apitrace
when tracing. if guard it and return early.

* opengl: ensure texture and buffers are unbound

ensure bound buffers are unbound after use, also detach textures from
framebuffer before deleting it otherwise it will become dangling and
essentially leak.
2025-02-08 01:46:26 +01:00
8bbeee1173 core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us.

It's not a strict requirement to be compliant, but I tuned it to be alright.
2024-12-07 18:51:18 +01:00
180c26ada6 renderer: safeguard against non-sampleable currentFB in blurMainFb
fixes #8325
2024-11-03 15:16:13 +00:00
40081cb330 renderer: improve api around new framebuffer changes
ref #8325
2024-11-02 15:26:45 +00:00
d8b865366a renderer: Add a missing texture asset and a user check
When an asset is missing, instead of a black screen, render an obnoxious, yet standard, missing texture.

Additionally, warn the user assets failed to load.

Shoutout to Arch for having their assets broken for months. Fix your shit. I am tired of it, and it's negatively impacting users.
2024-11-01 15:52:09 +00:00
4b4971c06f internal: introduce new types to avoid unsigned int rollover and signed int overflow (#7216)
* framebuffer: avoid gluint overflow

GLuint was being initialized to -1 and rolling over to unsigned int max,
its defined behaviour but very unnecessery. add a bool and use it for
checking if allocated or not.

* opengl: avoid gluint rollover

-1 rolls over to unsigned int max, use 0xFF instead.

* core: big uint64_t to int type conversion

there were a few uint64_t to int implicit conversions overflowing int
and causing UB, make all monitor/workspaces/windows use the new
typedefs. also fix the various related 64 to 32 implicit conversions
going around found with -Wshorten-64-to-32
2024-08-08 21:01:50 +02:00
6967a31450 wayland/core: move to new impl (#6268)
* wayland/core/dmabuf: move to new impl

it's the final countdown
2024-06-08 10:07:59 +02:00
3981f85e94 opengl: log framebuffer errors 2024-04-03 14:24:15 +01:00
37d7a8c64d framebuffer: ignore addStencil on legacyRenderer
ref #4044
2023-12-05 15:41:17 +00:00
9c09f2a847 screencopy: fix shm exports with 10-bit
fixes #4019
2023-12-01 17:20:56 +00:00
2ebfd0c745 renderer: Move to a full Hyprland GL rendering pipeline (#3920)
Also updates wlroots
2023-11-24 10:54:21 +00:00
49fdffacea renderer: fix legacy_renderer build (#3732)
In GLES2, `GL_RGB10_A2` and `GL_UNSIGNED_INT_2_10_10_10_REV` are defined as
`GL_RGB10_A2_EXT` and `GL_UNSIGNED_INT_2_10_10_10_REV_EXT` respectively.
2023-11-03 15:47:20 +00:00
4b592d0819 renderer: properly pass 10-bit formats to opengl 2023-10-30 15:56:16 +00:00
61a71c65ac internal: Formatter rework (#3186) 2023-09-06 12:51:36 +02:00
84c4a14dad opengl: cleanup framebuffer style 2023-08-29 23:24:35 +02:00
f61a714320 renderer: cleanup old redundancies in CFramebuffer 2023-07-29 13:27:40 +02:00
98a4fa2b0d Added clang format (#1239)
* clang-format stuff and format files
2022-12-16 17:17:31 +00:00
57817f7252 Added resize transitions 2022-11-06 17:52:09 +00:00
d193d70ecf guard primaryFB tex in end() 2022-10-28 21:46:19 +01:00
bf3f519eb7 Remove trailing whitespace. 2022-09-25 20:07:48 +02:00
dd61f88ed1 guard invalid FB allocs 2022-09-18 12:40:49 +01:00
bf762f566f Fix VRAM memory leak when releasing snapshots 2022-07-12 23:11:34 +02:00
198fc90df5 What the fuck is going on with git, fix the entire scaling merge
This reverts commit 5b15d3b4f4.
2022-05-18 20:33:54 +02:00
5b15d3b4f4 Revert "Merge pull request #88 from vaxerski/scaling"
This reverts commit f68ddc382a, reversing
changes made to ba573a529a.
2022-05-18 14:42:00 +02:00
0503835ee6 fixed blur and shit 2022-05-16 21:30:11 +02:00
46a95afafd oops, fixed regular renderer 2022-04-13 17:51:18 +02:00
084e922642 Added legacy GLES2 renderer option 2022-04-13 17:34:13 +02:00
b56343133d fixed blur rendering, stencil and gles3 2022-04-11 16:39:48 +02:00
b7094200f6 Rendering now to a HyprFramebuffer 2022-04-09 15:01:28 +02:00
a49bbf4508 fadeout done 🎉 2022-04-05 20:49:15 +02:00