GL4ES Round 4: Down the hole

Date 18-Apr-2021 19:15:22
Topic: software OS4


... First words ...



More than a year passed since the latest GL4ES releases, but that didn't mean no one works on it!

But for the first, a few notes right at the beginning before we go further:

NOTE1: Radeon RX users - BE SURE that you set Prefs: PowerManagment to HIGH! Automatic PowerManagment in Radeon RX drivers works wrong probably due to not having
DMA in the driver and as result resources didn't raise when needed, which causes low FPS in most games. So you should set it to HIGH, save, reboot, and
then you will have the maximum possible FPS from your Radeon RX. Not doing this will cause lower your FPS quite a lot !!!


NOTE2: Since now, the minimum requerements for everything listed below are:

-- Warp3DNova.library >= v1.83
-- ogles2.library >= v3.1
-- RadeonHD >= 3.7 or RadeonRX >= 2.4 (with Prefs:PowerManagment set to HIGH)

Everything is a part of Enhancer 2.0. If you will be on anything less, you will have all sorts of issues, bugs, crashes, and rendering glitches of all sorts. You are warned!

NOTE3: all images in this text are clickable for URLs or full-size images

... Intro ...

So. Since last time, Hans works quite heavily to improve Warp3DNova, Daniel works on ogles2.library, ptitSeb works on GL4ES library, Capehill works on SDL1/SDL2 library and I just
collect everything in one place and tried to make good use of it.



If you didn't know what GL4ES are, is an OpenGL 2.x/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, and AmigaOS4.
It is written by Sebastien "ptitSeb" Chevalier, I only handle the AOS4 version, but all changes (including AmigaOS4 ones) most of the time done by ptitSeb.



For AmigaOS4 translation done via ogles2.library and which in turn works on top of warp3dnova.library

With GL4ES we have not only OpenGL1.x as with MiniGL, but OpenGL 1.x, OpenGL2.x, and even some limited OpenGL3.x support.

Q: How it works?
A: GL4ES emulate fixed-pipeline via auto-generated GLSL shaders and send them to ogles2 which in turn parse & patch them, convert to SPIRV format and send to warp3dnova for compilation and execution.

Q: Are shaders that come with OpenGL apps works too?
A: Yes. They also go through gl4es for adding little bits, and then the same send to ogles2/warp3dnova for compilation and execution.

Q: Why not made full OpenGL? Why just not port MESA over Warp3DNova?
A: Because it's harder and there weren't thousands of developers willing to do so. Only Daniel was able to take the task, and to make something in the real time frame it was chosen to go the OpenGL ES route.
But anyone feels free to make a MESA port over Warp3DNova, of course.

Q: Is it faster than MiniGL over old Warp3D? Is it better?
A: It is faster in most cases a lot. In some cases where the old GL_BEGIN/GL_END route used, speed can be the same, just without MiniGL bugs.
But in other cases it much faster. As GL4ES works over opengles2 & Warp3DNova, we have hardware TCL, VBO, and all stuff.

Q: Why some things are fast, but other ones are not _THAT_ fast as we hope?
A: Because currently, we don't have DMA/GART implemented in graphics drivers.

You can grab the ready to use AmigaOS4 SDK for GL4ES on os4depot or from my GitHub page there:

https://github.com/kas1e/GL4ES-SDK/tags

Now, to the releases, what we have today?

... Releases ...

1). Worlds



You're Reyk, a highly trained agent of a secret interdimensional agency: the Order. Pack yourself with deadly weapons and experimental equipment, then journey through the portal to strange parallel worlds!
Assassinate your targets, sneak in enemy bases and investigate mysterious anomalies to uncover the odd link between these worlds...

That how a brief description of the game looks like. The game out in 2016, done by Curius Planet and closed source. The game is based on Irrlicht Engine.



Few words about Irrlicht Engine:

Irrlicht Engine was ported to AmigaOS4 15 months ago and such game-ports for AmigaOS4 as SuperTuxKart, H-Craft & Nights of The Zombies already using it.

