From f280f25cd787f2c04855c169b713802ee5d5764c Mon Sep 17 00:00:00 2001 From: Christoph Diehl <1614333+posidron@users.noreply.github.com> Date: Thu, 22 Feb 2018 06:59:27 +0100 Subject: [PATCH] Fixes --- lib/make/webgl.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/make/webgl.js b/lib/make/webgl.js index 2337438..7e7b415 100644 --- a/lib/make/webgl.js +++ b/lib/make/webgl.js @@ -34,6 +34,12 @@ make.webgl = { 'RGBA32F': {format: 'RGBA', type: ['FLOAT']}, 'RGBA8UI': {format: 'RGBA_INTEGER', type: ['UNSIGNED_BYTE']} }, + WebGLFormat: () => { + let internalformat = random.item(Object.keys(make.webgl.internalFormat)) + let format = make.webgl.internalFormat[internalformat].format + let type = random.item(make.webgl.internalFormat[internalformat].type) + return [internalformat, format, type] + }, textureSources: () => { let sources = [ 'HTMLCanvasElement', @@ -68,7 +74,7 @@ make.webgl = { 'ELEMENT_ARRAY_BUFFER' ] if (isWebGL2) { - target.extends([ + target.extend([ 'COPY_READ_BUFFER', 'COPY_WRITE_BUFFER', 'TRANSFORM_FEEDBACK_BUFFER', @@ -173,7 +179,7 @@ make.webgl = { 'FUNC_REVERSE_SUBTRACT' ] if (isWebGL2) { - mode.extends([ + mode.extend([ 'MIN', 'MAX' ]) @@ -233,7 +239,7 @@ make.webgl = { } return random.item(target) }, - randomDepthFunc: (isWebGL2) => { + randomFunc: (isWebGL2) => { let func = [ 'NEVER', 'LESS', @@ -259,7 +265,7 @@ make.webgl = { 'STENCIL_TEST' ] if (isWebGL2) { - cap.extends([ + cap.extend([ 'RASTERIZER_DISCARD' ]) } @@ -285,7 +291,7 @@ make.webgl = { 'DEPTH_STENCIL_ATTACHMENT' ] if (isWebGL2) { - attachment.extends([ + attachment.extend([ 'COLOR_ATTACHMENT' + random.range(0, 15) ]) } @@ -299,7 +305,7 @@ make.webgl = { 'FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE' ] if (isWebGL2) { - pname.extends([ + pname.extend([ 'FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE', 'FRAMEBUFFER_ATTACHMENT_BLUE_SIZE', 'FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING', @@ -311,7 +317,7 @@ make.webgl = { 'FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER' ]) } - random.item(pname) + return random.item(pname) }, randomShaderPrecision: (isWebGL2) => { let precisiontype = [ @@ -361,7 +367,7 @@ make.webgl = { 'VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE' ]) } - return random.item([pname]) + return random.item(pname) }, randomHint: (isWebGL2) => { let target = [ @@ -384,8 +390,8 @@ make.webgl = { }, randomPixelStorage: (isWebGL2) => { let pname = { - 'PACK_ALIGNMENT': random.range([1, 2, 4, 8]), - 'UNPACK_ALIGNMENT': random.range([1, 2, 4, 8]), + 'PACK_ALIGNMENT': random.item([1, 2, 4, 8]), + 'UNPACK_ALIGNMENT': random.item([1, 2, 4, 8]), 'UNPACK_FLIP_Y_WEBGL': random.bool(), 'UNPACK_PREMULTIPLY_ALPHA_WEBGL': random.bool(), 'UNPACK_COLORSPACE_CONVERSION_WEBGL': random.item([0, 0x9244]) @@ -490,7 +496,7 @@ make.webgl = { ] return random.item(target) }, - randomeUniformParameter: (isWebGL2) => { + randomUniformParameter: (isWebGL2) => { let pname = [ 'UNIFORM_TYPE', 'UNIFORM_SIZE', @@ -532,7 +538,7 @@ make.webgl = { 'STREAM_DRAW' ] if (isWebGL2) { - usage.extends([ + usage.extend([ 'STATIC_READ', 'DYNAMIC_READ', 'STREAM_READ',