Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
58 user(s) are online (45 user(s) are browsing Forums)

Members: 0
Guests: 58

more...
Support us!
Recent OS4 Files
OS4Depot.net



« 1 ... 33 34 35 (36) 37 38 39 »


Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Quote:

1) Does Lugaru call SDL_GL_SetAttribute?



Yes, that is how initialisation done before we do call to that failing code:

if (!SDL_WasInit(SDL_INIT_VIDEO)) {
        if (
SDL_Init(SDL_INIT_VIDEO) == -1) {
            
fprintf(stderr"SDL_Init() failed: %sn"SDL_GetError());
            return 
false;
        }
    }
    if (!
LoadSettings()) {
        
fprintf(stderr"Failed to load config, creating defaultn");
        
SaveSettings();
    }

    if (
SDL_GL_LoadLibrary(NULL) == -1) {
        
fprintf(stderr"SDL_GL_LoadLibrary() failed: %sn"SDL_GetError());
        
SDL_Quit();
        return 
false;
    }

    for (
int displayIdx 0displayIdx SDL_GetNumVideoDisplays(); ++displayIdx) {
        for (
int i 0SDL_GetNumDisplayModes(displayIdx); ++i) {
            
SDL_DisplayMode mode;
            if (
SDL_GetDisplayMode(displayIdxi, &mode) == -1) {
                continue;
            }
            if ((
mode.640) || (mode.480)) {
                continue; 
// sane lower limit.
            
}
            
pair<intintresolution(mode.wmode.h);
            
resolutions.insert(resolution);
        }
    }

    if (
resolutions.empty()) {
        const 
std::string error "No suitable video resolutions found.";
        
cerr << error << endl;
        
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR"Lugaru init failed!"error.c_str(), NULL);
        
SDL_Quit();
        return 
false;
    }

    if (
commandLineOptions[SHOWRESOLUTIONS]) {
        
printf("Available resolutions:n");
        for (
auto resolution resolutions.begin(); resolution != resolutions.end(); resolution++) {
            
printf("  %d x %dn", (int)resolution->first, (int)resolution->second);
        }
    }

    
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER1);
    
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE1);

    
Uint32 sdlflags SDL_WINDOW_OPENGL SDL_WINDOW_SHOWN;
    if (
commandLineOptions[FULLSCREEN]) {
        
fullscreen commandLineOptions[FULLSCREEN].last()->type();
    }
    if (
fullscreen) {
        
sdlflags |= SDL_WINDOW_FULLSCREEN;
    }
    if (!
commandLineOptions[NOMOUSEGRAB].last()->type()) {
        
sdlflags |= SDL_WINDOW_INPUT_GRABBED;
    }

    
sdlwindow SDL_CreateWindow("Lugaru"SDL_WINDOWPOS_CENTERED_DISPLAY(0), SDL_WINDOWPOS_CENTERED_DISPLAY(0),
                                 
kContextWidthkContextHeightsdlflags);

    if (!
sdlwindow) {
        
fprintf(stderr"SDL_CreateWindow() failed: %sn"SDL_GetError());
        
fprintf(stderr"forcing 640x480...n");
        
kContextWidth 640;
        
kContextHeight 480;
        
sdlwindow SDL_CreateWindow("Lugaru"SDL_WINDOWPOS_CENTERED_DISPLAY(0), SDL_WINDOWPOS_CENTERED_DISPLAY(0),
                                     
kContextWidthkContextHeightsdlflags);
        if (!
sdlwindow) {
            
fprintf(stderr"SDL_CreateWindow() failed: %sn"SDL_GetError());
            
fprintf(stderr"forcing 640x480 windowed mode...n");
            
sdlflags &= ~SDL_WINDOW_FULLSCREEN;
            
sdlwindow SDL_CreateWindow("Lugaru"SDL_WINDOWPOS_CENTERED_DISPLAY(0), SDL_WINDOWPOS_CENTERED_DISPLAY(0),
                                         
kContextWidthkContextHeightsdlflags);

            if (!
sdlwindow) {
                
fprintf(stderr"SDL_CreateWindow() failed: %sn"SDL_GetError());
                return 
false;
            }
        }
    }

    
SDL_GLContext glctx SDL_GL_CreateContext(sdlwindow);
    if (!
glctx) {
        
fprintf(stderr"SDL_GL_CreateContext() failed: %sn"SDL_GetError());
        
SDL_Quit();
        return 
false;
    }

    
SDL_GL_MakeCurrent(sdlwindowglctx);

    
int dblbuf 0;
    if ((
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &dblbuf) == -1) || (!dblbuf)) {
        
fprintf(stderr"Failed to get a double-buffered context.n");
        
SDL_Quit();
        return 
false;
    }


As you can see, before call we have "int dblbuf = 0;".

What is strange, is that it happens only with minigl build. With gl4es build it didn't happens (but, gl4es in my hacked SDL its just replaced minigl parts mostly, through some functions a bit different).

Also the fact that the same code works on all other platforms (win32,linux, etc) make me think it can be something in our SDL.

Quote:

2) what is the error, SDL_GL_GetAttribute returning negative or dblfbuf being zero?


Being zero.

I may try to create simple test case from the code above, and do check it on win32 for example to see how it reacts.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Just popping in
Joined:
2008/3/5 16:34
From France (Bretagne)
Posts: 183
Hi everyone,

Is it normal that The joypad doesn't work with CannonBall (Last SDL2 version) ?

Thanks

_________________
Sam460ex
Os4.1 Final Edition
2GB Fast Memory
envy 24 HT sound card
HD R9 TRIX 280X 3GO GDDR5
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@pseudaxos

Do you remember that it worked earlier? My memory is fuzzy here.

Does last SDL2 version mean the latest OS4Depot version or the latest 2.0.9 RC?

2.0.8 non-debug version has a bug which prevents AmigaInput joysticks being enumerated by SDL. So, if you are using the OS4Depot version, 1) try with the latest RC version from github, or 2) rename the debug version of shared object and try again with that.

At some point OS4Depot 2.0.8 version will be replaced with 2.0.9 release, I hope.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Found intersting bug-feature of iconification.

Problem is: if you have snapshoot icon of sdl2 app not very close to the left border of wb window, then when you press iconify it will be placed not in the next free slot, but on some other place on workbench (place always different, depend where you snapshot in wb window your sdl2 app icon).

See what i mean :

That one allright , when i press iconification (and icon placed in the wb window as first one) it iconfies to next free slot:

http://kas1e.mikendezign.com/aos4/sdl2/iconify_icon_first.jpg

And that one, when i move icon in wb window to some other place , snapshot it (only then, its snapshooting which make it behave strange) and press iconify :

http://kas1e.mikendezign.com/aos4/sdl2/iconify_icon_not_first.jpg

See there icon placed to some other place.


_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

1) Does the icon appear in the snapshot position after the 2nd iconification? If it does, isn't it a correct behavior then?

2) Does the icon have X/Y coordinates before / after snapshot?

From earlier discussion on iconification topic, I get the impression that DiskObject parameters may have some impact on where the icon lands.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Quote:

1) Does the icon appear in the snapshot position after the 2nd iconification? If it does, isn't it a correct behavior then?


Can you explain that one more a bit plz ?

Quote:

2) Does the icon have X/Y coordinates before / after snapshot?


Yes of course it have x/y coordinates after snapshot.

And i found some more info: If icon after snapshooting have X more than 78 (i do not know why exactly that value), then, it didn't show ups in the next free slot by Y, but start to showup at top, close to RAM Disk icon. The more i increase X by snappshot the icon, the more iconified icon moves right on the workbench screen.

So it depend exactly on what X value icon have relative to the WB window in which it opened.

Same happens with Y value, if Y value start to be bigger , then icon after iconification placed down a lot.

Dunno if it should be like this ? I somehow think that does not matter where your icons placed in the WB window : when you do iconify, it just should be in the next free slot doesn't not matter what (imho) ?


Edited by kas1e on 2019/4/6 11:40:53
Edited by kas1e on 2019/4/6 11:41:38
_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

By 1) question I meant that if you snapshot when your icon is for example in (100, 100) coordinate, will the icon appear in (100, 100) position always after that, or some place?

I tried to test this by borrowing the Notepad icon. If I iconify the Notepad application itself, it will appear in the first free location. But if I iconify a testapp that uses Notepad's icon, it will iconify to the position that is stored in the icon. So the behaviour between Notepad and test application is different.

So if we want to ignore icon's position, I guess we have to modify the DiskObject somehow before calling AddAppIcon().

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Quote:

So if we want to ignore icon's position, I guess we have to modify the DiskObject somehow before calling AddAppIcon().


By changing X/Y to 0,0 ? (if it possible to change in DiskObject strcture at all ?)

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Just can't stay away
Joined:
2009/5/1 17:57
From Czech Republic
Posts: 1049
@Capehill, kas1e

If you use a program icon for iconification purposes, you should set the do_CurrentX and do_CurrentY fields in the icon's DiskObject structure to the value of NO_ICON_POSITION. Unless you call PutDiskObject() with the modified DiskObject as parameter, no change will be made to the actual icon on disk, and the icon's original X/Y coordinates will be preserved.

Programs that save their settings as icon tooltypes and, at the same time, use the program icon for iconification purposes, should clone the icon's DiskObject via DupDiskObject(), and only use the clone (with do_CurrentX and do_CurrentY set to NO_ICON_POSITION) for iconification.

_________________
Smoke me a kipper, I'll be back for breakfast!

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Trixie
Thanks ! That " do_CurrentX and do_CurrentY fields in the icon's DiskObject structure to the value of NO_ICON_POSITION" probabaly is way to go in our case.

@Capehill
What you think ? Seems sane enough for us, so we will be independed on X/Y of icon in WB windowses and all will going to the next free slot on main wb screen.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

If it works, why not. Could you write a ticket?

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Yeah, done, #75

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Daniel also fix your issues about --renderer opengles2 , and i do test 2.6 beta of ogles library : yeah, testdraw2 works now. Through, with minigl it give 850 fps, with --renderer opengles2 it give 35 fps :) Like something slowing it down heavy. Or maybe it just switches internally to the software mode by some reassons ?

Because when i run it like "testdraw --renderer opengles2" it open window, then close it, and open again, like switch to something else.

On serial through it says that opening ogles2 context and all fine.

Wasn't test case somehow modified which may slow that testcase down in 30 times ?

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

By default renderer batching is not enabled (this is a new thing, added after official 2.0.9 I think) and this hurts at least the opengles2 renderer. Without patching, each primitive is drawn separately by glDrawArrays.

So, please try:

setenv SDL_RENDER_BATCHING 1

should be 5x faster. Still doesn't beat graphics.library but we are just starting to optimize. For example, as Daniel pointed out earlier, there is glPointSize which is not needed in most (non-point) scenarios. So there might be various optimization possibilities. I think SDL_RenderCopy(Ex) speed is what matters most.

Now, need to debug the rest of drawing.

EDIT: ogles2.library 2.6 is another super fast fix release from Daniel and fixed also testdraw2 for me. Thanks.

@kas1e For me testdraw2 --renderer opengl didn't actually work. I think opengl renderer broke at some point after 2.0.8 release. SDL2 keeps changing and it's sometimes difficult to keep up with them. EDIT2: my bad, it works after all.

But, again, all these "renderer stuff" is about 2D API and we have a pretty good "compositing" backend.


Edited by Capehill on 2019/4/9 17:29:19
   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Quote:

By default renderer batching is not enabled (this is a new thing, added after official 2.0.9 I think) and this hurts at least the opengles2 renderer. Without patching, each primitive is drawn separately by glDrawArrays.

So, please try:

setenv SDL_RENDER_BATCHING 1


Tested : just crashed in ogles2.library :)

Quote:

For me testdraw2 --renderer opengl didn't actually work. I think opengl renderer broke at some point after 2.0.8 release. SDL2 keeps changing and it's sometimes difficult to keep up with them.

But, again, all these "renderer stuff" is about 2D API and we have a pretty good "compositing" backend.


I only tested your testdraw2 binary from bugreport on matnis , and that one for sure works with "--renderer opengl" and giving 410fps for me on minigl.library 2.20.


_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

Yes, MiniGL works. Problem was my own hacked MiniGL build. Daniel's 2.23 works OK. Sorry about confusion.

I'm not seeing the ogles2 crash myself though.


   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
As your testdraw2 from mantis are statically builded, it can't be because of sobjes of anything of that sort .. I only do that setenv about batching, and run testdraw2 --renderer opengles2, and:

Crash log for task "testdraw2"
Generated by GrimReaper 53.19
Crash occured in module ogles2
.library at address 0x7F956044
Type of crash
DSI (Data Storage Interruptexception
Alert number
0x80000003

Register dump
:
GPR (General Purpose Registers):
   
07F95920C 65A87B30 00000002 00000020 00000020 00000008 00000000 65A4B72C 
   8
65A23A38 00000008 00000020 00000000 24842442 633D3958 65A6AE28 65A6ADFC 
  16
16161804 16561804 00000000 00000000 000000C0 000000C0 00000000 00000004 
  24
00000030 00000000 65A4B290 00000004 00000004 65A51C08 65A4B2D0 01000193 


FPR 
(Floating Point RegistersNaN Not a Number):
   
0:              nan                1                1                1 
   4
:                1                0                1              128 
   8
:                1                0              480                0 
  12
:                0     3.40397e-241      4.2301e+160     -1.40631e+11 
  16
:     -1.2121e-212     4.98234e-236     -5.8721e-258     -1.25593e-63 
  20
:     8.32648e+193    -1.96612e-298     3.65377e-220     2.48115e-265 
  24
:    -2.35649e-265     -1.4895e-200     1.15073e-114     2.20245e-226 
  28
:     -1.3764e-260    -1.73819e-264       4.5036e+15       0.00392157 

FPSCR 
(Floating Point Status and Control Register): 0x82024000


SPRs 
(Special Purpose Registers):
           
Machine State (msr) : 0x0002F030
                Condition 
(cr) : 0x00000000
      Instruction Pointer 
(ip) : 0x7F956044
       Xtended Exception 
(xer) : 0x62AA3ED0
                   Count 
(ctr) : 0x00000000
                     Link 
(lr) : 0x62A71EA0
            DSI Status 
(dsisr) : 0x62A71DB0
            Data Address 
(dar) : 0x62A71DC8



680x0 emulated registers
:
DATA825F1900 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
ADDR
6FFA4000 825ED500 00000000 00000000 00000000 00000000 00000000 65A87770 
FPU0
:                0                0                0                0 
FPU4
:                0                0                0                0 



Symbol info
:
Instruction pointer 0x7F956044 belongs to module "ogles2.library" (HUNK/Kickstart)

Stack trace:
    
module LIBS:ogles2.library at 0x7F956044 (section 0 0x5020)
    
module LIBS:ogles2.library at 0x7F959330 (section 0 0x830C)
    
module LIBS:ogles2.library at 0x7F951B24 (section 0 0xB00)
    
testdraw2:AmiglDrawArrays()+0x38 (section 7 0xAFFE0)
    
testdraw2:GLES2_RunCommandQueue()+0x558 (section 7 0x38650)
    
testdraw2:SDL_RenderPresent()+0x7c (section 7 0x240C4)
    
testdraw2:loop()+0xcc (section 7 0x90C)
    
testdraw2:main()+0x33c (section 7 0xC78)
    
native kernel module newlib.library.kmod+0x00002520
    native kernel module newlib
.library.kmod+0x00003234
    native kernel module newlib
.library.kmod+0x00003558
    testdraw2
:_start()+0x170 (section 7 0x16C)
    
native kernel module dos.library.kmod+0x00026724
    native kernel module kernel
+0x0006b268
    native kernel module kernel
+0x0006b2b0

PPC disassembly
:
 
7f95603c4200fecc   bdnz+             0x7F955F08
 7f956040
7d2903a6   mtctr             r9
*7f956044a10a0000   lhz               r8,0(r10)
 
7f956048394a0004   addi              r10,r10,4
 7f95604c
a12afffe   lhz               r9,-2(r10)


100% reproducable

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Not too shy to talk
Joined:
2015/6/11 8:51
From Cologne
Posts: 265
@kas1e
@Capehill
EDIT: nonsene, forget it :P


Edited by Daytona675x on 2019/4/9 18:16:48
_________________
[Facebook] [YouTube Channel]
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@Daytona675x

There was some static analyzer fix recently, dunno if it could be related: https://github.com/AmigaPorts/SDL/comm ... d0bce56aa1c8f5b25b81124ab

So kas1e: you could try to build the master and retest. My testdraw2 binary predates the above fix.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5386
@Capehill
Nope, with latest master still the same. Once batching is set, then crash.

Tested with ogles2.library v2.5 , then with batching there is no crash, but it also didn't work either, just grey window.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top


« 1 ... 33 34 35 (36) 37 38 39 »



[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project