AmigaOS4 port of Irrlicht is on Github here: https://github.com/kas1e/Irrlicht/ and if you find any amigaos4 specific issues plz report them on the issues page here: https://github.com/kas1e/Irrlicht/issues

It is released in 2 variants (which you can grab from os4depot like everything else):

irrlicht-1.8.4.lha - full archive, with all the sources, includes, documentation, precompiled binaries, link library, and media files. Size of archive 115MB.
irrlicht-1.8.4_minimal.lha - that just includes and Newlib's link library which is enough to start code over it. Size of archive 4MB.

The engine is fully tested, can be compiled, and on AmigaOS4 natively and over cross-compiler (see the readme_amigaos4.txt inside).

But let's back to the game: by some luck, I got sources from the authors, and thanks to never-ending work on Warp3DNova by Hans, Ogles2 by Daniel, GL4ES by ptitSeb, and SDL1/2 by Capehill
we can play a more or less modern game on AmigaOS4.



The game uses a lot of shaders everywhere (about 30 original OpenGL ones, and about 100 internal GL4ES ones). And this is probably the most demanding game for today in terms of shaders on our OS.

Key Features:
- Explore 8 atmospheric worlds, full of secrets and mysteries.
- Sneak in enemy bases using suppressed guns, experimental equipment, incredible powers... or your bare hands.
- Fight against masked madmen, mysterious dimensional creatures, giant birds equipped with chainguns, and more.
- Collect points by completing missions and finding secrets, then use them to upgrade your equipment with powerful weapons and specialized outfits.
- Play minigames, fight in the dangerous colosseum or accomplish training missions between your main missions.
- Witness the consequences of your actions when coming back on a world...


AmigaOS4 port changes:

-- gl4es is used for OpenGL (so ogles2/warp3dnova)
-- build based on amigaos4 port of Irrlicht engine: https://github.com/kas1e/Irrlicht
-- amigaos4 specific changes
-- builded with gcc 10.3.0
-- fixed original issues which show ups only on AmigaOS4 due to its very sensitivity to a bugs nature.


NOTE: Be warned, that

1). Setting Video Quality more than "Medium" will try to use Vertex Shaders which need access to textures, and accessing to textures from Vertex Shaders is currently not supported in Warp3D Nova. There
is the report about http://www.amiga.org/developer/bugreports/view.php?id=714
At first, I thought to just disable the ability to choose more than "Medium", but in the future, it will be probably fixed in Warp3DNova, so things may work automatically after. But in meantime didn't use Video Quality bigger
than Medium.

2). "Cache Size" option set more than "Medium" will go past 2 GB of system RAM pretty quick. But we currently can't go past 1.8 GB of memory in a normal way, so once you will try to set more, you will quickly be out of system memory
and have a freeze of the OS. So, didn't use more than Medium, it's an optimal value already (which, may also sometimes be out of our 2GB barrier, so don't forget to saves when possible).

3). Changing resolution, Window/Fullscreen modes, and any other settings will have an effect after you quit and restart the game again.

4). In beginning it can be a bit hard to play, so you have training mode at the start. Follow it, and you will be able to dig in quickly. Also, remember that to skip long intros you can hit "TAB".
There is also no usual "save" like you press "ESC" and save at any time: saves there in the rooms with beds which you need to find.


For AmigaOS4 recommended requirements: X5000, Radeon RX (for better speed and complex shaders) with 2 GB of GPU memory and 2GB of System Memory. You can expect from 25 to 120 FPS across the game. In most cases, it's ~50FPS.
On X1000 with RadeonHD it should be ok too, just with a bit lower graphics details. With all minimal settings maybe be possible to play on SAM460/SAM440.

The game's data files are quite big, about 1.5 GB (due to the music & sound files mostly) and you can data files from grabbing the STEAM release version:

https://store.steampowered.com/app/304850/Worlds/

