Alexander Orzechowski
b1d26ed47b
renderer/gles2: Compute texture coordinates based off of vertex positions
2023-05-28 14:53:34 -04:00
Alexander Orzechowski
6f67bfe5ab
renderer/gles2: Interpret matrix as column major in shader
...
Avoids us needing to transpose.
2023-05-28 14:53:34 -04:00
Simon Ser
677a3f2f88
render/gles2: default to highp if available
...
The spec [1] says that the maximum value for a mediump float
is at least 2¹⁴ in section 4.5.2. However, when using a 4k
resolution texture coordinates will exceed this value. This causes
issues on drivers which implement mediump as a 16-bit [2].
Switch to highp. There's a twist: on GLES2, support for highp is
optional. So we need to guard it with cute GL_FRAGMENT_PRECISION_HIGH
ifdefs.
[1]: https://registry.khronos.org/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf
[2]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21082
2023-02-02 22:54:13 +01:00
Simon Ser
4d04144b92
render/gles2: de-duplicate vertex shaders
...
The vertex shaders for quads and textures are identical.
2022-10-28 13:49:03 +02:00
Simon Ser
d69018c195
render/gles2: move color uniform from quad.vert to quad.frag
...
We have no use for a v_color varying. We can use the uniform
directly from the fragment shader without getting the vertex shader
involved.
2022-10-28 13:49:03 +02:00
Simon Ser
a75f9be2e8
render/gles2: move shaders to individual files
...
Instead of having a C file with strings for each shader, move each
shader into its own file. Use a small POSIX shell script to convert
the files into C strings (can't wait for C23 #embed...).
The benefits from this are:
- Improved readability and syntax highlighting.
- Line numbers in shader compiler errors are easier to make sense of.
- Consistency with the Vulkan renderer.
- Shaders will become more complicated as we add color management
features.
2022-10-28 11:46:06 +00:00