Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
109 user(s) are online (55 user(s) are browsing Forums)

Members: 0
Guests: 109

more...

Headlines

 
  Register To Post  

« 1 2 3 (4) 5 6 7 ... 18 »
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

Filesystem may need porting but smart_ptr and format likely not. SuperTux uses OpenGL or SDL Renderer. I didn't look further but I suppose it can be compiled without OpenGL if necessary.

You can check the serial log after HW_SURFACEs have been enabled: https://github.com/capehill/os4sdl/blo ... os4/SDL_os4surface.c#L414

Go to top
Re: SDL1 open issues
Quite a regular
Quite a regular


See User information
wrong thread, sorry

Retired
Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
Based on your expirience with SDL, how hard it will be to add OpenGLE2 support to SDL1 ? I mean what need to be done for, some lots of new code ? Is it "only" about creating video/amigaos4/SDL_os4gles.c taken SDL_os4gl.c as example ?


Edited by kas1e on 2018/2/8 21:43:43
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

How do yo plan to select the library? IIRC there is no hint subsystem or version attributes in SDL1. You could use a flag maybe.

It's not necessarily very hard but code can get more messy. It would be a good idea to refactor the code a bit at the same time, use separate files etc.

But SDL1 is a dead horse. I would rather port application to SDL2.

Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
For us on aos4 when we port things, its still most if time sdl1 :( imagine rewrite 20 apps from sdl1 to sdl2 just to make a port of some game :)

But yeah, if choice to where spend resources, then sdl2 for sure

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehil
Need some help :) I want to try to add GL4ES to the SDL1 (so to try to port some SDL1/opengl apps to see how it will behave).

And question is: how to do it all right and easy, without much problems. Even currently enough to have only gl4es instead of minigl, no problems for local tests.

gl4es is just a static link library, + standard mesa's GL/gl.h include + #include <proto/ogles2.h>. But no need to open ogles library, it is all handled inside of gl4es already.

I see there:
https://github.com/capehill/os4sdl/blo ... ideo/amigaos4/SDL_os4gl.c

os4video_GL_Init - that one understandable, can swap on ogles2
os4video_GL_Term - that one too
os4video_GL_GetAttribute - that one can keep as it
os4video_GL_MakeCurrent - can keep as it
os4video_GL_SwapBuffers - can keep as it


But then, os4video_GL_GetProcAddress() and os4video_GL_LoadLibrary() - are it need it for me if it not amiga library ?

I also found https://github.com/capehill/os4sdl/blo ... migaos4/SDL_os4_wrapper.c

There is list of not implemented/implemented functions , that probably also do not need ?

In other words, is it enough to just fast hack SDL_os4gl.c, or its all tied into SDL more deeply ?

Of course will be cool to add it somehow "normal", i.e. to have and minigl, and gl4es , and or in SDL progs add a flag, or, instead, at compiler-runtime do use something like --os4opengl=minigl or --os4opengl=gl4es (or if add later opengles2), --os4opengl=ogles2

