Skip to main content

News

Topic: neoSphere 5.10.0 (Read 1574839 times) previous topic - next topic

0 Members and 45 Guests are viewing this topic.
  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1935
What I'm basically trying to do is, as part of registering the Sphere v2 API:

Code: (javascript) [Select]
DirectoryStream.prototype[Symbol.iterator] = dirStreamEnumerationCallback;

CC has JsGetPropertyIdFromSymbol() that I can use for this purpose but I need a JsValueRef for Symbol.iterator first.
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1936
JSGetOwnPropertySymbols and dump the results with printf or akin (following some conversions) and see what you find? Probably painful and tedious... But may work?

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1937
To be clear, it's not really a huge problem: I can just do eval("Symbol.iterator") since it only happens during engine initialization while the JS context is still "trusted", so to speak.  I just would have preferred a more elegant solution is all. ;)

Don't worry, I have (almost) everything all figured out. :)
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1938
I decided to rewrite the abstraction layer to use Duktape's stack model instead of direct-drive.  A stack machine is easy to implement and this will make it easier to support both engines with conditional #defines.  Plus I don't have to manually release references this way.
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1939
Intermittent drawing errors...

The worst kind of bug, at least I think it's a bug...

I've been opening and closing miniSphere a lot whilst testing map drawing and I've noticed something that could be quite an issue. Sometimes the drawing just doesn't work inexplicably.

As an E.g.  Since beginning to type this post I've started sphereRun 3 times, twice it came up perfectly and showed the sprite I'm using walking around albrook.

On the third attempt (with no changes to the code) it gave me a black screen - I got some log outputs I'd put in showing it had progressed through the code and pressing escape will quit (something in the dispatch update script the code sets) but nothing is drawn.

Other times it draws only some of what is intended but then continues to draw that subset, perhaps implying that the draw that failed was one of the steps where a layer was created hence that layer is blank but other layers are being drawn.

If relevant I'm using version 4.8.2 (I think - sorry too many releases recently for me to keep up building each one)

Any thoughts?

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1940
Try again after upgrading to 4.8.4.  Seriously, not trying to be a wise guy here.  I fixed a bunch of bugs in 4.8.3 related to handling of projection and modelview matrices that could be the case of your problems here.
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1941
Try again after upgrading to 4.8.4.  Seriously, not trying to be a wise guy here.  I fixed a bunch of bugs in 4.8.3 related to handling of projection and modelview matrices that could be the case of your problems here.
Ok, I'll build 4.8.4. I note however that the issue definitely occurs with no projection matrix being used - but if there were issues with model view matrices, hopefully that will be it.

But my map loading code is probably particularly torturous in that it uses lots of transformations and generates multiple surfaces that it fills with content and converts to images and it changes shader several times.

The current set of results just seems like from time to time miniSphere (or possibly allegro) says: "no I'm not going to do that step, you're asking too much".

EDIT: I really should have a faster build method....
My current process for each new version is:
1. download zip of the source
2. replace source of previous version in project folder with new source
3. edit in the path hack
4. manually check for any new files or renamed files and update the build rules for them
5. build each component separately, remembering to remove the path hack for sphererun
  • Last Edit: August 23, 2017, 04:01:34 pm by Rhuan

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1942
I think I found a new issue in 4.8.4, or maybe it's an intentional change?

I've found I need to rewrite calls like this:
require('assert');
as
require('#/modules/assert.js');

Any attempts to call the mini_rt modules in the "normal" way just throws a not found error.

I've tested this using sphereRun (which has no pathhack) as well as miniSphere with the path hack so I'm confident it's not related to that - also #/modules/ works, which surely uses the same function under the hood?

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1943
I reorganized the modules recently, did you start from a clean source?  It might be picking up the old layout and getting confused...
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1944
Yeah I hadn't twigged that you'd changed the folder structure - I'd put the newly compiled binaries into my existing sphere folder and not changed the folder layout so of course it didn't work.

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1945
As mentioned in my MSEngine topic, I've noticed an issue with the screen shimmering, I thought it was because of how I was playing with textures too much but it hasn't gone away when I've simplified the render process :(.

On a different topic I'm afraid the intermittent drawing failures remain, also I've been getting seg faults that may or may not be related, this first one came after a test in which nothing was displayed on the screen, I then pressed escape to quit and that triggered the crash.
Code: [Select]
Crashed Thread:        3

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
*** error for object 0x7ffcb9e58720: incorrect checksum for freed object - object was probably modified after being freed.
 

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        0x00007fffdd02a34a mach_msg_trap + 10
1   libsystem_kernel.dylib        0x00007fffdd029797 mach_msg + 55
2   com.apple.CoreFoundation      0x00007fffc7784434 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation      0x00007fffc77838c1 __CFRunLoopRun + 1361
4   com.apple.CoreFoundation      0x00007fffc7783114 CFRunLoopRunSpecific + 420
5   com.apple.HIToolbox           0x00007fffc6ce3ebc RunCurrentEventLoopInMode + 240
6   com.apple.HIToolbox           0x00007fffc6ce3cf1 ReceiveNextEventCommon + 432
7   com.apple.HIToolbox           0x00007fffc6ce3b26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
8   com.apple.AppKit              0x00007fffc527ca54 _DPSNextEvent + 1120
9   com.apple.AppKit              0x00007fffc59f87ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
10  com.apple.AppKit              0x00007fffc52713db -[NSApplication run] + 926
11  sphererun                     0x000000010c78913e _al_osx_run_main + 1312
12  sphererun                     0x000000010c7df5c9 main + 16
13  libdyld.dylib                 0x00007fffdcf03235 start + 1

