You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Go to file
cnlohr d94ab07cae
Update with obsolescence notice.
4 years ago
rawdraw@3c7c8fb641 Update! 4 years ago
.gitmodules Update to functional version. 4 years ago
Makefile Fix uglification method to not need extra file 4 years ago
README.md Update with obsolescence notice. 4 years ago
index.html Undo stress test 4 years ago
rawdraw.c Undo stress test 4 years ago
template.ht Fix source template for redline's name 4 years ago
template.js Allow batching in C 4 years ago

README.md

rawdrawwasm

Obsolescence Notice

OBSOLESCENCE NOTICE: THIS REPO HAS BEEN INTEGRATED INTO RAWDRAW AND SUPERCEDED. THIS IS ONLY USEFUL FOR PREVIOUS DOCUMENTATION.

Intro

My stab at rawdraw on wasm. This is based on: https://github.com/zNoctum/wasm-tool and has inspiration from: https://github.com/cnlohr/wasm_integrated

Lots of stuff todo, hopefully this will get rolled into main rawdraw.

TODO notes for now:

  • hook up button presses, and mouse input and destroy
  • hook up sleep in a more meaningful way maybe?
  • Make printf work.
  • Make libc work.
  • Figure out how to #include math.h
  • Come up with guide on how to use this.

Check it out, live: https://cnlohr.github.io/rawdrawwasm/

I wanted to compare the difference beteen an asynchronous and synchronous style. Also, measure the overhead introudced by adding --asyncify. This is using the canvas 2d methods. Those are being abandoned.

//TEST ON CHROME:
//NOT RASTERIZER
// Async drive: ~7.2ms
// Sync drive: ~6.9ms
//sync w/o asyncify: 7.0ms.
//
//RASTERIZER
//Async: 7.5ms
//Sync: 3.9ms
//Sync w/o asyncify: 3.6ms

//TEST ON FIREFOX:
//Async: 17.3ms
//sync: 13.7ms
//Sync w/o asyncify: 13.3ms
//
//FF without including swap.
//Async: 11.5
//Sync:  11.5ms
//Sync w/o asyncify: 11.2ms

This was something I found convenient for a while...


	function wasmloaded(wa)
	{
		instance = wa;
		wasmExports = instance.exports;
		instance.exports.main();
	}

	//If at all possible, we should attempt to load in-thread
	//This will make the load not flash.
	if( blob.length < 4096 )
	{
		let mod = new WebAssembly.Module(array);
		var wa = new WebAssembly.Instance( mod, imports );
 		wasmloaded( wa );
	}
	else
	{
		WebAssembly.instantiate(array, imports).then( function(wa) { wasmloaded(wa.instance); } );
	}