EDIT: Damn, there is also amigaos4/SDL_os4video.c which need adapting from minigl to gl4es :(

EDIT2:

Hm, minigl have that (from SDL_os4gl.c):

Quote:

MGLCC_FrontBuffer, hidden->m_frontBuffer,
MGLCC_BackBuffer, hidden->m_backBuffer,


While OGLES context didn't have those front/back buffers, but whole thing in os4gl.c based on them. For example in os4video_GL_SwapBuffers that all used.


Edited by kas1e on 2018/2/22 21:27:06
Edited by kas1e on 2018/2/22 22:36:59
Edited by kas1e on 2018/2/22 23:39:51
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

I would create another backend file for gl4es and choose that at compile time, or via some switch/flag later. For example SDL might fallback to MiniGL if it cannot open OGLES2 context.

You need to be able to get function addresses, it's an SDL feature. You need the ProcAddress mechanism. If gl4es has it internally you may not need a wrapper table then.

If you link gl4es statically, then there cannot be .so with this feature and this must be considered with license of ported application, SDL1 and gl4es. gl4es license looks liberal, SDL1 is LGPL, application licenses depend.

Heading for work now, might read some code during weekend...

Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
Thanks for insign !

With help of gl4es author i just hack gl4es support into sdl1:

Resized Image

You can see there in console behind output from gl4es debug.

That whay i do:

1. completely remove content of SDL_os4_wrapper.c (so 0 bytes), and then it didn't include all those SDL_os4_notimplemented_funcs.t and SDL_os4_notimplemented_table.t

2. in the SDL_os4video.h, at end of SDL_PrivateVideoData structure replaced struct GLContextIFace *IGL; on void *IGL; (so for ogles2 context)

3. in the SDL_os4video.c , in the os4video_AllocateOpenGLBuffers() , commented out:

Quote:

#if 0
hidden->IGL->MGLUpdateContextTags(
MGLCC_FrontBuffer,hidden->m_frontBuffer,
MGLCC_BackBuffer,hidden->m_backBuffer,
TAG_DONE);

hidden->IGL->GLViewport(0,0,width,height);
#endif


4. And new SDL_os4gl.c:

/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2006 Sam Lantinga

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Sam Lantinga
    slouken@libsdl.org
*/
#include "SDL_config.h"

#include <proto/ogles2.h>
/*
 * GL support for AmigaOS 4 using GL4ES->OGLES2
 */

#if SDL_VIDEO_OPENGL

#include "SDL_os4video.h"
#include "SDL_os4utils.h"
#include "SDL_os4blit.h"

#include <proto/exec.h>
#include <proto/intuition.h>

#include <GL4ES/gl.h>

//#define DEBUG
#include "../../main/amigaos4/SDL_os4debug.h"


voidaglGetProcAddress(const char *);  // gl4es's aglGetProcAddress
void amiga_pre_swap(); // from gl4es to make working aglSwapBuffers()
void amiga_post_swap(); // from gl4es to make working aglSwapBuffers()


/*
 * initialize OGLES2 context
 */
int os4video_GL_Init(_THIS)
{

    
struct SDL_PrivateVideoData *hidden _this->hidden;
    
    
dprintf("Initializing GL4ES->OGLES2.. ");

        
     
hidden->IGL=IOGLES2->aglCreateContextTags(0,
                
OGLES2_CCT_WINDOW,(ULONG)hidden->win,
                
OGLES2_CCT_DEPTH,16,
                
OGLES2_CCT_STENCIL,8,
                
OGLES2_CCT_VSYNC,0,
                
OGLES2_CCT_SINGLE_GET_ERROR_MODE,1,
            
TAG_DONE);


    if (
hidden->IGL)
    {
        
_this->gl_config.driver_loaded 1;
    
        
IOGLES2->aglMakeCurrent(hidden->IGL);        
        
        
hidden->OpenGL TRUE;

        return 
0;
    }
    else
    {
        
_this->gl_config.driver_loaded 0;
        
SDL_SetError("Failed to create OGLES2 context");
    }

    return -
1;

}

void os4video_GL_Term(_THIS)
{

}

int    os4video_GL_GetAttribute(_THISSDL_GLattr attribintvalue)
{
   return 
0;
}

int    os4video_GL_MakeCurrent(_THIS)
{
    return 
0;
}

void os4video_GL_SwapBuffers(_THIS)
{

    
amiga_pre_swap();
    
// Swap the Buffers!
    
if(IOGLES2) {
        
IOGLES2->aglSwapBuffers();
    }
    
amiga_post_swap(); 
     
}


void *os4video_GL_GetProcAddress(_THIS, const char *proc) {
    
void *func NULL;

    if ( !
_this->gl_config.driver_loaded )
    {
        if (
os4video_GL_Init(_this) != 0)
        {
            return 
NULL;
        }
    }

    
func = (void *)aglGetProcAddress(proc);
    return 
func;
}

int os4video_GL_LoadLibrary(_THIS, const char *path) {
    
/* Library is always open */
    
_this->gl_config.driver_loaded 1;

    return 
0;
}
#endif


Through, that only sme hack, and probably nothing else except test-cases will works. As you see i delete there everything, keep only simple main things so to check if it works, and it is.

We just need to think now how to implement it all in normal way. I think fallback to minigl will be wrong, as it all can runs, looks wrong, and everyone who have no ogles2 will think that app/game broken. Better "sorry, its is only for ogles2".

As for how it all handle : from one side, compile everything in, is good and then choice by flag. But then, need to touch SDL code then all the time to add that flag. From another side, if we do not want to touch sdl code, and choice what to make inbuild in SDL, then.. then there will be different link libs, like libsdl_mgl.a, libsdl_gl4es.a , libsdl_ogles2.a which dunno, kind of suck too..


Edited by kas1e on 2018/2/23 11:26:21
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
And something still seems wrong somewhere about SDL_GetTicks() when builded with "make -f makefile.amigaos4"

For sake of tests i then just re-downloaded https://github.com/capehill/os4sdl , latest master build. Then "makefile -f makefile.amigaos4". And once i port any game which have SDL_GetTicks() in , it always crashes on it.
I.e. its even without GL4ES changes i do.

Through, some simpler test cases (like SDLgears, which do use SDL_GetTicks() too : works).

I also tried to rebuild it with (just in case, as i remember that works before):

Quote:

./configure --build=i686-pc-cygwin --host=ppc-amigaos --disable-shared --enable-static --disable-pthreads


It builds fine too, but then, the same crashes in SDL_GetTicks() :(

I then build prove-to-be-working-in-past version from adtools repo (via the same ./configure line), and it works ! No crashes in SDL_GetTicks()! Apply GL4ES changes: still works.

So..

That mean, is that we do broke it or when do changes in terms of removing of pthreads support (not remove it fully?), or when update to 1.2.15 , or when change configure scripts.


Edited by kas1e on 2018/2/23 12:45:12
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

Need references to crashing code. Most likely timer initialization wasn't done properly. As I wrote earlier in this thread, there was suddenly a problem with .so where library constructor functions were not called at all(!). So I just call the constructors manually from SDL_Init. I hope your code called SDL_Init..

Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
Quote:

Need references to crashing code.

You mean stack trace ? Or packed/ready-to-build source code ?

Quote:

I hope your code called SDL_Init..


Of course :) Its 2 games i tested which i already ported over old versions of SDL1, and which works, they for now just crashes in SDL_GetTicks().

In one game it called like this:

Quote:

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)


