Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
450 lines (345 sloc) 15.4 KB

Author: Zeta Ret, Ivo Yankulovski
Zeta Ret SkytoSS

SkytoSS Accelerator, ProtoSS GPU Acceleration and Web Workers

Requires: protoss.all.js
Version: 1.06
Date: 2018 - Today

required*

SkytoSS

Interfaces: ISkytoSS

Properties

skytossName String
default 'skytoss', name identifier of SkytoSS instance

mainPrefix String
default 'RTYPE FNAME(ARGS){', prefix template of main function

propDefault String
default comment, function properties string template in the event of no properties applied

mainDefault String
default comment, main function body template in the event of no source

mainSuffix String
default '}', suffix template of main function

joinLine String
default '\n', line joiner string used in source array join statement

attributeName String
default 'attribute', default vertex shader property prefix

workerIds Object
default {}, map of Workers by id

gpuIds Object
default {}, map of GPU Data by id

defaultWorkerType String
default 'normal', Worker or SharedWorker based on type

glContextIds Array
default ['webgl2', 'webgl', 'experimental-webgl'], GL get context types

expressionMap WeakMap
default new, map of constructor types used in 'evalExpression'

templates Object
default {}, map of template function used in source print

debugGPU Boolean
default false, use console features on GPU activity

gpuShaderLogHandler Function
default null, output shader log status

autoDrawGPU Boolean
default false, activate auto GPU functionality in 'useGPU'

graviton Object
default {}, accelerator meta data by custom id, used in buffers/particles/randomizer

definitions Object
default {}, definitions by id used in workers, ProtoSS synthesis instructions

Methods

SkytoSS() : void

return void

getTemplate(String id) : Function

  • id* - String, id of template in the map

return Function, template function handler

setTemplate(String id, Function handler) : SkytoSS

  • id* - String, id of template handler in the map
  • handler* - Function, function mapped to template id

return SkytoSS, self

iterateTemplate(String s1, String s2, String s3, String expression) : String

  • s1* - String, statement 1 of the for iterator, initialization
  • s2* - String, statement 2 of the for iterator, precondition
  • s3* - String, statement 3 of the for iterator, counter
  • expression* - String, iterator expression source, loop body

return String, for iterator source template

ifElseTemplate(Array conditions, String elsebody) : String

  • conditions* - Array, array of [condition, body], 'if' on index 0, 'else if' for any consequential index
  • elsebody - String, 'else' body

return String, [if, else if, else] source template

argsTemplate(Array args) : String

  • args* - Array, array of strings in 2 templates, [1] 'Type key' or [2] 'key'

return String, map of key type

functionTemplate(String name, String returnType, Array args, Object props, String|Array main, String prefix, String suffix) : String

  • name - String, name of function or 'main'
  • returnType - String, type of return or 'void'
  • args - Array, array of arguments
  • props - Object, map of properties
  • main - String|Array, body source
  • prefix - String, prefix function source or 'mainPrefix'
  • suffix - String, suffix function source or 'mainSuffix'

return String, function with arguments, return type and body source template

setExpressionMap(Function type, Function handler) : SkytoSS

  • type* - Function, constructor function to evaluate value by type
  • handler* - Function, type function handler by value

return SkytoSS, self

evalExpression(Object exp) : Object

  • exp* - Object, expression to evaluate using 'expressionMap'

return Object, type evaluation by map or exp

sourceTemplate(Object attr, Object mprops, String|Array main, Object functions, String|Array prepend, String|Array append) : String

  • attr - Object, map of attributes
  • mprops - Object, map of properties
  • main - String|Array, main body source
  • functions - Object, map of functions
  • prepend - String|Array, prepend source to final output
  • append - String|Array, append source to final output

return String, gpu source program

seedTemplate(Number seed) : Object

  • seed - Number, initial seed or 0

return Object, randomizer seed object

lineWrapper(Array line, Boolean noreturn, Object props) : String

  • line* - Array, array of source lines
  • noreturn - Boolean, mark last line as return
  • props - Object, replace properties in line string by key value

return String, source of lines

gpuWrapRandomizer(Object seeder) : Object

  • seeder* - Object, randomizer seed object