AmigaOS4 archive can be downloaded as usuall from os4depot (in upload query currently).

Alternatively, for a time being, with allowing from the author, I upload the full AmigaOS4 version ready to run with data files included on some free hostings, so at least for a few weeks, you can get it like that:

https://mega.nz/file/FM8ilBoI#yebEDO9x50J7r4l2KfTbEiQ_R5BzE5RmXIsivpfyiQE
https://dropmefiles.com/M02hP


Watch the video to see how it all looks like (if you want to see it without training level and how it all in full action, start from 12:00 in the video):

Youtube video of Worlds gameplay in action on AmigaOS4, 1920x1080 full HD

Enjoy and don't forget to check AmigaOS4's readme coming withing archive.


2). Eldritch



Eldritch is a "rogue" game like Minecraft, Barony, and co, and this one didn't use GL4ES, but directly OpenGL ES2. Lots of works were spent
to make it be Big Endian aware (probably the most boring game in that terms) and AmigaOS4 friendly.

Originally developed by David Pittman and published 7 years ago by Minor Key Games. Thanks to code-work done by ptitSeb we can play it on AmigaOS4 as well:



AmigaOS4 port changes:

-- directly using opengles2.library
-- builded with gcc 10.3.0 with -flto
-- many (mean a lot!) of general big-endian changes
-- amigaos4 specific changes

A game needs about 256MB of GPU memory and 512 MB of RAM. As usual, X5000 is preferable.

Please report all the bugs found to my GitHub repo there:

https://github.com/kas1e/Eldritch

See how it all in action:

Youtube video of Eldritch gameplay in action on AmigaOS4, 1920x1080 full HD



3). Gorynlich




Gorynlich (aka Goblinhack v2) is a top-down dungeon romp with single and multiplayer options. The game is written in 2016 by Neil "goblinhack" McGill, and were adapted to works on AmigaOS4 with
the help of ptitSeb (who do the initial port to Pandora and made some necessary optimization and code rewrite) and with tips from the original author.



A game needs 256 MB of GPU memory and 1GB of system memory.

The game was written not as optimal as expected, it was the first game from the author, so don't expect an ultra-speed for "pure 2d game". With big help from ptiSeb and author, i were able to reach decent performance, and so on Radeon RX 560 and x5000, you may expect ~50 FPS.

AmigaOS4 port changes:

-- gl4es is used for OpenGL (so ogles2/warp3dnova)
-- amigaos4 pathes, stack cookie
-- builded with gcc 10.3.0
-- fixes of original game's code bugs
-- global and a big rewriting by ptitSeb to make it fits on machines with low rams
-- speed up changes

The game is open-sourced, and you can find the latest code with AmigaOS4 changes there:

https://github.com/kas1e/Gorynlich

Don't forget to report bugs on https://github.com/kas1e/Gorynlich/issues as well.

And check the video to see how it looks like in action on my x5000:

Youtube video of Gorynlich gameplay in action on AmigaOS4, 1920x1080 full HD


4). Also, there are few re-releases of previously released games, but with a bit of fixes and changes:

4.1). Fricking Shark rerelease :



FrikingShark is a Remake of Taito's classic Flying Shark with a 3D C++ engine that uses OpenGL and OpenAL.



-- Working with all inbuild shaders now. Mean no micro-pauses at the beginning and better visual effects. Shaders enabled by default now (Resources/Scripts/GameGUI.cfg/ItnoreShaderSupport=0)
-- Much improved speed when original game's shaders in use (in original win32 version when shaders in use FPS is worse in compare when they not, for us it better now)
-- faster loading
-- recompiled with GCC 10.3.0 (smaller binary)

video of FrikingShark in action on AmigaOS4, 1920x1080 full HD


4.2). Night of the Zombies re-release :



NIGHT OF THE ZOMBIES it's a first-person shooter where you must survive endless waves of attacking zombies, earning points that may be used to purchase weapons, unlock new areas, etc. Every next round, zombies become stronger, faster, and more hungry!