In another one it called like this:

Quote:

SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE


Both games didn't crashes on version from adtools when builded via configure;make with --disabled-pthreads.


Edited by kas1e on 2018/2/23 17:06:07
Edited by kas1e on 2018/2/23 17:27:48
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

Minimal problematic source code would be the best. Can you make some of the tests crash, for example? Last time I tried, they worked 99% OK.

Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
If minimal is possible :) Simple test case with SDL_GetTicks() works, but when it used in the games, then crashes. Once i rebuild it against version on adtools, then no crash.

I may try to reduce games code step by step, and then will have small test case, but it will take time.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
Need more information. Stack trace and source code would be a start.

I made a test program that calls SDL_GetTicks()/SDL_Delay() combo in a loop and can't make it crash, static or shared.

Maybe its related to threads.

Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
Quote:

Maybe its related to threads.


Very very possible. As simple test-apps didn't crash , only games. And its about threading which was removed/workorounded after adtools version => very possible that its threads.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

Pthreads were only removed in the native makefile. Configure+make build did already use native threads years ago.

Maybe you could add some serial debug here:

https://github.com/capehill/os4sdl/blo ... igaos4/SDL_systimer.c#L51

Print ITimer pointer before using it. Optionally add NULL pointer check around code.


Edited by Capehill on 2018/2/24 13:34:20
Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
Quote:

Pthreads were only removed in the native makefile. Configure+make build did already use native threads years ago.


To clear it up a bit:
-- your version builded with native makefile => crash
-- your version builded with conigure/make/disabled pthreads =>crash
-- adtools version builded with native makefile => crash
-- adtools version builded with conigure/make/disabled pthreads => WORKS

Quote:

Maybe you could add some serial debug here:

https://github.com/capehill/os4sdl/blo ... igaos4/SDL_systimer.c#L51

Print ITimer pointer before using it. Optionally add NULL pointer check around code.


Yes, will do so.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehil
Ok, i just do:

Uint32 SDL_GetTicks(void)
{
    
printf("we inside of SDL_GetTicks!\n");
    
    
extern struct TimeVal os4timer_starttime;
    
struct TimeVal cur;

    
    
printf("ITimer pointer = %p\n", (void*)ITimer);
    
printf("now we before ITimer->GetSysTime\n");
    
ITimer->GetSysTime(&cur);
    
printf("now we before ITimer->SubTime\n");
    
ITimer->SubTime(&cur, &os4timer_starttime);

    return 
cur.Seconds 1000 cur.Microseconds 1000;
}


And have:

Quote:

we inside of SDL_GetTicks!
ITimer pointer = 0x0
now we befoer ITimer->GetSystTime
<CRASH>


Probably there no needs for crashlog, as ITimer is just null ?

When i build adtools vesion with ./cofnigure;make and --disabled-pthreads, then, doing the same prinfs in the same place, give me pointer address and all works fine.

Question is: why it works only in adtool's version, and only when build with ./configure;make --disabled-pthreads, and not, when build with native makefile, or even with ./configure;make, but without disabling of pthreads.

As configuring process make no changes in os4 source files, but only to SDL_Config.h and related to sdl non_os4 files, then it imho somewhere some flag, or ifdef, or kind of missed/skipped/sets wrong.

Sure there is bug anyway, as it just didn't works with pthreads at all, but for first need to understand what is differences between build of your version and adtools version, when they both builds with configure;make --disabled-pthreads, but adtools one works, and your one are not.


Edited by kas1e on 2018/2/26 11:45:25
Edited by kas1e on 2018/2/26 11:48:15
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Home away from home
Home away from home


See User information
@Capehill
After just searching in whole .h files on the word "THREAD" (case sensetive) , and to compare them with your version, and with version from adtools, i can see that SDL_thread.h a bit different, as well as SDL_thread.c. But swapping them from adtools version over to your one, didn't fix problem, and ITimer still 0x0.

Then i just checked SDL_os4timer.c files, and they really different. In your one all is "simple" , without any INIT , without any:

Quote:

void _INIT_os4timer_startup(void) __attribute__((constructor));
void _EXIT_os4timer_shutdown(void) __attribute__((destructor));


While adtools's version have that.

For sake of tests i just swap out SDL_os4timer.c from adtools over our one , then do change in the SDL.c os4timer_init on os4timer_Init (as it in adtools version like this). Recompile, build, run : Pointer here !

So, something happens when refacturing and changes was done in the os4timer related code since adtools version.


Edited by kas1e on 2018/2/26 12:23:47
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL1 open issues
Just can't stay away
Just can't stay away


See User information
@kas1e

It's Autolib (-lauto) which gets the interface for ITimer on your behalf. Otherwise you have to get it yourself. I have not checked any of those source files you listed. But one of those init functions handles it most likely. Or in some of the makefiles the Autolib is enabled and in some of them it's missing.

With libraries:
IntuitionBase=(struct Library *)IExec->OpenLibrary("intuition.library",53);
IIntuition=(struct IntuitionIFace *)IExec->GetInterface(IntuitionBase,"main",1,NULL);


With devices:
TimerIO=(struct TimeRequest *)IExec->AllocSysObjectTags(ASOT_IOREQUEST,ASO_NoTrack,FALSE,ASOIOR_ReplyPort,TimerPort,ASOIOR_Size,sizeof(struct TimeRequest),TAG_DONE);
if (
TimerIO!=NULL)
{
 
TimerDev=IExec->OpenDevice("timer.device",UNIT_MICROHZ,(struct IORequest *)TimerIO,0);
 if (
TimerDev==0)
 {
  
ITimer=(struct TimerIFace *)IExec->GetInterface((struct Library *)TimerIO->Request.io_Device,"main",1,NULL);
 }
}


Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top

  Register To Post
« 1 2 3 (4) 5 6 7 ... 18 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project