return Object, GPU wrapper object {attr, code, main}

gpuShader(WebGLRenderingContext gpu, String source, Number type) : WebGLShader

  • gpu* - WebGLRenderingContext, compile shader source in context
  • source* - String, shader source code in GL format
  • type* - Number, vertex or fragment

return WebGLShader, compiled shader in context in case of no error

gpuBuffer(WebGLRenderingContext gpu, Array bufferdata, Number target, ArrayBufferView type, Number usage) : WebGLBuffer

  • gpu* - WebGLRenderingContext, create and bind buffer in context
  • bufferdata* - Array, data of the buffer
  • target - Number, target of the buffer [array, elements, etc.]
  • type - ArrayBufferView, type of buffer data, default Float32Array
  • usage - Number, usage of the buffer in context

return WebGLBuffer, configured context buffer

gpuPreProgrammer(WebGLRenderingContext gpu, Object gpuData, String id, Object settings, Object bufferData) : void

  • gpu* - WebGLRenderingContext,
  • gpuData* - Object,
  • id* - String,
  • settings* - Object,
  • bufferData* - Object,

return void

gpuProgrammer(WebGLRenderingContext gpu, Object gpuData, String id, Object settings) : void

  • gpu* - WebGLRenderingContext,
  • gpuData* - Object,
  • id* - String,
  • settings* - Object,

return void

newGPU(String sourcev, String sourcef, String id, Object options, Number width, Number height) : String

  • sourcev* - String, vertex shader GL source
  • sourcef* - String, fragment shader GL source
  • id - String, id of the gpu in gpuIds
  • options - Object, options of the context instance
  • width - Number, width of context or 0xff
  • height - Number, height of context or 0xff

return String, id of gpu in gpuIds

addGPU(WebGLRenderingContext gpu, String sourcev, String sourcef, String id) : String

  • gpu* - WebGLRenderingContext, link program to context
  • sourcev* - String, create vertex shader from GL source
  • sourcef* - String, create fragment shader from GL source
  • id - String, id of gpu in gpuIds or auto generated

return String, id of gpu in gpuIds

getGPU(String id) : Object

  • id* - String, id in gpuIds

return Object, gpu data with shaders, buffer, program

useGPU(String id, Function handler, Object settings, Object bufferData, ArrayBufferView readBufferType, Function glPreProgrammer, Function glProgrammer, Function glClear) : Boolean

  • id* - String, id of gpu in gpuIds
  • handler - Function, function resolver of context pixel output
  • settings - Object, settings used in this drawing and programming of context
  • bufferData - Object, buffers used in this drawing
  • readBufferType - ArrayBufferView, read pixels of context, default Uint8Array
  • glPreProgrammer - Function, gpu function to preprogram the context, buffers and attributes, or autoDrawGPU
  • glProgrammer - Function, gpu function to program the context, uniforms and draw, or autoDrawGPU
  • glClear - Function, clear function (gpu, gpuData, id, settings) or autoDrawGPU

return Boolean, gpu data status

clearGPUBuffer(String id) : Boolean

  • id* - String, id of gpu in gpuIds

return Boolean, gpu data buffer status

deleteGPU(String id) : Boolean

  • id* - String, id of gpu in gpuIds

return Boolean, gpu data status

gpuProperty(String value, String type) : Object

  • value* - String,
  • type - String,

return Object, property object

gpuAttribute(String type, String value, String attrname, Boolean noattrname, Object loc) : Object

  • type* - String,
  • value - String,
  • attrname - String,
  • noattrname - Boolean,
  • loc - Object,

return Object, attribute object

gpuFunction(String rtype, Array args, Object props, String|Array main, String prefix, String suffix) : Object

  • rtype - String,
  • args - Array,
  • props - Object,
  • main - String|Array,
  • prefix - String,
  • suffix - String,

return Object, function template object

gpuUniform(String value, Boolean int) : Object

  • value* - String,
  • int - Boolean,

return Object, uniform object

gpuUniformMatrix(String value, Number num, Boolean transpose) : Object

  • value* - String,
  • num* - Number,
  • transpose - Boolean,