-- faster loading. Before it was 55 sec to load up everything, now it's 30 seconds.
-- faster speed in the game itself.
-- added FPS counter in the window mode (in the title bar)
-- a much cleaner look of NPOT 2D images
-- fixed "high score" to be empty at the beginning.
-- recompiled with GCC 10.3.0

Youtube video of Night Of The Zombies in action on AmigaOS4, 1920x1080 full HD

4.3). SuperTuxKart re-release :



One of the first Irrlicht based games I was able to deal with is SuperTuxKart 0.8.1:




-- much faster startup: 7 seconds now instead of 17
-- working FBO usage. So now you have a much faster "car choice" screen, as well as an FPS increase in the game itself. Because of which FBO enabled now by default.
-- small speed-ups everywhere: for example, when you choose a level before, there was a little "pause" in sound for 1-2 seconds, now there is almost none.
-- all original shaders coming with game working. (you can see how post-processing (motion blur) shaders working for example in the "Subsea" level when we "accelerates").
-- fixed loading of addons which were broken since hardcoded http://stkaddons.net/ expired in favor of new https://online.supertuxkart.net
-- added data/cert.pem and necessary code to handle SSL connections
-- display FPS is ON by default
-- recompiled with GCC 10.3.0


Youtube video of SuperTuxKart 0.8.1 in action on AmigaOS4, 1920x1080 full HD

5). GL4ES SDK 1.2 update



In the end there first update to GL4ES SDK.

As on os4depot you always have the latest version of SDK, I create a GitHub repo where all versions will be placed. It's always useful to have older versions of SDK in case of some bugs introduced in the last one.

https://github.com/kas1e/GL4ES-SDK/releases/

Remember, that work on SDL1/SDL2 done by Capehill. All I do is wrote a replacement to MiniGL for both SDL libs, so they use GL4ES instead, and pack this all up. Those changes can be found there:

https://github.com/kas1e/SDL1_GL4ES
https://github.com/kas1e/SDL2_GL4ES



So, changes are:

General:

- updated GL4ES Documentation
- updated all libs, see below for changelog.
- everything compiled with GCC 10.3.0

GL4ES (updated till commit done Apr 15, 2021):

- Improve glGetError() handling
- Set default GL version to 2.1 (instead of 2.0) for GLES2.0 backend
- GLSL version 1.2 is defaulit now, instead of GLSL 1.1
- Added ARB_vertex_program and ARB_fragment_program, which is major work by itself and some of notable changes are:
- Added support for Program Matrix from ARB_vertex_program extension
- include support for GradARB variant for texture2D and textureCube built-in functions
- Added ARL and relative addressing support
- Added the ARB vertex shader attribute vertex.attrib
- Added the ARB parameter `state.matrix.texture`
- Added support for ARB_fog_linear
- Added support of ARB_precision_hint_nicest option
- Added 'OPTION ARB_position_invariant' to ARB_vertex_program
- Added sign support for single-value params
- Added support for direct constant in ARB language
- Improved FPE with more compatibility fixes
- Improved Handling of DXTc textures + added some support for DXTc with sRGB textures
- Improve handling of partial mipmapped textures
- Added support for Texture LOD access in Fragment Shaders
- Increased maximum Texture Unit support to 16 (from 8)
- Added support for a program without Vertex Shader
- Some fixes for programs that switch GLX Context frequently.
- Fixes and improvements in fpe_shaders (less array access)
- Added support for Clipping Plane in custom shaders (help OpenMW water reflection)
- Added support for multiple FBO attachment (if hardware support it)
- More optimization on real VBO handling
- Proper handling of gl_ClipVertex