Thread 1:
0   libsystem_kernel.dylib        0x00007fffdd03244e __workq_kernreturn + 10
1   libsystem_pthread.dylib       0x00007fffdd11c48e _pthread_wqthread + 1023
2   libsystem_pthread.dylib       0x00007fffdd11c07d start_wqthread + 13

Thread 2:
0   libsystem_kernel.dylib        0x00007fffdd03244e __workq_kernreturn + 10
1   libsystem_pthread.dylib       0x00007fffdd11c621 _pthread_wqthread + 1426
2   libsystem_pthread.dylib       0x00007fffdd11c07d start_wqthread + 13

Thread 3 Crashed:
0   libsystem_kernel.dylib        0x00007fffdd031d42 __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fffdd11f457 pthread_kill + 90
2   libsystem_c.dylib             0x00007fffdcf97420 abort + 129
3   libsystem_malloc.dylib        0x00007fffdd091f5d szone_error + 626
4   libsystem_malloc.dylib        0x00007fffdd087f0d tiny_free_list_remove_ptr + 292
5   libsystem_malloc.dylib        0x00007fffdd09c914 tiny_free_no_lock + 1484
6   libsystem_malloc.dylib        0x00007fffdd09d0d5 free_tiny + 671
7   libGPUSupportMercury.dylib    0x00007fffd5457ecd gldDestroyTexture + 39
8   libGFXShared.dylib            0x00007fffcbbd2e3a gfxDestroyPluginTexture + 60
9   GLEngine                      0x0000000111e90801 gleFreeTextureObject + 36
10  GLEngine                      0x0000000111e6031e gleUnbindDeleteHashNamesAndObjects + 179
11  GLEngine                      0x0000000111d62b1c glDeleteTextures_Exec + 671
12  sphererun                     0x000000010c7deeec ogl_destroy_bitmap + 115
13  sphererun                     0x000000010c7ca680 al_destroy_bitmap + 179
14  sphererun                     0x000000010c7b170e al_convert_bitmap + 1066
15  sphererun                     0x000000010c7b1a1f _al_convert_to_memory_bitmap + 158
16  sphererun                     0x000000010c7dad30 destroy_display + 273
17  sphererun                     0x000000010c74bd3b screen_free + 51 (screen.c:147)
18  sphererun                     0x000000010c73c5d0 shutdown_engine + 142 (main.c:485)
19  sphererun                     0x000000010c73b97d _al_mangled_main + 1085 (main.c:154)
20  sphererun                     0x000000010c788c0a +[AllegroAppDelegate app_main:] + 23
21  com.apple.Foundation          0x00007fffc91a68ad __NSThread__start__ + 1243
22  libsystem_pthread.dylib       0x00007fffdd11c93b _pthread_body + 180
23  libsystem_pthread.dylib       0x00007fffdd11c887 _pthread_start + 286
24  libsystem_pthread.dylib       0x00007fffdd11c08d thread_start + 13

I then ran it again and got a black screen but it quit nicely when I pressed escape.

The next two attempts it ran smoothly and displayed everything.

The next attempt it displayed everything but on pressing escape I got:

Code: [Select]
Crashed Thread:        2

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000ffffffff8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0xffffffff8:
    MALLOC_LARGE_REUSABLE  00000001253aa000-000000012600a000 [ 12.4M] rw-/rwx SM=PRV 
-->
    STACK GUARD            0000700009e19000-0000700009e1a000 [    4K] ---/rwx SM=NUL  stack guard for thread 1

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        0x00007fffdd02a34a mach_msg_trap + 10
1   libsystem_kernel.dylib        0x00007fffdd029797 mach_msg + 55
2   com.apple.CoreFoundation      0x00007fffc7784434 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation      0x00007fffc77838c1 __CFRunLoopRun + 1361
4   com.apple.CoreFoundation      0x00007fffc7783114 CFRunLoopRunSpecific + 420
5   com.apple.HIToolbox           0x00007fffc6ce3ebc RunCurrentEventLoopInMode + 240
6   com.apple.HIToolbox           0x00007fffc6ce3cf1 ReceiveNextEventCommon + 432
7   com.apple.HIToolbox           0x00007fffc6ce3b26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
8   com.apple.AppKit              0x00007fffc527ca54 _DPSNextEvent + 1120
9   com.apple.AppKit              0x00007fffc59f87ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
10  com.apple.AppKit              0x00007fffc52713db -[NSApplication run] + 926
11  sphererun                     0x0000000107d0013e _al_osx_run_main + 1312
12  sphererun                     0x0000000107d565c9 main + 16
13  libdyld.dylib                 0x00007fffdcf03235 start + 1

