From c85d69abe2604a392e2b3c507826c78970cb05d7 Mon Sep 17 00:00:00 2001 From: Christoph Diehl <1614333+posidron@users.noreply.github.com> Date: Wed, 21 Feb 2018 10:21:03 +0100 Subject: [PATCH] Add constants for WebGL --- lib/make/webgl.js | 49 ++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/lib/make/webgl.js b/lib/make/webgl.js index 40f362a..2337438 100644 --- a/lib/make/webgl.js +++ b/lib/make/webgl.js @@ -60,14 +60,14 @@ make.webgl = { return names }, randomBitmask: () => { - return parseInt((random.subset([1,0], 8).join(''))) + return parseInt((random.subset([1, 0], 8).join(''))) }, randomBufferTarget: (isWebGL2) => { let target = [ 'ARRAY_BUFFER', 'ELEMENT_ARRAY_BUFFER' ] - if (domino.modules.webgl.isWebGL2) { + if (isWebGL2) { target.extends([ 'COPY_READ_BUFFER', 'COPY_WRITE_BUFFER', @@ -100,7 +100,7 @@ make.webgl = { return random.item(pname) }, randomTexParameterValue: (isWebGL2) => { - let pname_param = { + let pnameparam = { 'TEXTURE_MAG_FILTER': [ 'LINEAR', 'NEAREST' @@ -122,11 +122,11 @@ make.webgl = { 'REPEAT', 'CLAMP_TO_EDGE', 'MIRRORED_REPEAT' - ], + ] } if (isWebGL2) { - pname_param = Object.assign( - pname_param, + pnameparam = Object.assign( + pnameparam, { 'TEXTURE_BASE_LEVEL': [ make.number.any() @@ -162,15 +162,15 @@ make.webgl = { } ) } - pname = random.item(Object.keys(pname_param)) - param = random.item(pname_param[pname]) + let pname = random.item(Object.keys(pnameparam)) + let param = random.item(pnameparam[pname]) return [pname, param] }, randomBlendMode: (isWebGL2) => { let mode = [ 'FUNC_ADD', 'FUNC_SUBTRACT', - 'FUNC_REVERSE_SUBTRACT', + 'FUNC_REVERSE_SUBTRACT' ] if (isWebGL2) { mode.extends([ @@ -198,7 +198,7 @@ make.webgl = { 'ONE_MINUS_CONSTANT_ALPHA', 'SRC_ALPHA_SATURATE' ] - return ranodm.item(factor) + return random.item(factor) }, randomFace: (isWebGL2) => { let mode = [ @@ -282,7 +282,7 @@ make.webgl = { 'COLOR_ATTACHMENT0', 'DEPTH_ATTACHMENT', 'STENCIL_ATTACHMENT', - 'DEPTH_STENCIL_ATTACHMENT', + 'DEPTH_STENCIL_ATTACHMENT' ] if (isWebGL2) { attachment.extends([ @@ -384,8 +384,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.range([1, 2, 4, 8]), + 'UNPACK_ALIGNMENT': random.range([1, 2, 4, 8]), 'UNPACK_FLIP_Y_WEBGL': random.bool(), 'UNPACK_PREMULTIPLY_ALPHA_WEBGL': random.bool(), 'UNPACK_COLORSPACE_CONVERSION_WEBGL': random.item([0, 0x9244]) @@ -395,17 +395,17 @@ make.webgl = { pname, { 'PACK_ROW_LENGTH': make.number.any(), - 'PACK_SKIP_PIXELS': make.number.any(), - 'PACK_SKIP_ROWS': make.number.any(), - 'UNPACK_ROW_LENGTH': make.number.any(), - 'UNPACK_IMAGE_HEIGHT': make.number.any(), - 'UNPACK_SKIP_PIXELS': make.number.any(), - 'UNPACK_SKIP_ROWS': make.number.any(), - 'UNPACK_SKIP_IMAGES': make.number.any() + 'PACK_SKIP_PIXELS': make.number.any(), + 'PACK_SKIP_ROWS': make.number.any(), + 'UNPACK_ROW_LENGTH': make.number.any(), + 'UNPACK_IMAGE_HEIGHT': make.number.any(), + 'UNPACK_SKIP_PIXELS': make.number.any(), + 'UNPACK_SKIP_ROWS': make.number.any(), + 'UNPACK_SKIP_IMAGES': make.number.any() } ) } - name = random.item(Object.keys(pname)) + let name = random.item(Object.keys(pname)) return [name, pname[name]] }, randomStencilAction: (isWebGL2) => { @@ -419,6 +419,7 @@ make.webgl = { 'DECR_WRAP', 'INVERT' ] + return random.item(action) }, randomQueryTarget: (isWebGL2) => { let target = [ @@ -497,7 +498,7 @@ make.webgl = { 'UNIFORM_OFFSET', 'UNIFORM_ARRAY_STRIDE', 'UNIFORM_MATRIX_STRIDE', - 'UNIFORM_IS_ROW_MAJOR', + 'UNIFORM_IS_ROW_MAJOR' ] return random.item(pname) }, @@ -530,14 +531,14 @@ make.webgl = { 'DYNAMIC_DRAW', 'STREAM_DRAW' ] - if (domino.modules.webgl.isWebGL2) { + if (isWebGL2) { usage.extends([ 'STATIC_READ', 'DYNAMIC_READ', 'STREAM_READ', 'STATIC_COPY', 'DYNAMIC_COPY', - 'STREAM_COPY', + 'STREAM_COPY' ]) } return random.item(usage)