- AmigaOS4 specific changes (by ptitSeb and Daniel):
- Fix: typo in pixel.c, pixel.g was not set
- Cleaning up Logging
- Introduced define GL4ES_COMPILE_FOR_USE_IN_SHARED_LIB so gl4es can be used inside of minigl.library (minigl4gl4es) amiga shared library.
- Additionl extensions GL_MGL_packed_pixels (old Amiga flavour of GL_EXT_packed_pixels) and GL_EXT_compiled_vertex_arrays (note the s at the end, a common typo...)
- build info can be disabled by silence-define
- FPS drawing in its own function so that it can be called from outside in case aglSwapBuffers is not called by the client.
- Improved env var handling.
- Added a BigEndian only fastpath for GL_INT_8_8_8_8_REV <-> GL_UNSIGNED_BYTE conversion (not more slow-route)
- Fixed some conversion involving GL_INT_8_8_8_8(_REV) and GL_BGRA that used 2 passes where 1 would be enough
- Added a few more AmigaOS4 specifics texture format handling, so no conversion needs it at all. Thanks to Daniel for ogles2.library v3.1 where he added new, aos4 only, formats.
GL_AOS4_texture_format_RGB332
GL_AOS4_texture_format_RGB332REV
GL_AOS4_texture_format_RGBA1555REV
GL_AOS4_texture_format_RGBA8888
GL_AOS4_texture_format_RGBA8888REV

- And gazillion of improvements, fixes, dealing with regressions and new features. An actual changelog is _MUCH_ bigger, and there is the only a summary. For the full list go to https://github.com/ptitSeb/gl4es/commits/master

SDL1_gl4es (updated till commit has done Jan 3, 2021, all work done by Capehill):

- Recompiled with GCC 10.3.0
- Merged latest SDL1 official changes, many changes, but nextly count only amigaos4 specific fixes:
- Enabled joysticks support (some missing fix from 2018)
- Change initialization procedure: some apps do not call SDL_Init, but initialize some subsystem only
- Fix issue with HWSURFACE blits

SDL2_gl4es (updated till commit done on Apr 10, 2021, all work done by Capehill):

- Recompiled with GCC 10.3.0
- Merged latest SDL2 official changes, a lot of changes, but nextly count only amigaos4 specific fixes:
- Fixed fast calling of SDL_SetWindowSize + SDL_SetWindowPos combo
- Implement SDL_OpenURL
- Open screens with SA_LikeWorkbench + smart refresh mode
- More controller mappings
- Add Drag n Drop support
- Avoid blitting over window borders
- Use vertex mode when doing Composite to avoid scaling factor issues
- Do endian conversion for textures in order to fix the opengles2 render
- Use BMA_ACTUALWIDTH instead of BMA_WIDTH to calculate the renderer output size
- Use texture blending mode from command queue and simplify composite setup
- Change SYSREQ to PRINTSCREEN
- Fix crash in thread creation
- Fixed compiler warning
- Fix Calling SDL_GetTicks before SDL_Init crashes
- Fixed SDL timer thread consuming CPU
- Reset keyboard state during full screen toggle
- Fix SDL_GetPrefPath
- Add native thread and timer support for AmigaOS 4
- Improve texture filter setup
- Fix VSYNC handling during renderer creation


GLU_gl4es

- No functional changes, only recompiled with GCC 10.3.0.


... Final words ...

So that all for the moment! Hope some of you will find something interesting.

And as usual, want to give a big thank you to:

to ptitSeb for gl4es and all his help with everything: https://github.com/ptitSeb/gl4es/
to Daniel for OpenGL ES2 and all his help with everything: http://www.goldencode.de/
to Hans for Warp3DNova and all his help with everything: https://keasigmadelta.com/
to Capehill for never ended work on SDL1/2, glSnoop, and all his help with everything: https://github.com/AmigaPorts/SDL https://github.com/capehill/glsnoop
to AEON/AmigaKit because of which we have OpenGL ES2 and Warp3DNova: https://www.facebook.com/AEonTechnologyLtd/
to others for all the help and tests




This article comes from AmigaWorld - Amiga Community Portal
https://amigaworld.net

The URL for this story is:
https://amigaworld.net/article.php?storyid=8645