Backport WebGL additions from Node

This commit is contained in:
Christoph Diehl 2018-04-11 20:36:29 +02:00
parent 9807668e3e
commit f8c8f7037e
No known key found for this signature in database
GPG key ID: 799CE5B68FEF404A

View file

@ -551,5 +551,192 @@ make.webgl = {
])
}
return random.item(usage)
},
randomParameter: (isWebGL2) => {
let pname = [
'ACTIVE_TEXTURE',
'ALIASED_LINE_WIDTH_RANGE',
'ALIASED_POINT_SIZE_RANGE',
'ALPHA_BITS',
'ARRAY_BUFFER_BINDING',
'BLEND',
'BLEND_COLOR',
'BLEND_DST_ALPHA',
'BLEND_DST_RGB',
'BLEND_EQUATION_ALPHA',
'BLEND_EQUATION_RGB',
'BLEND_SRC_ALPHA',
'BLEND_SRC_RGB',
'BLUE_BITS',
'COLOR_CLEAR_VALUE',
'COLOR_WRITEMASK',
'COMPRESSED_TEXTURE_FORMATS',
'CULL_FACE',
'CULL_FACE_MODE',
'CURRENT_PROGRAM',
'DEPTH_BITS',
'DEPTH_CLEAR_VALUE',
'DEPTH_FUNC',
'DEPTH_RANGE',
'DEPTH_TEST',
'DEPTH_WRITEMASK',
'DITHER',
'ELEMENT_ARRAY_BUFFER_BINDING',
'FRAMEBUFFER_BINDING',
'FRONT_FACE',
'GENERATE_MIPMAP_HINT',
'GREEN_BITS',
'IMPLEMENTATION_COLOR_READ_FORMAT',
'IMPLEMENTATION_COLOR_READ_TYPE',
'LINE_WIDTH',
'MAX_COMBINED_TEXTURE_IMAGE_UNITS',
'MAX_CUBE_MAP_TEXTURE_SIZE',
'MAX_FRAGMENT_UNIFORM_VECTORS',
'MAX_RENDERBUFFER_SIZE',
'MAX_TEXTURE_IMAGE_UNITS',
'MAX_TEXTURE_SIZE',
'MAX_VARYING_VECTORS',
'MAX_VERTEX_ATTRIBS',
'MAX_VERTEX_TEXTURE_IMAGE_UNITS',
'MAX_VERTEX_UNIFORM_VECTORS',
'MAX_VIEWPORT_DIMS',
'PACK_ALIGNMENT',
'POLYGON_OFFSET_FACTOR',
'POLYGON_OFFSET_FILL',
'POLYGON_OFFSET_UNITS',
'RED_BITS',
'RENDERBUFFER_BINDING',
'RENDERER',
'SAMPLE_ALPHA_TO_COVERAGE',
'SAMPLE_BUFFERS',
'SAMPLE_COVERAGE',
'SAMPLE_COVERAGE_INVERT',
'SAMPLE_COVERAGE_VALUE',
'SAMPLES',
'SCISSOR_BOX',
'SCISSOR_TEST',
'SHADING_LANGUAGE_VERSION',
'STENCIL_BACK_FAIL',
'STENCIL_BACK_FUNC',
'STENCIL_BACK_PASS_DEPTH_FAIL',
'STENCIL_BACK_PASS_DEPTH_PASS',
'STENCIL_BACK_REF',
'STENCIL_BACK_VALUE_MASK',
'STENCIL_BACK_WRITEMASK',
'STENCIL_BITS',
'STENCIL_CLEAR_VALUE',
'STENCIL_FAIL',
'STENCIL_FUNC',
'STENCIL_PASS_DEPTH_FAIL',
'STENCIL_PASS_DEPTH_PASS',
'STENCIL_REF',
'STENCIL_TEST',
'STENCIL_VALUE_MASK',
'STENCIL_WRITEMASK',
'SUBPIXEL_BITS',
'TEXTURE_BINDING_2D',
'TEXTURE_BINDING_CUBE_MAP',
'UNPACK_ALIGNMENT',
'UNPACK_COLORSPACE_CONVERSION_WEBGL',
'UNPACK_FLIP_Y_WEBGL',
'UNPACK_PREMULTIPLY_ALPHA_WEBGL',
'VENDOR',
'VERSION',
'VIEWPORT',
'VERSION',
'SHADING_LANGUAGE_VERSION',
'VENDOR',
'RENDERER'
]
if (isWebGL2) {
pname.extends([
'COPY_READ_BUFFER_BINDING',
'COPY_WRITE_BUFFER_BINDING',
'DRAW_BUFFERi',
'DRAW_FRAMEBUFFER_BINDING',
'FRAGMENT_SHADER_DERIVATIVE_HINT',
'MAX_3D_TEXTURE_SIZE',
'MAX_ARRAY_TEXTURE_LAYERS',
'MAX_CLIENT_WAIT_TIMEOUT_WEBGL',
'MAX_COLOR_ATTACHMENTS',
'MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS',
'MAX_COMBINED_UNIFORM_BLOCKS',
'MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS',
'MAX_DRAW_BUFFERS',
'MAX_ELEMENT_INDEX',
'MAX_ELEMENTS_INDICE',
'MAX_ELEMENTS_VERTICES',
'MAX_FRAGMENT_INPUT_COMPONENTS',
'MAX_FRAGMENT_UNIFORM_BLOCKS',
'MAX_FRAGMENT_UNIFORM_COMPONENTS',
'MAX_PROGRAM_TEXEL_OFFSET',
'MAX_SAMPLES',
'MAX_SERVER_WAIT_TIMEOUT',
'MAX_TEXTURE_LOD_BIAS',
'MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS',
'MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS',
'MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS',
'MAX_UNIFORM_BLOCK_SIZE',
'MAX_UNIFORM_BUFFER_BINDINGS',
'MAX_VARYING_COMPONENTS',
'MAX_VERTEX_OUTPUT_COMPONENTS',
'MAX_VERTEX_UNIFORM_BLOCKS',
'MAX_VERTEX_UNIFORM_COMPONENTS',
'MIN_PROGRAM_TEXEL_OFFSET',
'PACK_ROW_LENGTH',
'PACK_SKIP_PIXELS',
'PACK_SKIP_ROWS',
'PIXEL_PACK_BUFFER_BINDING',
'PIXEL_UNPACK_BUFFER_BINDING',
'RASTERIZER_DISCARD',
'READ_BUFFER',
'READ_FRAMEBUFFER_BINDING',
'SAMPLER_BINDING',
'TEXTURE_BINDING_2D_ARRAY',
'TEXTURE_BINDING_3D',
'TRANSFORM_FEEDBACK_ACTIVE',
'TRANSFORM_FEEDBACK_BINDING',
'TRANSFORM_FEEDBACK_BUFFER_BINDING',
'TRANSFORM_FEEDBACK_PAUSED',
'UNIFORM_BUFFER_BINDING',
'UNIFORM_BUFFER_OFFSET_ALIGNMENT',
'UNPACK_IMAGE_HEIGHT',
'UNPACK_ROW_LENGTH',
'UNPACK_SKIP_IMAGES',
'UNPACK_SKIP_PIXELS',
'UNPACK_SKIP_ROWS',
'VERTEX_ARRAY_BINDING'
])
}
return random.item(pname)
},
randomProgramParameter: () => {
let pname = [
'DELETE_STATUS',
'LINK_STATUS',
'VALIDATE_STATUS',
'ATTACHED_SHADERS',
'ACTIVE_ATTRIBUTES',
'ACTIVE_UNIFORMS',
'TRANSFORM_FEEDBACK_BUFFER_MODE',
'TRANSFORM_FEEDBACK_VARYINGS',
'ACTIVE_UNIFORM_BLOCKS'
]
return random.item(pname)
},
randomRenderBufferParameter: () => {
let pname = [
'RENDERBUFFER_WIDTH',
'RENDERBUFFER_HEIGHT',
'RENDERBUFFER_INTERNAL_FORMAT',
'RENDERBUFFER_RED_SIZE',
'RENDERBUFFER_GREEN_SIZE',
'RENDERBUFFER_BLUE_SIZE',
'RENDERBUFFER_ALPHA_SIZE',
'RENDERBUFFER_DEPTH_SIZE',
'RENDERBUFFER_STENCIL_SIZE'
]
return random.item(pname)
}
}