Commit graph

44 commits

Author SHA1 Message Date
Splendide Imaginarius
936d768e4f Add xBRZ shader 2024-01-13 05:53:09 +00:00
Splendide Imaginarius
8ef08ce5da Lanczos3/bicubic shaders: Only set default precision on GLES
Doing so is noncompliant with desktop GL.
2023-11-14 00:10:10 +00:00
Splendide Imaginarius
6c471dafdb Lanczos3 shader: fix copyright notice 2023-11-12 14:45:37 +00:00
Splendide Imaginarius
d9465b28a0 Bicubic shader: always use highp float 2023-11-12 14:44:19 +00:00
Splendide Imaginarius
a56e6e0987 Add bicubic scaling 2023-11-12 14:42:19 +00:00
Eblo
79bcaf266f
Fix precision issues in vertex shaders
Restore conditional that makes mediump declaration only apply to fragment shaders
This was erroneously removed to make the Lanczos3 shader link properly, but it resulted in vertex shaders incorrectly defaulting to mediump
Add highp precision declaration to Lanczos3 fragment shader so that it can link
2023-11-12 09:27:12 -05:00
Struma
359ccd7a0c make the lanczos shader work on macOS 2023-05-08 04:47:24 -04:00
Splendide Imaginarius
f26a9a8e1c
Add Lanczos3 scaling (#9)
"Lanczos filtering tends to yield much better quality (sharper image) than bilinear filtering."
2023-05-05 15:39:42 -04:00
Struma
b2dd4db15d make pattern subtract blend mode actually subtract 2022-01-18 03:28:05 -05:00
Struma
e51f808b61 Substract -> Subtract in Sprite pattern shader
I blame all of the typos leading me to believe
Ancurio was actually using Substract.
2022-01-17 01:25:44 -05:00
Struma
725d593db3 add Sprite.pattern_blend_type 2021-11-29 21:58:18 -05:00
Struma
3dc2128b25 Swapping pattern fit modes + color inversion 2021-11-29 18:57:43 -05:00
Struma
6722a1e61a Add settable bitmap patterns on Sprites 2021-11-29 06:58:41 -05:00
Struma
94c031b095 Revert to using GL compatibility contexts (and GLES2) 2020-11-16 21:56:19 -05:00
Aeodyn
e86548b6ba Another minor tilemap.vert fix, depending on the platform. 2020-07-30 15:40:22 -04:00
Aeodyn
050da27ca0 Brought the tilemap class mostly in line with Essential's CustomTilemap wrt animations, though at the cost of backwards compatibility.
(This could be rescued by per-tile animation lentghs in tilemap.vert, but this should suffice for now.)
2020-07-14 19:34:38 +00:00
Struma
84fee7ac78 Create 'gl3' build option 2020-02-24 23:25:06 -05:00
Struma
d080513105 Require OpenGL 4.1 (GeForce 400+,Radeon HD5000,Intel HD4000+)
Along with setting a version for macOS to use instead of 2.1,
most if not all Essentials games require a maximum texture size
of at least 16384x16384. OpenGL 4.1 requires this as a minimum.
2020-02-24 22:48:23 -05:00
Struma
827e20db87 Use Core GL context, allow OpenGL3/4 on macOS 2020-02-24 22:29:36 -05:00
Inori
3ee8659dda Begin using Objective-C (ObjFW), remove cwalk 2019-12-14 13:31:48 -05:00
Inori
df4cf83e93 Only regenerate embedded files as needed 2019-08-15 09:08:09 -04:00
Inori
37e5943f34 Use meson as build system 2019-07-29 07:56:45 -04:00
Jonas Kulla
541e24f678 Bitmap: Use more accurate HSV-based hue shift algorithm
The previously YIQ-based algorithm turned out to be both slow,
and horribly inaccurate.

Another algorithm based on rotating the color value in the
RGB cube along the diagonal axis was also considered, which was
acceptable in terms of accuracy, and very fast.

In the end, I decided on a HSV-based one, because it is by far
the most accurate one, while still being a tad faster than the
YIQ solution.
Algorithm source: gamedev.stackexchange.com/a/59808/24839

A very simple GPU time benchmark when shifting a 2048^2 bitmap:

         YIQ rot   RGB rot   HSV shift
radeon   13.4 ms   2.8 ms    11.4 ms
intel    13.0 ms   6.0 ms    10.5 ms

radeon: HD 3650 mobility
intel:  N3540 integrated (Baytrail)

However hue shifting has never shown up as a bottleneck before,
so these are more academic.
2016-10-30 08:50:45 +01:00
Jonas Kulla
2f95c0613a Shaders: Prefer arithmetic conditionals to branching 2014-12-31 18:52:20 +01:00
Jonas Kulla
373b90af00 Graphics: Optimize Viewport effect rendering
Using the kitchen sink plane shader for viewport effects, even
if only a small part of them are active, incurs great performance
loss on mobile, so split the rendering into multiple optional
passes which additionally use the blending hardware for faster
mixing (lerping).
Also, don't mirror the PingPong textures if the viewport effect
covers the entire screen area anyway.
2014-12-31 18:52:19 +01:00
Jonas Kulla
3c0a530eba Sprite: Add special case shader for translucent effect
Translucent sprites (opacity < 255) are very common,
so using a custom shader instead of the full blown effect one
helps a lot, especially on mobile.
2014-12-31 18:52:19 +01:00
Jonas Kulla
a53163660f Shader: Refine preprocessing on GLES platform
Don't globally set float precision to mediump, only fragment
shaders need that and defining it for vertex shaders causes
tilemap cracks.

Also manually define low precision for variables that hold
color / alpha values.
2014-12-31 18:52:19 +01:00
David Salvisberg
8240f3333f Fixed hue shader turning pure white pixel to pure black on some GPUs. 2014-12-31 16:02:10 +01:00
Jonas Kulla
7790bd6c2c Implement RGSS2 Tilemap class (TilemapVX) 2014-08-15 15:20:32 +02:00
Jonas Kulla
56226c40c6 Tilemap: Use vertex shader based autotile animation strategy
Previously, we would just stuff the entire tilemap vertex data
four times into the buffers, with only the autotile vertices
offset according to the animation frame. This meant we could
prepare the buffers once, and then just bind a different offset
for each animation frame without any shader changes, but it also
lead to a huge amount of data being duplicated (and blowing up
the buffer sizes).

The new method only requires one buffer, and instead animates by
recognizing vertices belonging to autotiles in a custom vertex
shader, which offsets them on the fly according to the animation
index.

With giant tilemaps, this method would turn out to be a little
less efficient, but considering the Tilemap is planned to be
rewritten to only hold the range of tiles visible on the screen
in its buffers, the on the fly offsetting will become neglient,
while at the same time the amount of data we have to send to the
GPU everytime the tilemap is updated is greatly reduced; so a
net win in the end.
2014-07-06 19:44:19 +02:00
Jonas Kulla
1b0eb2797d BltShader: Correct algorithm as provided my /cremno
The color calculation is now actually 99% correct!
Fixes #14.
2014-01-31 10:08:05 +01:00
Edward Rudd
a3c9f53335 GLSL 100 doesn't do automatic type conversions.. (int to float) 2013-12-31 16:26:49 -05:00
Jonas Kulla
3a5c4eba52 BltShader: More hacks! Yay!
Seriously, I'm about to kill myself over this..
Not even gonna bother with math-if optimization.
2013-12-20 07:40:34 +01:00
Jonas Kulla
b756fa5526 Shader: Fix compile issue (thanks again Mesa!) 2013-11-02 15:27:51 +01:00
Jonas Kulla
906f9fae17 BitmapBlitShader: Try a bit harder
It's not really perfect yet, but it looks a lot closer
to what was there before.
2013-10-22 06:40:24 +02:00
Jonas Kulla
19c30e3ddd Fix shader code. Thanks Mesa!
On the other hand, the kind of shit fglrx
just lets through boggles the mind.
2013-10-02 15:00:17 +02:00
Jonas Kulla
a54acce6b7 Implement Bitmap 'blur'
I was a bit confused at first because I thought Enterbrain
had actually implemented a full Gaussian blur, but nope,
just dumb averaging.
2013-10-01 18:12:52 +02:00
Jonas Kulla
9f26ff9fb0 Port over Bitmap 'radial_blur' from old SFML codebase
This implementation is also heaps better than the old
one as it doesn't use a (differently sized) aux texture,
meaning the Bitmap discards its old texture and aquires
one of same size, making reuse through the TexPool a
lot more likely. It also saves on the aux texture blits
and binding switches.

As the setup / resource acquisition far outweighs the
actual rendering cost, operation time is relatively
constant no matter how many divisions are used.
2013-10-01 12:03:20 +02:00
Jonas Kulla
fa77726388 Remove unneeded shader uniform 2013-09-28 15:41:09 +02:00
Jonas Kulla
6b2c892280 Simplify shader 2013-09-23 14:12:11 +02:00
Jonas Kulla
7a6c05bba0 Implement animated flash tiles in Tilemap
Flash tiles start with an alpha of 60, which ramps up to 120
in 16 frames and 4 steps, then ramps down again over the same period.
2013-09-23 08:27:28 +02:00
Jonas Kulla
9e63fb6b64 Remove the remaining bits of deprecated GL usage
The drawing is now completely shader based, which makes away
with all usage of the depracted matrix stack. This also allows
us to do things like simple translations and texture coordinate
translation directly instead of doing everything indirectly
through matrices.

Fixed vertex attributes ('vertexPointer()' etc) are also
replaced with user defined attribute arrays.
2013-09-23 07:50:22 +02:00
Jonas Kulla
494fbccb6e Remove unused code 2013-09-01 18:17:19 +02:00
Jonas Kulla
ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00