+ All Categories
Home > Technology > 20151224-games

20151224-games

Date post: 15-Apr-2017
Category:
Upload: noritada-shimizu
View: 712 times
Download: 0 times
Share this document with a friend
64
Transcript
Page 1: 20151224-games
Page 2: 20151224-games
Page 3: 20151224-games
Page 4: 20151224-games
Page 5: 20151224-games

Open Source Project

Page 6: 20151224-games

Proudly non-profit, Mozilla makes products like Firefox with a mission to keep the power of the Web in the hands of users everywhere.

Mozilla Mission (https://www.mozilla.org/en-US/mission/)

Page 7: 20151224-games

To ensure the Internet is a global public resource, open and accessible to all.

Mozilla Mission(https://www.mozilla.org/en-US/mission/)

Page 8: 20151224-games

Web is the platform

Page 9: 20151224-games
Page 10: 20151224-games
Page 12: 20151224-games
Page 13: 20151224-games
Page 14: 20151224-games
Page 15: 20151224-games
Page 16: 20151224-games
Page 17: 20151224-games
Page 18: 20151224-games
Page 19: 20151224-games
Page 20: 20151224-games
Page 21: 20151224-games
Page 26: 20151224-games
Page 27: 20151224-games
Page 28: 20151224-games

function createShader (gl, sourceCode, type) {

// Compiles either a shader of type gl.VERTEX_SHADER or gl.FRAGMENT_SHADER var shader = gl.createShader( type );

gl.shaderSource( shader, sourceCode ); gl.compileShader( shader );

if ( !gl.getShaderParameter(shader, gl.COMPILE_STATUS) ) { var info = gl.getShaderInfoLog( shader );

throw "Could not compile WebGL program. \n\n" + info;

}}

Page 35: 20151224-games
Page 36: 20151224-games

var x = 42;

var y = "a string";var z = x + y; // z = "42a string"

eval("z = z.substr(1, 2)"); // z = "2a"

[1, "two", { three: 3 }].forEach(function(item) {

if (typeof item === typeof z) console.log([z, item]);}); // emits ["2a", "two"]

Page 37: 20151224-games
Page 38: 20151224-games

function fib(n){ if(n < 2){ return 1; } return fib(n - 1) + fib(n - 2);}

Page 39: 20151224-games

function fib(n){ if(n < 2){ return 1; } return fib(n - 1) + fib(n - 2);}

function fib(n) { n = n|0; if(n >>> 0 < 3){ return 1 | 0; } return ((fib(n - 1 | 0) | 0) + (fib(n - 2 | 0) | 0)) | 0;}

Page 41: 20151224-games
Page 42: 20151224-games
Page 43: 20151224-games

int func(int *p) {

int r = *p; return calc(r, r << 16);

}

function func(p) {

var r = HEAP32[p >> 2]; return calc(r, r << 16);

}

Page 44: 20151224-games

float array[5000]; // C++

int main() { for (int i = 0; i < 5000; ++i) {

array[i] += 1.0f; }

}

Page 45: 20151224-games

float array[5000]; // C++

int main() { for (int i = 0; i < 5000; ++i) {

array[i] += 1.0f; }

}

var buffer = new ArrayBuffer(32768); // JavaScriptvar HEAPF32 = new Float32Array(buffer);function main() { var a = 0, b = 0; do { a = (8 + (b << 2)) | 0; HEAPF32[a >> 2] = +HEAPF32[a >> 2] + 1.0; b = (b + 1) | 0; } while ((b | 0) < 5000);}

Page 46: 20151224-games

Single build & secure execution

Page 47: 20151224-games
Page 48: 20151224-games
Page 49: 20151224-games
Page 50: 20151224-games

-rw-r--r-- 1 chiko staff 99B 12 22 17:38 Makefile

-rw-r--r-- 1 chiko staff 1.9K 12 22 17:29 app.js-rw-r--r-- 1 chiko staff 247B 12 22 11:31 fib-asm.js

-rw-r--r-- 1 chiko staff 220B 12 21 17:36 fib.cpp-rw-r--r-- 1 chiko staff 184K 12 22 17:38 fib.js

-rw-r--r-- 1 chiko staff 2.8K 12 22 17:38 fib.js.mem

-rw-r--r-- 1 chiko staff 1.2K 12 22 17:10 index.html

Page 51: 20151224-games
Page 52: 20151224-games
Page 54: 20151224-games

function () {

"use asm"; function add(x, y) {

x = x | 0; y = y | 0;

return x + y | 0;

} return { add: add };

}

Page 55: 20151224-games

(module

(memory 16777216 16777216) (export "add" $add)

(func $add (param $x i32) (param $y i32) (result i32) (i32.add

(get_local $x)

(get_local $y) )

)

)

Page 57: 20151224-games

MozVR

Page 59: 20151224-games
Page 60: 20151224-games

Thank you & Questions?

Page 61: 20151224-games
Page 62: 20151224-games
Page 63: 20151224-games

Recommended