Thread 1:
0   libsystem_kernel.dylib        0x00007fffdd03244e __workq_kernreturn + 10
1   libsystem_pthread.dylib       0x00007fffdd11c48e _pthread_wqthread + 1023
2   libsystem_pthread.dylib       0x00007fffdd11c07d start_wqthread + 13

Thread 2 Crashed:
0   libsystem_malloc.dylib        0x00007fffdd087ecc tiny_free_list_remove_ptr + 227
1   libsystem_malloc.dylib        0x00007fffdd09c945 tiny_free_no_lock + 1533
2   libsystem_malloc.dylib        0x00007fffdd09d0d5 free_tiny + 671
3   com.apple.AMDRadeonX4000GLDriver 0x000000010dcb75e4 0x10dc1f000 + 624100
4   libGPUSupportMercury.dylib    0x00007fffd5457eba gldDestroyTexture + 20
5   libGFXShared.dylib            0x00007fffcbbd2e3a gfxDestroyPluginTexture + 60
6   GLEngine                      0x000000010d417801 gleFreeTextureObject + 36
7   GLEngine                      0x000000010d3e731e gleUnbindDeleteHashNamesAndObjects + 179
8   GLEngine                      0x000000010d2e9b1c glDeleteTextures_Exec + 671
9   sphererun                     0x0000000107d55eec ogl_destroy_bitmap + 115
10  sphererun                     0x0000000107d41680 al_destroy_bitmap + 179
11  sphererun                     0x0000000107d2870e al_convert_bitmap + 1066
12  sphererun                     0x0000000107d28a1f _al_convert_to_memory_bitmap + 158
13  sphererun                     0x0000000107d51d30 destroy_display + 273
14  sphererun                     0x0000000107cc2d3b screen_free + 51 (screen.c:147)
15  sphererun                     0x0000000107cb35d0 shutdown_engine + 142 (main.c:485)
16  sphererun                     0x0000000107cb297d _al_mangled_main + 1085 (main.c:154)
17  sphererun                     0x0000000107cffc0a +[AllegroAppDelegate app_main:] + 23
18  com.apple.Foundation          0x00007fffc91a68ad __NSThread__start__ + 1243
19  libsystem_pthread.dylib       0x00007fffdd11c93b _pthread_body + 180
20  libsystem_pthread.dylib       0x00007fffdd11c887 _pthread_start + 286
21  libsystem_pthread.dylib       0x00007fffdd11c08d thread_start + 13

This was followed by 3 more tests where everything worked correctly.
The next attempt had a graphical anomaly where everything was drawn in the top corner of the screen as if it had been scaled down massively (I had not made any change to the code though).
  • Last Edit: August 23, 2017, 05:06:22 pm by Rhuan

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.8.4
Reply #1946
I've tired moving the canceling of the update and render scripts into a separate function:

Code: [Select]
function close_down()
{
      Dispatch.cancel(tokens[0]);
      Dispatch.cancel(tokens[1]);
}

And then using:
Code: [Select]
Dispatch.later(0, close_down);
Where I'd previously cancelled the tokens and I haven't had any more segfaults, so maybe that's the answer to that one, just make it a rule never to cancel tokens during themselves (or maybe it's fluke that I've not had any segfaults cine).

Unfortunately though the graphical anomalies continue, I've tried removing the Scalex2 but that hasn't helped.

EDIT: correction - removing the Scalex2 seems to have stopped the black screens where nothing draws and the times where one layer selectively doesn't draw. Just the shimmer left.

I think there may be an issue with using too many shader switches where sometimes allegro or open_gl just can't cope.
  • Last Edit: August 23, 2017, 05:24:19 pm by Rhuan

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1947
Thanks for investigating, about a month ago I fixed some segfault bugs in the Dispatch handling, so it's possible errors remain.

Not sure about the graphical glitches though.
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1948
Looking at your crash logs, it seems like it's crashing while freeing textures?  And the cause is apparently a use-after-free.  So maybe Allegro is mismanaging something...

Any chance you could send me a project I can use to try and reproduce?
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.8.4
Reply #1949
Yeah I hadn't twigged that you'd changed the folder structure - I'd put the newly compiled binaries into my existing sphere folder and not changed the folder layout so of course it didn't work.

Huh, first time I ever heard the word "twigged", had to go look it up in the dictionary.

Anyway, yeah, sorry for the disruption.  I kept releasing engines with outdated modules because I'd update some code in #/modules and forget to copy it over to #/cell_modules, or vice versa.  Now any module that can be used in either miniSphere or Cell goes in #/runtime, so there's only one copy.
neoSphere 5.10.0 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub