Okay. We have pthreads now in CLIB2 and progress is being made with a C library for which we have source code access to. Who knows when extra features to newlib will happen.
For that reason, I continued on my quest to make improvements to mednafen.
Rather than the necessary hacks I needed to add to the mednafen source code to ensure successful builds against newlib, due to a great, but outdated 2004/5 version of pthreads, I wanted to link with CLIB2 instead of newlib.
It has been a success, but it required that a number of library be compiled with CLIB2. This, at least for mednafen, included "porting" libFLAC to CLIB2. It also required building GL4ES / SDL2_GL4ES with CLIB2.
What I am noticing is outdated libraries on OS4Depot that are linked against NEWLIB. Going forward, we probably always want to offer both. But, I worry that the LHA files and their original owners on OS4Depot are either inactive or will never update to include CLIB2 / newer versions on those libraries.
I wonder how we can solve that issue.
Tonight, I compiled bleeding-edge GL4ES using CLIB2 commit: 44cdcded7653ec5f3cc845b1b0e28c78f6f2b4d3 (this included the merged back pthreads branch). Before I say the following, I thank @kas1e, @capehill, @hans for all the work. But, I kind of needed to figure out how to build SDL2 + GL4ES on my own. @kas1e already has the GL4ES SDK, but it is with an older version of SDL2. I built SDL2@version 2.0.22 against CLIB2 - fine. I was then confused how to create SDL2 + GL4ES changes. Actually, it did not seem to be that complicated.
It was a matter of grabbing the Amiga SDL2 port and then applying the following patch file:
#if SDL_VIDEO_OPENGL_ES2
if (OS4_IsOpenGLES2(_this)) {
diff --git a/src/video/amigaos4/agl.h b/src/video/amigaos4/agl.h
new file mode 100755
index 0000000..4400f09
--- /dev/null
+++ b/src/video/amigaos4/agl.h
@@ -0,0 +1,32 @@
+#ifndef _AGL_H_
+#define _AGL_H_
+
+#ifndef EXEC_TYPES_H
+#include <exec/types.h>
+#endif
+#ifndef EXEC_EXEC_H
+#include <exec/exec.h>
+#endif
+#ifndef EXEC_INTERFACES_H
+#include <exec/interfaces.h>
+#endif
+
+#ifndef GRAPHICS_GFX_H
+#include <graphics/gfx.h>
+#endif
+
+#ifndef OGLES2_OGLES2_DEFS_H
+// it would be better to have an include with only the CreateContextTags enum difed, to avoid conflict
+// of other typedef with full OpenGL header file...
+#include <ogles2/ogles2_defs.h>
+#endif
+
+void* aglCreateContext2(ULONG * errcode, struct TagItem * tags);
+void aglDestroyContext(void* context);
+void aglMakeCurrent(void* context);
+void aglSwapBuffers();
+void aglSetBitmap(struct BitMap *bitmap);
+void aglSetParams2(struct TagItem * tags);
+void* aglGetProcAddress(const char* name);
+
+#endif //_AGL_H_
\ No newline at end of file
To the SDL2@released 2.0.22 branch. However, I am not sure if this is exactly correct!
The only issue I ran into was an undefined reference to:
OS4_GetWindowActiveSize
In order to get around that, I just hacked in some values for Height and Width - but I would like to get an idea of where that function went. Recall, that I am using the latest bleeding-edge GL4ES combined wth SDL2.0.22.
In any case, so far, Mednafen is running quite well with out DSI errors probably due to the bleeding-edge CLIB2 changes and the pthread support. A lot of the hacks I had to add could be removed such that the code base is a lot more closer to Mednafen version 1.29.
The points are: - What happened to OS4_GetWindowActiveSize - How can we all come together to ensure that CLIB2 versions of SDK/Library/Dev LHAs are available - What about those that have uploaded versions of libraries from a few years ago that are only built with NEWLIB
Regards.
If liberty means anything at all, it means the right to tell people what they do not want to hear. George Orwell.
@rjd324 For sdl1/2 gl4es changes they easy yes, and on my github acc. I plan to update sdk soon with both clib2 and newlib versions as well and all libs too, but that can take some time and for you will be faster to apply changes yourself. I do have local builds of gl4es and sdls-gl4es for clib2 if need it.
As for os4depot stuff, if archive not mantained, you can replace it (it handled by os4depot admins). Especially if it was configure and make only. If it differs too much, with amiga specific changes in original archive, then you put old version inside of your archive or create different name for your upload.
Some years ago both clib2 and newlib versions were done offten by devs, but then when newlib progress and clib2 not, ppls start to ditch clib2, but now when afxgroup improve clib2 much and in end opensource clib2 is much better to work with in compare with newlib (fixes of which take years to be released) its again mean clib2 versions will happen too.
Remember at moment you can't use shared objects because you have to patch ad tools or try to use specs file included on github. I've also added the file you should replace in adtools
Well, the GetWindowActiveSize was removed in a much later version. So that explains it. Just a synchronisation issue between non-exact dates.
Can live with that for now, and just apply some code changes.
===
Let me be more clear. It is the fact that I applied the GL4ES additions patch from exactly: https://github.com/kas1e/SDL2_GL4ES/co ... 8b63e66ace2ebe5dae6e8288d (this patch was for an older version of SDL, and the changes - themselves, have probably moved on) to the 2.0.22 SDL release code.
Thankfully, not too much change, so it was not really a problem.
Edited by rjd324 on 2022/9/3 15:02:09 Edited by rjd324 on 2022/9/3 15:02:41
If liberty means anything at all, it means the right to tell people what they do not want to hear. George Orwell.
@Sinan I do compile SDL2/newlib version now easy by downloading latest irrlicht code from my github, and changing as i say in include/IrrCompileConfig.h that:
This line is 100% necessary or you will have black screen when will use opengl apps.
I do try to rebuild for SDL1/clib2 now as well, and it also did compiles fine, without undefs to SDL_putenv, but with issues with my own swprintf.cpp which do use _REENT stuff , which can't be added to clib2 for now, only when it will be clib2.library. And this swprintf already implemented in clib2, so need commenting out.
If you didn't have this issue, but instead have issue with SDL_putenv() then something wrong happens on your side and maybe you mix again newlib/clib2 builds. Very possible that you didn't add -mcrt=clib2 everywhere (as there and gcc and g++ used in irrlicht).
Quote:
Can you share your irrlicht clib2 so that I can compare ?
Give me few hours, i will rebuild everything with gcc11.3.0 and all latest stuff.
@Sinan While building stuff, found that there indeed issue with SDL_putenv with SDL1 when build for new clib2 and g++. But in end, SDL_putenv is simple redefine to putenv(), so this simple test case reproduce issue:
#include <stdlib.h>
char env[] = "asdfasdfas";
int main()
{
putenv(env);
}
And then: ppc-amigaos-gcc -mcrt=newlib test.c - compiles fine, warning less ppc-amigaos-g++ -mcrt=newlib test.c - compiles fine, warning less
ppc-amigaos-gcc -mcrt=clib2 test.c - compiles fine, but do bring warning ppc-amigaos-g++ -mcrt=clib2 test.c - not compiles, and bring error.
But on GCC 8.3.0 + older clib2 (afxgroup's one, just not the latest) it surely works before.
But just unpacking, go to bin/amigaos4/ directory and run test case (and when run, chooice opengl in the shell).
If it works, then at least gl4es itself, sdl1_gl4es and irrlicht for clib2 is working with all latest stuff , so i can then next made SDL2 version of irrlicht and sdl2_gl4es as well
@Sinan What about FPS ? (top of the window), the same more or less ?
in SDL1 it's "alt+f4" for close, do not remember why so, probabaly just forgotten "esc", need to add if so.
So, that mean that SDL2 compiles and works fine, just with the change i quoted above.
This also mean all fine, and there are all clib2 stuff : all compiled over gcc 11.3.0. Everything of latest versions from sources (irrlicht from my page, gl4es from ptitseb's one, sdl1/sdl2 from capehill's latest ones), and all build over clib2 beta-07 from Andrea:
I dealt with it. But it is really important for us to make progress that there is a central location. If you can update your gl4es SDK with both SDL and SDL2 that would be great.
Regards.
If liberty means anything at all, it means the right to tell people what they do not want to hear. George Orwell.
Don't understand what are/do those files in achive you posted (sdl1/sdl2). Do I run them alone? Or with quake (1, 2?!?!??) datafiles? or with yout irrlitch engine data (os4depot)?
sorry for being so dumb ¿:-/
EDIT: ok runnign frrom shell (stack 1000000) both work ok. EDIT2: got ~33fps (RX550, PowerPrefs set to dynamic & high), using OpenGL 1.5 driver (a). EDIT3: SDL1 can move with cursor keys, but with SDL2 they don't work, just mouse for "moving" view.
Edited by jabirulo on 2022/9/6 22:06:25 Edited by jabirulo on 2022/9/6 22:08:43 Edited by jabirulo on 2022/9/6 22:10:42 Edited by jabirulo on 2022/9/6 22:14:35
@Javier Something VERY wrong on your side. It should be 260 FPS and not 33 (at least on my side it is). PowerPrefs should be not dynamic, but HIGH.
You probablay on running of examples choose software renderer by mistake, or something of that sort, you should choose exactly "OpenGL" driver (check for correct letter twice). I.e. you run example, and when it ask for driver, hit "a", not "d" or "e". Because 33 FPS it is kind of what you have with software rendering and/or burning video driver (which also software rendering, just a bit heavier).
I also get 34 fps on my Sam460+RX-550 (Power Prefs - Set To High) with SDL2 version...
Here is output
LIBGL: Initialising gl4es
LIBGL: v1.1.5 built on Sep 6 2022 18:31:35
LIBGL: Using GLES 2.0 backend
LIBGL: Using Warp3DNova.library v54 revision 16
LIBGL: Using OGLES2.library v3 revision 3
LIBGL: OGLES2 Library and Interface open successfuly
LIBGL: Targeting OpenGL 2.1
LIBGL: Not trying to batch small subsequent glDrawXXXX
LIBGL: try to use VBO
LIBGL: Force texture for Attachment color0 on FBO
LIBGL: Hack to trigger a SwapBuffers when a Full Framebuffer Blit on default FBO is done
LIBGL: Current folder is:/RAM Disk/bin/AmigaOS4
Please select the driver you want for this example:
(a) OpenGL 1.5
(b) Direct3D 9.0c
(c) Direct3D 8.1
(d) Burning's Software Renderer
(e) Software Renderer
(f) NullDevice
(otherKey) exit
a
Irrlicht Engine version 1.8.4
SDL Version 2.24.0
LIBGL: Hardware test on current Context...
LIBGL: Hardware Full NPOT detected and used
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: FBO are in core, and so used
LIBGL: PointSprite are in core, and so used
LIBGL: CubeMap are in core, and so used
LIBGL: BlendColor is in core, and so used
LIBGL: Blend Subtract is in core, and so used
LIBGL: Blend Function and Equation Separation is in core, and so used
LIBGL: Texture Mirrored Repeat is in core, and so used
LIBGL: Extension GL_OES_mapbuffer detected
LIBGL: Extension GL_OES_element_index_uint detected and used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_texture_float detected and used
LIBGL: Extension GL_AOS4_texture_format_RGB332 detected
LIBGL: Extension GL_AOS4_texture_format_RGB332REV detected
LIBGL: Extension GL_AOS4_texture_format_RGBA1555REV detected and used
LIBGL: Extension GL_AOS4_texture_format_RGBA8888 detected and used
LIBGL: Extension GL_AOS4_texture_format_RGBA8888REV detected and used
LIBGL: high precision float in fragment shader available and used
LIBGL: Extension GL_EXT_frag_depth detected and used
LIBGL: Max vertex attrib: 16
LIBGL: Max texture size: 16384
LIBGL: Max Varying Vector: 32
LIBGL: Texture Units: 16/16 (hardware: 32), Max lights: 8, Max planes: 6
LIBGL: Extension GL_EXT_texture_filter_anisotropic detected and used
LIBGL: Max Anisotropic filtering: 16
LIBGL: Max Color Attachments: 1 / Draw buffers: 1
LIBGL: Hardware vendor is A-EON Technology Ltd. Written by Daniel 'Daytona675x' Müßener @ GoldenCode.eu
LIBGL: GLSL 300 es supported
LIBGL: GLSL 310 es supported and used
Using renderer: OpenGL 2.1
GL4ES wrapper: ptitSeb
OpenGL driver version is 1.2 or better.
GLSL version: 1.2
Vertex shader compilation failed at position 585:
Invalid token
Pixel shader compilation failed at position 580:
Invalid value (implicit param?)
Vertex shader compilation failed at position 605:
Invalid token
Pixel shader compilation failed at position 586:
Invalid value (implicit param?)
Loaded texture: e7walldesign01b.jpg
Loaded texture: e7steptop2.jpg
Loaded texture: e7dimfloor.jpg
Loaded texture: e7brickfloor01.jpg
Loaded texture: e7bmtrim.jpg
Loaded texture: e7sbrickfloor.jpg
Loaded texture: e7brnmetal.jpg
Loaded texture: e7beam02_red.jpg
Loaded texture: e7swindow.jpg
Loaded texture: e7bigwall.jpg
Loaded texture: e7panelwood.jpg
Loaded texture: e7beam01.jpg
Loaded texture: xstepborder5.jpg
Loaded texture: lavahell.jpg
Loaded texture: e7steptop.jpg
Loaded texture: metalblackwave01.jpg
Loaded texture: pjrock1.jpg
Loaded texture: timlamp.tga
Loaded texture: gratetorch2.jpg
Loaded texture: gratetorch2b.tga
Loaded mesh: 20kdm2.bsp
Needed 47ms to create Octree SceneNode.(92 nodes, 10640 polys)
Quit SDL
LIBGL: Shuting down
LIBGL: Saved a PSA with 2 Precompiled Programs