summaryrefslogtreecommitdiff
path: root/src/render/shaders
Commit message (Collapse)AuthorAgeFilesLines
* renderer: add surface shader variants with less branching and uniforms (#13030)UjinT342026-01-2125-373/+135
| | | | | | | | | * shader variant features * getSurfaceShader variant with feats * split surface shaders by features * cleanup old shaders
* renderer: optimise shader usage further, split shaders and add more caching ↵Tom Englund2026-01-177-32/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#12992) * shader: split CM rgba/rgbx into discard ones make it branchless if we have no discards. * shader: ensure we dont stall on vbo uv buffer if we render a new texture before the previous was done gpu wise its going to stall until done, call glBufferData to orphan the data. this allows the driver to return a new memory block immediately if the GPU is still reading from the previous one * protocols: ensure we reset GL_PACK_ALIGNMENT reset GL_PACK_ALIGNMENT back to the default initial value of 4 * shader: use unsigned short in VAO loose a tiny bit of precision but gain massive bandwidth reductions. use GL_UNSIGNED_SHORT and set it as normalized. clamp and round the UV for uint16_t in customUv. * shader: interleave vertex buffers use std::array for fullverts, use a single interleaved buffer for position and uv, should in theory improve cache locality. and also remove the need to have two buffers around. * shader: revert precision drop we need the float precision because we might have 1.01 or similiar floats entering CM shader maths, and rounding/clamping those means the maths turns out wrong. so revert back to float, sadly higher bandwidth usage. * update doColorManagement api * convert primaries to XYZ on cpu * remove unused primaries uniform --------- Co-authored-by: UjinT34 <ujint34@mail.ru>
* renderer: shader code refactor (#12926)Tom Englund2026-01-1210-145/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * shader: begin the shader refactor make SShader a class and rename it to CShader, move createprogram, compileshader, logshadererror to CShader. * shader: move uniform creation to CShader move uniform creation to CShader, reduces tons of duplicated effort, however forcing uniform names to be same in all shaders. * shader: move to array based frag handling use an array with an enum so it gets easier dealing with multiple shaders, move creating program to a for loop and array, reduces line of code a lot. * shader: use shared ptr for frags with smart pointers we can now rename useProgram to useShader and return the shader directly, means only place we have to decide the shader frag is when calling useShader. easier for future shader splitting to reduce branching. * shader: move unneded public members to private move structs and uniforms to private add a get/set for initialtime and add a getUniformLocation to make the code tell what its doing, instead of direct array getting when all we wanted to get was its value, also limits the setting of uniformLocations to the createProgram as it should be. * shader: fix style nits set first enum member to 0 , remove extra {} * shader: dont show a failed notif on success the logic got inverted in the refactor here. * shader: split CM shader to rgba/rgbx variants split shader to rgba/rgbx variants, use bool, and reduce branching. * shader: split up blurprepare CM and non CM split up blurprepare, remove skipcm, move gain to gain.glsl. remove ternary operator and reduce branching by using step() and mix() use vec3 for gain, make brightness a cheap mulitplication with max. * shader: split up border to CM/noncm variants splitup border shader to CM/noncm variant, move common used things to border.glsl , there is room for optimisations here but its a complex shader im putting it for future PR. * shader: touchup blurfinish make brightness a cheap multiplication instead of branching. mod is redundant, fract in hash already returns a value in [0.0, 1.0]
* renderer/gl: add internal gl formats and reduce internal driver format ↵Tom Englund2026-01-072-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* render/cm: various updates, remove old protocols (#12693)UjinT342025-12-271-1/+1
| | | | | | | | | | | | | * fix named primaries * default to gamma22 * mark mastering primaries as supported * remove xx-cm and frog support * immutable primaries and image descriptions * clang-format
* renderer/cm: higher-quality tonemapping (#12204)Dominick DiMaggio2025-12-072-17/+11
|
* renderer/cm: allow gamma 2.2 instead of sRGB EOTF (#12094)Dominick DiMaggio2025-10-291-1/+1
|
* ci: correct tar command for xz compression & fix typos (#11213)xqso2025-07-252-2/+2
|
* renderer: implement wp-color-management-v1 transfer functions (#11084)Thomas Müller2025-07-201-69/+157
|
* shader: replace texture2d with texture (#10893)Tom Englund2025-07-018-26/+24
| | | | | | | | | | * shader: replace texture2d with texture remove unused v_color and replace deprecated texture2d with texture. * shader: use the more modern essl3 extension GL_OES_EGL_image_external_essl3 provides support for samplerExternalOES in texture function, aquamarine already use it. apply it here too.
* renderer: reduce a lot of glcalls and cache various states (#10757)Tom Englund2025-06-2516-356/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* cm: Use precomputed primaries conversion (#9814)UjinT342025-04-295-99/+58
|
* renderer/opengl: Extract shaders from source (#9600)UjinT342025-03-2925-665/+952
| | | | | --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
* opengl: simplify cm pipelineVaxry2025-03-161-19/+20
| | | | | | fixes a few mistakes, and skips the CM shader in cpu instead of adding a costly branch ref #9641
* renderer: add simple color management (#9506)UjinT342025-03-142-0/+443
| | | Adds proper color management and transformations for CM surfaces.
* shaders: fix blank windows when using corner rounding (#8969) (#8971)Pollux2025-01-061-2/+2
|
* renderer: Add supercircular window corners (#8943)Pollux2025-01-053-19/+24
| | | | | | | renderer: Add supercircular shadows and borders config: Add rounding_power to default and example configs rule: add `roundingpower` window rule
* core: move colorspace handling to oklab (#8635)Vaxry2024-12-031-1/+61
| | | | | | | | | | | * Meson: add hyprgraphics * Nix: add hyprgraphics * CI/setup_base: get hyprgraphics-git --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
* shaders: improve corner AA in borders shaderVaxry2024-11-053-3/+16
|
* shaders: fixup jagged edges in texture rounded cornersVaxry2024-11-051-4/+7
|
* shaders: Use sin-less hash for noise (#5607)Epikastema2024-04-171-1/+3
|
* renderer: add support for gles3.2 screen shadersVaxry2024-03-181-0/+11
|
* shaders: use highp for fragmentsVaxry2024-02-153-15/+15
|
* shaders: Some more changes in rgb2hsl. (#3834)Dickby2023-11-121-4/+5
|
* shaders: Small optimization in rgb2hsl. (#3831)Dickby2023-11-111-7/+6
|
* shaders: Avoid calculating unused values in hsl2rgb. (#3827)Dickby2023-11-111-8/+7
|
* shaders: Use clamp in doubleCircleSigmoid. (#3824)Dickby2023-11-111-3/+1
|
* opengl: switch to black-and-white for alpha mattesVaxry2023-11-091-1/+1
| | | | also fixes shadows on 10b
* opengl: remove unused alpha matte from shadowVaxry2023-11-091-7/+0
|
* renderer: added new customization options to the blur shaders (#3650)Visual-Dawg2023-11-061-17/+173
| | | Adds to `decoration:blur:` `vibrancy` and `vibrancy_darkness`
* shadows: fix on transformedVaxry2023-11-041-0/+10
|
* Decos: Window decoration flags, shadow improvements (#3739)Vaxry2023-11-042-0/+10
|
* shaders: support changing the outer radius of borders independentlyVaxry2023-10-191-6/+16
|
* shaders: Remove redundant clamp of smoothsteps return value. (#3456)Dickby2023-09-302-5/+5
|
* renderer: nuke multisample_edges in favor of a faster algorithmvaxerski2023-09-302-20/+5
|
* shaders: improve border roundingvaxerski2023-09-301-23/+12
|
* shaders: minor premultiplication fixesvaxerski2023-08-182-5/+6
|
* renderer: fix missing premultiplication for border multisamplingvaxerski2023-08-061-2/+3
|
* renderer: fully switch to premultiplied alphavaxerski2023-08-062-3/+6
|
* renderer: Various Blur Improvements (#2877)Vaxry2023-08-031-0/+30
| | | | | * move blur to its own category * blur improvements, contrast, brightness, noise
* shaders: short-circuit rounding if radius <= 0vaxerski2023-07-201-0/+6
|
* Allow setting alpha value for ignorezero layer rule (#2477)end-42023-06-111-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rename ignorezero to ignorealpha * allow setting ignorealpha value This commit allows setting a float value (0-1) for the ignorealpha layer rule. Does not yet have error handling; invalid ignorealpha layer rule will crash Hyprland. * add brackets i forgot to add * prevent crash with invalid ignorealpha value prevents hyprland from immediately crashing with invalid ignorealpha layer rule does not log * don't try to set ignoreAlphaValue if alpha value not specified * add catch to try, reintroduce ignorezero - added catch after try cuz i was an idiot - re-add ignorezero as an alternative to ignorealpha to not introduce a breaking change * add logging for failed ignorealpha layer rule * fix get ignorealpha's get VALUE * check npos and use empty() * rename VALUE cuz no longer const * format Shader.hpp
* debug: minor improvements to manual crashvaxerski2023-04-041-4/+38
|
* debug: added manual_crashvaxerski2023-04-041-0/+33
|
* shaders: fix missing discardAlphaZerovaxerski2023-03-241-0/+2
|
* LS: add blur and ignorezero rulesvaxerski2023-03-171-5/+8
|
* opengl: use a passthru shader for final wlr copyvaxerski2023-03-041-0/+9
|
* touch up the clang format and format all filesvaxerski2022-12-201-6/+11
|
* fix border inner offset in shadervaxerski2022-11-291-4/+4
|
* fix AA on bordersvaxerski2022-11-291-3/+4
|