return Object, uniform matrix object

gpuBufferData(Array data, Number size, Number target, ArrayBufferView type, Number usage, Number dataType, ArrayBufferView vector, WebGLBuffer buffer, Boolean noloc, Object loc, Boolean normalized, Number stride, Number offset) : Object

  • data* - Array,
  • size* - Number,
  • target - Number,
  • type - ArrayBufferView,
  • usage - Number,
  • dataType - Number,
  • vector - ArrayBufferView,
  • buffer - WebGLBuffer,
  • noloc - Boolean,
  • loc - Object,
  • normalized - Boolean,
  • stride - Number,
  • offset - Number,

return Object, buffer data object

gpuSettings(Object uniform, Function drawMethod, Array drawArgs, Number drawCount, Number bufferCellSize, Number readFormat, Number readType) : Object

  • uniform - Object,
  • drawMethod - Function,
  • drawArgs - Array,
  • drawCount - Number,
  • bufferCellSize - Number,
  • readFormat - Number,
  • readType - Number,

return Object, gpu settings object

newWorker(String src, String id, String type, Object options, Boolean srcurl) : String

  • src* - String, JavaScript source code, url to .js file or Blob url
  • id - String, id of worker in the map or auto generated
  • type - String, type of worker [normal, shared]
  • options - Object, options of worker instance
  • srcurl - Boolean, use src as url

return String, id of worker

getWorker(String id) : Worker|SharedWorker

  • id* - String, id of worker in workerIds

return Worker|SharedWorker, worker from map 'workerIds'

commandWorker(String id, String command, Object data, Array transfer) : Boolean

  • id* - String, id of worker in workerIds
  • command* - String, sent command
  • data - Object, command data [Object, Array]
  • transfer - Array, array of Transferable objects [ArrayBuffer, MessagePort, ImageBitmap]

return Boolean, worker status

deleteWorker(String id) : Boolean

  • id* - String, select worker by id, and terminate externally by posting a message

return Boolean, worker status

Static Properties

TEMPLATES Object
default init, object enumerating template string ids

WORKERS Object
default init, object enumerating worker string types

__InitSkytoSSPrototypes Boolean
default false, flag state of InitSkytoSSPrototypes

Static Methods

InitSkytoSSPrototypes(Boolean override) : SkytoSS

  • override - Boolean, mark SkytoSS Prototype for overriding, will reinstall prototypes in effect

return SkytoSS, self SkytoSS class

const(String key, Object value) : Object
Object Prototype

  • key* - String, key of constant
  • value* - Object, value of constant

return Object, argument value, dynamically defined constant to scope

constMap(Object value) : Object
Object Prototype

  • value* - Object, map of key-value to create constants

return Object, argument value, dynamically defined constants to scope

shell(Array keys) : Object
Object Prototype

  • keys* - Array, keys to extract from scope

return Object, object with key-types based on constructor of value from scope

ys(Object shell, Object dome) : Boolean
Object Prototype

  • shell* - Object, object to test type interface in the dome
  • dome* - Object, dome definition in package or scope

return Boolean, shell keys must not be in dome holes, must be defined and value of the key must pass test of the type [constructor, instanceOf, ProtoSS.is]

skydome(String name, String id, Object shell, Object holes, Object scope) : Object
Object Prototype

  • name* - String, name of created new package in scope
  • id* - String, id of the SkyDome in the created package
  • shell - Object, shell with key-types to test interface
  • holes - Object, keys of the holes to forbid shell interface
  • scope - Object, scope to create package in or this

return Object, SkyDome object definition {name, type, shell, holes}

deepsky(RegExp keyreg, Number depth, Object shell, Object scope, Object toppack) : Array
Object Prototype

  • keyreg* - RegExp, keys of objects inside packaging system must pass test
  • depth - Number, depth to test packaging system
  • shell - Object, shell to test objects using SkytoSS.ys
  • scope - Object, object/package in packaging system or this
  • toppack - Object, top package or window

return Array, found objects in the entire packaging system passing the test of keyreg and shell


MarkDown - JsonDox 1.02 - Zeta Ret Zetadmin Documentation Generator

You can’t perform that action at this time.