#jsmess 2016-09-21,Wed

↑back Search

Time Nickname Message
00:47 🔗 taisel has joined #jsmess
00:47 🔗 taisel sup
00:48 🔗 taisel On my new rig, it eats js emulators for breakfast
00:48 🔗 taisel even did experiments comparing it to a 2.4 ghz core 2 duo/penryn
00:48 🔗 taisel 6700k OC'd to 4.8 ghz with 3200mhz ram
00:49 🔗 taisel core 2 duo is like 41% slower clock for clock
00:49 🔗 taisel after accounting for frequency
00:49 🔗 taisel I guess that stat is useful for legacy computer support
02:26 🔗 taisel has quit IRC (Quit: ChatZilla 0.9.92 [Firefox 48.0.2/20160823121617])
04:33 🔗 godane has quit IRC (Quit: Leaving.)
04:34 🔗 godane has joined #jsmess
05:09 🔗 balrog has quit IRC (Read error: Operation timed out)
05:13 🔗 balrog has joined #jsmess
05:20 🔗 taisel has joined #jsmess
05:38 🔗 taisel has quit IRC (Quit: ChatZilla 0.9.92 [Firefox 52.0a1/20160920030429])
10:05 🔗 db48x has joined #jsmess
10:05 🔗 db48x howdy
10:39 🔗 SketchCow Hi, sir.
10:42 🔗 SketchCow So, want the general makeup of what's going on with this?
10:43 🔗 SketchCow I'll go ahead with it.
10:43 🔗 db48x sure
10:44 🔗 SketchCow Basically, we had a pretty connected guy who has done some amazing stuff, and he did some Apple II work, which I got attention for, which he appreciates, and so on and so on.
10:44 🔗 SketchCow As part of that, I shoved his Apple II program into the IA/Emularity, which meant that it was there, but then he went to it and went WELL GUESS WHAT HE WENT
10:45 🔗 SketchCow Something not unlike complete confusion that an Apple II was causing his laptop fan to go on
10:45 🔗 SketchCow So I threw him down the hole, he emerged with lots of thoughts. I'll forward those if you didn't get them, I forget.
10:45 🔗 SketchCow Of all the thoughts, one of them was "have you tried web workers"
10:45 🔗 SketchCow And of course bai pointed at his arm and went "and that's how I got THIS scar"
10:46 🔗 db48x :)
10:46 🔗 SketchCow But regardless, the claims were that maybe it's a little better, a little more realistic.
10:46 🔗 SketchCow So along that line, we did it, we recompiled using the web workers approach.
10:46 🔗 SketchCow And we're hitting some errors, etc.
10:46 🔗 SketchCow Now, I brought in some folks to help and we sort of got it crashing in a different place
10:46 🔗 SketchCow You're welcome to throw all that out but it's worth looking at, I think.
10:47 🔗 db48x fun
10:47 🔗 db48x yea, I'd like to take a look at everything
10:47 🔗 SketchCow http://fos.textfiles.com/dfjustin/jaguar/jaguar/ is the classic "let's make this poor thing kill a browser" bench
10:47 🔗 SketchCow http://fos.textfiles.com/dfjustin/jaguar/jaguar-workers/ is us compiling for a web worker.
10:47 🔗 SketchCow Now, multiple things happened.
10:48 🔗 SketchCow 1. The thing compiled as mamejaguar.js instead of messjaguar, so we had to do a little sed magic in there.
10:48 🔗 SketchCow 2. A web worker has no window (right now) and so we had to do a local variable
10:48 🔗 SketchCow 3. The web worker apparently needs to be reminded of things like functions and the rest. The main callers gives it nothing.
10:49 🔗 SketchCow So this has fingerprints of all sorts of attempts to make that work.
10:49 🔗 SketchCow To stress, though, we're just trying to get it working enough that:
10:49 🔗 SketchCow 1. It's using the web worker structure
10:49 🔗 SketchCow 2. It reasonably does so (puts them in separate threads) to see if this has a speed difference
10:50 🔗 SketchCow We don't want pretty, just meatball right now
10:50 🔗 SketchCow If we see some significant jump, like suddenly we're rocking the house at 100% on Jaguar, then it's worth cleaning up all the meatball
10:51 🔗 SketchCow But if we do it, it's showing as working in two threads, the communication between the two is sucking up the processing, and THEN we show it to Alon and go "is this normal" and he goes "yeah, kind of is", then this experiment is dead.
10:52 🔗 SketchCow As most people seemed to want to chew through a whale carcass than do this, I can happily say that the thing sitting in jaguar-workers is all my mess with a guy named Yoz helping me.
10:55 🔗 db48x hrm
10:55 🔗 SketchCow Happy to walk back and start from scratch with another directory, too.
10:58 🔗 db48x I don't see anything obviously wrong with it
10:59 🔗 db48x except that there's no sourcemap for the minified file
11:02 🔗 db48x which makes debugging the current failure rather hard
11:03 🔗 SketchCow You tell me what to do and I'll do it.
11:03 🔗 SketchCow http://fos.textfiles.com/dfjustin/jaguar/jaguar-workers/head.txt
11:03 🔗 SketchCow So, this is shoved in the first line of the worker program.
11:08 🔗 SketchCow Forwarded to your e-mail is the information germaine to the web worker discussion.
11:08 🔗 SketchCow Including a link from Alon of the vaguely hacky things they've done to get their javascript first person shooter demo working.
11:13 🔗 SketchCow So, in my cargo-culty way, I see the jaguar worker emulator saying:
11:13 🔗 SketchCow mamejaguar.worker.js:2 Uncaught TypeError: Cannot read property 'requestPointerLock' of undefined at _emscripten_get_pointerlock_status
11:13 🔗 SketchCow Which tells me that it's not being handed the driving for the Pointerlock.
11:28 🔗 db48x interesting, I get a different error
11:38 🔗 SketchCow Mine's on chrome.
12:21 🔗 db48x can you try rebuilding mame with DEBUG=1?
12:21 🔗 SketchCow Sure.
12:21 🔗 SketchCow One moment.
12:21 🔗 SketchCow (For various values of "one moment"
12:24 🔗 SketchCow Well, I type rm * instead of rm thing, so that just set me back.
12:24 🔗 SketchCow Give me a moment.
12:31 🔗 db48x :)
12:34 🔗 db48x meanwhile I'm reinstalling emscripten
12:34 🔗 SketchCow You'll pardon me while I do a build of this item the "normal" way to make sure I didn't completely blow away my environment.
12:35 🔗 SketchCow As for the machines build order list, I think I'll write a script to generate it this time, then save the script off somewhere. :)
12:44 🔗 SketchCow So, http://fos.textfiles.com/dfjustin/jaguar/newjaguar/ proves that it works.
12:44 🔗 SketchCow (The fixing the mess I just made.)
12:48 🔗 db48x did you compile that one with --proxy-to-worker as well?
12:48 🔗 SketchCow No.
12:48 🔗 SketchCow No, no.
12:48 🔗 db48x ah
12:48 🔗 SketchCow That was just me proving I didn't just destroy the system to the point that it didn't work normally anymore.
12:48 🔗 db48x ah, ok
12:48 🔗 SketchCow Always good to check the base sets
12:48 🔗 SketchCow Otherwise you'd choke me out when it turned out I'd hammered it.
12:48 🔗 SketchCow I have to go into MAME directly and do these settings, so let me go do that.
12:49 🔗 SketchCow I get to play "where do I set the compile targets again"
12:52 🔗 SketchCow It's mame/scripts/src/main.lua, by the way.
12:53 🔗 SketchCow configuration { "asmjs" }
12:53 🔗 SketchCow targetextension ".bc"
12:53 🔗 SketchCow if os.getenv("EMSCRIPTEN") then
12:53 🔗 SketchCow local emccopts = ""
12:53 🔗 SketchCow .. " -O" .. _OPTIONS["OPTIMIZE"]
12:53 🔗 SketchCow .. " -s USE_SDL=2"
12:53 🔗 SketchCow .. " -s USE_SDL_TTF=2"
12:53 🔗 SketchCow .. " --memory-init-file 0"
12:53 🔗 SketchCow .. " -s ALLOW_MEMORY_GROWTH=0"
12:53 🔗 SketchCow .. " -s TOTAL_MEMORY=268435456"
12:53 🔗 SketchCow .. " -s DISABLE_EXCEPTION_CATCHING=2"
12:53 🔗 SketchCow .. " -s EXCEPTION_CATCHING_WHITELIST='[\"__ZN15running_machine17start_all_devicesEv\",\"__ZN12cli_frontend7executeEiPPc\"]'"
12:53 🔗 SketchCow .. " -s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z12js_get_soundv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey']\""
12:53 🔗 SketchCow .. " --pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js"
12:53 🔗 SketchCow .. " --post-js " .. _MAKE.esc(MAME_DIR) .. "scripts/resources/emscripten/emscripten_post.js"
12:53 🔗 SketchCow .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/chains@bgfx/chains"
12:53 🔗 SketchCow .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/effects@bgfx/effects"
12:53 🔗 SketchCow .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/shaders/gles@bgfx/shaders/gles"
12:53 🔗 SketchCow .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/slot-mask.png@artwork/slot-mask.png"
12:54 🔗 SketchCow I think I rewrote my make-maker so it works.
12:55 🔗 SketchCow So it's compiling now, with --proxy-to-worker and DEBUG=1
12:55 🔗 SketchCow I hope. I'll watch.
13:03 🔗 SketchCow /0/home/dfjustin/emscripten/emcc -O3 -s USE_SDL=2 -s USE_SDL_TTF=2 --memory-init-file 0 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -s DEBUG=1 --proxy-to-worker -s DISABLE_EXCEPTION_CATCHING=2 -s EXCEPTION_CATCHING_WHITELIST='["__ZN15running_machine17start_all_devicesEv","__ZN12cli_frontend7executeEiPPc"]' -s EXPORTED_FUNCTIONS="['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z1
13:03 🔗 SketchCow 2js_get_soundv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey']" --pre-js /0/JSMESS/mame/src/osd/modules/sound/js_sound.js --post-js /0/JSMESS/mame/scripts/resources/emscripten/emscripten_post.js --embed-file /0/JSMESS/mame/bgfx/chains@bgfx/chains --embed-file /0/JSMESS/mame/bgfx/effects@bgfx/effects
13:03 🔗 SketchCow --embed-file /0/JSMESS/mame/bgfx/shaders/gles@bgfx/shaders/gles --embed-file /0/JSMESS/mame/artwork/slot-mask.png@artwork/slot-mask.png ../../../../../jaguar.bc -o /0/JSMESS/mame/mamejaguar.js
13:03 🔗 SketchCow Looking good.
13:05 🔗 db48x hrm, except that didn't do what I expected
13:05 🔗 SketchCow It's not installed yet.
13:05 🔗 SketchCow I'm just saying I didn't mess up the build or choose the wrong place to shove in arguments.
13:05 🔗 db48x yea, but just from looking at the command line I can tell
13:07 🔗 SketchCow OK, I've put it in.
13:08 🔗 SketchCow It will fail in all the ways that Yoz fixed, but I think we can work from there.
13:08 🔗 db48x which url?
13:08 🔗 SketchCow http://fos.textfiles.com/dfjustin/jaguar/jaguar-workers/
13:09 🔗 db48x yes, as I thought
13:09 🔗 db48x it didn't actually work
13:09 🔗 db48x we need to add "-g" to emccopts
13:09 🔗 db48x instead of DEBUG=1
13:10 🔗 SketchCow .. " -s TOTAL_MEMORY=268435456"
13:10 🔗 SketchCow .. " -g"
13:10 🔗 SketchCow .. " --proxy-to-worker"
13:10 🔗 SketchCow .. " -s DISABLE_EXCEPTION_CATCHING=2"
13:10 🔗 SketchCow and so on?
13:10 🔗 db48x yes
13:10 🔗 db48x looks like there's a way to do this without modifying the file though
13:11 🔗 SketchCow Too late this time around, but I'm willing to do that for the future.
13:11 🔗 db48x :)
13:12 🔗 SketchCow Boy, I hope this works.
13:13 🔗 db48x should make it easier to debug
13:16 🔗 db48x emmake make -j16 SYMBOLS=1 SUBTARGET=jaguar SOURCES=src/mame/drivers/jaguar.cpp
13:16 🔗 db48x the SYMBOLS=1 makes it add -g to the emcc command
13:17 🔗 SketchCow So replace it with that later
13:18 🔗 SketchCow And -j16? On THIS old thing?
13:20 🔗 SketchCow /0/home/dfjustin/emscripten/emcc -O3 -s USE_SDL=2 -s USE_SDL_TTF=2 --memory-init-file 0 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -g --proxy-to-worker -s DISABLE_EXCEPTION_CATCHING=2 -s EXCEPTION_CATCHING_WHITELIST='["__ZN15running_machine17start_all_devicesEv","__ZN12cli_frontend7executeEiPPc"]' -s EXPORTED_FUNCTIONS="['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z12js_get_
13:20 🔗 SketchCow soundv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey']" --pre-js /0/JSMESS/mame/src/osd/modules/sound/js_sound.js --post-js /0/JSMESS/mame/scripts/resources/emscripten/emscripten_post.js --embed-file /0/JSMESS/mame/bgfx/chains@bgfx/chains --embed-file /0/JSMESS/mame/bgfx/effects@bgfx/effects --embed-
13:20 🔗 SketchCow file /0/JSMESS/mame/bgfx/shaders/gles@bgfx/shaders/gles --embed-file /0/JSMESS/mame/artwork/slot-mask.png@artwork/slot-mask.png ../../../../../jaguar.bc -o /0/JSMESS/mame/mamejaguar.js
13:21 🔗 SketchCow warning: Output contains some very large functions (3680 lines in __ZN10lua_engine10initializeEv), consider building source files with -Os or -Oz, and/or trying OUTLINING_LIMIT to break them up (see settings.js; note that the parameter there affects AST nodes, while we measure lines here, so the two may not match up)
13:22 🔗 SketchCow Dumped in.
13:26 🔗 SketchCow So, I can help here, thanks to Yoz.
13:26 🔗 SketchCow The error it currently gets is:
13:26 🔗 SketchCow window.jsmame_set_mastervolume = jsmame_web_audio.set_mastervolume;
13:29 🔗 SketchCow "aaah, I see the problem - it.s trying to create an easily-accessible global variable called jsmame_set_mastervolume. The way to do that in standard browser JS is to attach it to the window object. But web workers don.t have a window object"
13:30 🔗 SketchCow What Yoz did was have me do: s/window/self/ in mamejaguar.worker.js
13:30 🔗 SketchCow I can do that again, or we can do something else.
13:30 🔗 SketchCow I can also do the line where it adds that header.
13:31 🔗 db48x yes, let's do both
13:31 🔗 db48x the -g worked
13:33 🔗 SketchCow OK, doing it now.
13:33 🔗 SketchCow Next error:
13:33 🔗 SketchCow (This is going much cleaner.)
13:34 🔗 SketchCow gain_node.gain.value = 1.0;
13:34 🔗 SketchCow TypeError: gain_node.gain is undefined
13:36 🔗 SketchCow root@teamarchive0:/HTML/dfjustin/jaguar/jaguar-workers# head -1 mamejaguar.worker.js
13:36 🔗 SketchCow importScripts("webaudio.js");
13:36 🔗 SketchCow It's in webaudio.js
13:36 🔗 SketchCow So another websplosion
13:39 🔗 SketchCow So this moves into the edge of my abilities
13:39 🔗 SketchCow I don't know if this is saying it's failing to import webaudio.js or if it's something else.
14:31 🔗 db48x I don't really see why this is failing
14:33 🔗 SketchCow So, I am positive it's interaction between the worker and the main thread.
14:33 🔗 SketchCow https://github.com/kripken/emscripten/issues/3566
14:36 🔗 db48x yes, that is
14:36 🔗 db48x this gain_node.gain is undefined error is more puzzling
14:37 🔗 SketchCow Should I experiment by prepending all of webaudio.js to it?
14:37 🔗 SketchCow Or is that just insane hackery.
14:38 🔗 db48x can you show me the contents of webaudio.js?
14:39 🔗 db48x oh: http://fos.textfiles.com/dfjustin/jaguar/jaguar-workers/webaudio.js
14:39 🔗 SketchCow Yes
15:11 🔗 db48x well, I can't figure out why it's failing
15:11 🔗 db48x but for the moment, you could make a change to it
15:11 🔗 db48x where it says gain_node.gain.value = gain_web_audio;
15:14 🔗 db48x put if (gain_node.gain) { gain_node.gain.value = gain_web_audio; } instead
15:14 🔗 db48x we won't be able to change the volume, but it won't break either
15:16 🔗 SketchCow Change made
15:17 🔗 SketchCow Weird, new break with same issue
15:19 🔗 db48x but on a different line
15:20 🔗 db48x you can do the same thing there
15:20 🔗 db48x remove gain_node.gain.value = 1.0; and put if (gain_node.gain) { gain_node.gain.value = 1.0; }
15:22 🔗 SketchCow Done
15:41 🔗 db48x function init_event() {
15:41 🔗 db48x if (typeof context.createScriptProcessor == "function") {
15:41 🔗 db48x eventNode = context.createScriptProcessor(4096, 0, 2);
15:41 🔗 db48x } else if (typeof context.createJavaScriptNode == "function") {
15:41 🔗 db48x eventNode = context.createJavaScriptNode(4096, 0, 2);
15:41 🔗 db48x }
15:41 🔗 db48x if (eventNode) {
15:41 🔗 db48x eventNode.onaudioprocess = tick;
15:41 🔗 db48x eventNode.connect(gain_node);
15:41 🔗 db48x initializeWatchDogForFirefoxBug();
15:41 🔗 db48x }
15:41 🔗 db48x }
15:43 🔗 SketchCow So replace it?
15:43 🔗 db48x yea
15:46 🔗 SketchCow hahaha
15:46 🔗 SketchCow So.... it worked
15:46 🔗 SketchCow But...
15:46 🔗 SketchCow Well, go look at THAT shit
15:48 🔗 db48x :)
15:50 🔗 SketchCow So, this brings to light a lot of the problems in case.
15:51 🔗 db48x yea
15:52 🔗 db48x it shouldn't be doing the web audio stuff in the worker
15:52 🔗 db48x it should proxy that data out to the page the same way it proxies the canvas data out
15:57 🔗 SketchCow Yeah, so there's a fundamental bit there.
15:57 🔗 SketchCow So it's not bringing up Jaguar.
15:58 🔗 SketchCow And I think it's because it's not loading the ROMs
15:59 🔗 db48x that makes sense
16:03 🔗 SketchCow I think we need to do what that banana thing is doing
16:03 🔗 SketchCow Prepend some of the loading in the script.
16:03 🔗 SketchCow the worker.
16:35 🔗 SketchCow Want to call it and rope around later?
16:35 🔗 SketchCow Or are you hot on the trail
16:36 🔗 SketchCow I sent this to Alon, see if he gets an idea, too
16:54 🔗 db48x I was thinking of adapting the emularity to set up the worker script and whatnot
16:54 🔗 db48x but then I got distracted
17:04 🔗 SketchCow I endorse anything
17:05 🔗 SketchCow But I do think that hacking this just enough to get this working to see if it even gives us a real speed increase is key
17:05 🔗 SketchCow You might think otherwise, though
17:08 🔗 SketchCow Like, if it doubles or triples speed because of multi-tasking, great
17:08 🔗 SketchCow Or even 30-40%
17:08 🔗 SketchCow But if it's all this pain for 10% more, it's worth just waiting for the next innovations along Emscripten and Webassembly.

irclogger-viewer