Commit Graph

52 Commits

Author SHA1 Message Date
Geoffrey McRae
78df2073ff [client] egl: make it possible to configure HDR to SDR mapping 2023-10-20 15:26:27 +11:00
Geoffrey McRae
ad43969c1a [client] egl: add support to map HDR to SDR 2023-04-26 16:26:54 +10:00
Geoffrey McRae
b4b4a37b2b [client] egl: switch to using GL_TEXTURE_EXTERNAL_OES for DMABUF
According to Erik @ NVidia the open source NVidia driver will not
create a EGLImage from a DMABUF if the target is not
GL_TEXTURE_EXTERNAL_OES. This change set converts the dmabuf texture
from GL_TEXTURE_2D to GL_TEXTURE_EXTERNAL_OES and at runtime performs a
global search & replace on fragment shaders as needed to remain
compatible, replacing `sampler2D` with `samplerExternalOES`.

Ref: https://github.com/NVIDIA/open-gpu-kernel-modules/discussions/243#discussioncomment-3283415
2023-03-09 09:20:01 +11:00
Geoffrey McRae
91b0cba145 [client] egl: switch from mediump to highp
This fixes a rounding issue on certain hardware (NVidia) which actually
implement mediump as half precision (16-bit) float. It's safe to assume
`highp` is available as if the GPU does not support it, then the shader
compiler will try to find a lower precision that is supported by the GPU
2023-03-05 14:10:21 +11:00
Geoffrey McRae
fec45dfe9c [client] egl: remove unused splash shaders 2022-05-27 02:10:38 +10:00
Geoffrey McRae
6afd262a27 [client] egl: update AMD FSR to 1.0.2 2022-05-04 15:29:21 +10:00
Geoffrey McRae
b0568ca404 [client] egl: use a sigmoid curve for nv 2022-01-26 23:03:35 +11:00
Geoffrey McRae
d69069fb09 [client] egl: keep the mouse cursor 1:1 when downscaling
This keeps the cursor a usable size when the guest is running a high
resolution and downscaling (ie, 4K -> FHD).
2021-12-26 11:08:42 +11:00
Geoffrey McRae
8167ef2c4a [client] egl: make use of glsl's textureSize function 2021-11-12 07:41:59 +11:00
Quantum
1b58f2592c [client] egl: make filters damage aware
This saves a lot of GPU power for partial updates. Running testufo with
lanczos downscaling and FSR upscaling consumed over 90 W, but with this
commit, consumed only 75 W.
2021-09-04 13:30:24 +10:00
Quantum
bb91b41c64 [client] egl: look at 3x3 around the pixel instead of 4x4
Using 4x4 means that some pixels will be outside of the lanczos window. The
ideal lanczos function should in fact be zero in those areas, so we shouldn't
waste time processing those pixels.

I can't notice any difference in the results.
2021-08-19 15:52:44 +10:00
Quantum
520460669c [client] egl: set gl_Position.z in cursor vertex shader 2021-08-19 12:24:55 +10:00
Quantum
2c02e6c4a0 [client] egl: add linear downscale filter shader 2021-08-14 12:19:50 +10:00
Quantum
94de061587 [client] egl: implement lanczos filter shader 2021-08-14 12:19:50 +10:00
Geoffrey McRae
117e88c240 [client] egl: add new downscale filter 2021-08-12 15:54:16 +10:00
Quantum
543c97987b [client] egl: remove needless precision quantifiers
We simply use precision mediump float; for everything. We don't actually
need highp anyways, and we don't use it for stuff like CAS or FSR.
2021-08-11 20:47:46 +10:00
Quantum
8b2db071d8 [client] egl: precompute CAS filter constants on CPU 2021-08-11 20:38:42 +10:00
Quantum
f80b67bc50 [client] egl: precompute FSR filter constants on CPU 2021-08-11 20:16:39 +10:00
Geoffrey McRae
f0ea882165 [client] egl: cleanup texture filtering/post-processing 2021-08-11 18:53:36 +10:00
Geoffrey McRae
f78154d282 [client] egl: fixes to shader post-process pipeline 2021-08-11 06:31:01 +10:00
Geoffrey McRae
127d3acd96 [client] egl: use a texel based version of textureGather for FSR 2021-08-10 14:21:46 +10:00
Quantum
ccee347740 [client] egl: don't define FSR_RCAS_F in ffx_fsr1_rcas.frag 2021-08-10 13:57:23 +10:00
Geoffrey McRae
dc0b3a8d45 [client] egl: rework post process filters and add AMD FXR 2021-08-10 13:46:48 +10:00
Quantum
705250f23d [client] egl: correct assign to gl_Position in basic.vert
gl_Position is expected to be using homogeneous coordinates, which requires
w to be a coordinate scale factor, usually 1.0. z should also be set in order
for depth to be well-defined. Therefore, we should set gl_Position.zw to
vec2(0.0, 1.0).
2021-08-10 06:10:42 +10:00
Geoffrey McRae
37faccd014 [client] egl: allow ffxCAS sharpness configuration 2021-08-10 00:54:54 +10:00
Geoffrey McRae
d24bc75519 [client] egl: added missing vertex shader file 2021-08-09 23:14:01 +10:00
Geoffrey McRae
92de467edc [client] egl: add ffx_cas post process filter 2021-08-09 23:12:58 +10:00
Quantum
9b1d03fcfe [client] egl: implement #include for shaders with awk 2021-08-09 22:04:07 +10:00
Geoffrey McRae
6882e5c59f [client] egl: provide the texture scale to the desktop shader
If the texture has a post-processing filter that has scaled the texture,
the desktop fragment shader needs to know this if it's doing linear
scaling.
2021-08-09 18:22:28 +10:00
Quantum
53461d7515 [client] egl: simplify desktop vertex shader
In GLSL, using the / operator on two vectors of the same size divides the
vector component-wise, i.e. vec2(a, b) / vec2(c, d) == vec2(a / c, b / d).
2021-08-09 17:51:13 +10:00
Geoffrey McRae
86d6b67337 [client] egl: rework egl to accomodate post-processing filtering 2021-08-09 14:08:10 +10:00
Quantum
f9977332a6 [client] egl: convert desktop to use desktop_rects 2021-08-03 21:37:31 +10:00
Quantum
dd31a7ef93 [client] egl: clean up splash background shader 2021-08-03 21:12:46 +10:00
Quantum
dd0edc1394 [client] renderers: remove alert handling 2021-07-23 20:18:12 +10:00
Quantum
5153d35bb5 [client] renderer: remove on_help from renderer interface 2021-07-23 18:04:05 +10:00
Geoffrey McRae
ab31040d5f [client] all: use imgui for FPS/UPS display 2021-07-18 20:43:17 +10:00
Quantum
2b3f31700b [client] egl: implement frame damage display 2021-07-18 10:41:50 +10:00
Quantum
0512c88ea8 [client] egl: make scale algorithms toggleable
The $escape+S keybinding now cycles through the available scale algorithms.
This allows the user to switch between algorithms if the automatic detection
turns out to be problematic.

The algorithms are renumbered so that 0 can be LG_SCALE_AUTO.
2021-02-22 17:25:06 +11:00
Quantum
ba6f26393f [client] egl: add framework for multiple scaling algorithms
This commit fixes the issues with the meaning of useNearest being flipped
by removing the variable and use enumerations.

We define an enumeration EGL_DesktopScaleType to express the type of scaling
needed to be performed: no scaling, upscaling, or downscaling. This is
updated when either the frame size or the viewport size changes.
Previously, we only updated the useNearest when the frame size changes.

The desktop shader can now support an enumeration of scaling algorithms,
although only nearest and linear are currently implemented.

Like before, nearest is used when not scaling or upscaling, and linear is
used when downscaling.
2021-02-21 14:20:41 +11:00
Quantum
2993f7ae7d [client] egl: create 24-bit colour context
This should prevent the looking-glass-client window from having an alpha
channel. On Wayland, the alpha channel is used to compose the window onto
the desktop, so the wallpaper would bleed through unless set to complete
opaque.

We worked around this by using constant alpha for rendering, but it was
not sustainable. Instead, we should just ask for 24-bit context.
2021-02-21 10:31:48 +11:00
Quantum
5ac53362a3 [client] renderer/egl: implement support for rendering help text
The help text is rendered in the bottom left corner on a semi-transparent
background, very similar to how the FPS text is rendered.
2021-02-21 10:31:48 +11:00
Quantum
8559b354ae [client] egl: always render desktop texture as opaque
We ask for 32-bit colour buffer when creating the EGL context. On Wayland,
this sometimes give contexts with alpha channels, resulting in unwanted
transparency. So we clear the alpha channel in the desktop shader.

We also switch to using constant alpha for blending the splash, which
avoids more alpha issues.
2021-02-21 10:31:48 +11:00
Geoffrey McRae
733bbf5153 [client] app: rename up,right,down,left rotation to 0,90,180,270 2021-01-19 02:53:47 +11:00
Geoffrey McRae
cbeae46c0b [client] egl: move rotation into the fragment shader 2021-01-15 13:13:39 +11:00
Geoffrey McRae
72c86d7125 [client] all: add screen rotation support win:rotate
Currently only supports EGL, if there is enough demand for OpenGL
support this can be added later.

Closes #231
2021-01-15 12:42:16 +11:00
Geoffrey McRae
c40a81ddf4 [client] egl: remove no longer used yuv shader 2021-01-15 12:42:16 +11:00
Geoffrey McRae
dd7e0ea8c6 [client] egl: added colorblind support (egl:cbMode=0/1/2/3)
Based on http://www.daltonize.org/search/label/Daltonize

0 = Off
1 = Protanope
2 = Deuteranope
3 = Tritanope
2020-11-09 07:08:15 +11:00
Geoffrey McRae
dba9764c5e [egl] alert: fix fuzzy font bug and make alerts a little more plesant 2019-05-23 19:58:12 +10:00
Geoffrey McRae
ba50fbdc3e [client] egl: implement pixel perfect upscaling 2019-04-19 11:23:51 +10:00
Geoffrey McRae
1fbba5cf2d [client] egl: make nightvision enhance luminosity before gain 2019-03-31 00:08:52 +11:00