Socket
Socket
Sign inDemoInstall

regl

Package Overview
Dependencies
0
Maintainers
5
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.1 to 1.7.0

24

CHANGES.md
# Release notes
## 1.6.1
* Browsers select their own, perhaps inconsistent, default for the `premultipledAlpha` context creation attribute. Regl enforces consistency by filling in unspecified values but since 1.4.0 has enforced `false` if unspecified, which seems to be nonstandard and in the minority. For improved backward compatibility, this PR sets `premultipledAlpha: true` when not explicitly specified. ([#566](https://github.com/regl-project/regl/pull/566), [#567](https://github.com/regl-project/regl/pull/567))
## 1.6.0 (Do not use)
* Faulty fix for [#566](https://github.com/regl-project/regl/pull/566)
## 1.5.2
* Remove an additional ES6 keyword ([#564](https://github.com/regl-project/regl/pull/564))
## 1.5.1
* Remove accidental inclusion of ES6 keywords ([#562](https://github.com/regl-project/regl/pull/562))
## 1.5.0
* Resize canvas using ResizeObserver, if available. ([#556](https://github.com/regl-project/regl/pull/556))
## 1.4.2
* Fix publishing error. Rebuild files in `dist` to match source.
## 1.4.1

@@ -4,0 +28,0 @@

2

dist/regl.d.ts

@@ -662,3 +662,3 @@ // Type definitions for regl 1.3.1

> = {
[Key in keyof Uniforms]: MaybeDynamic<Uniforms[Key], Context, Props>;
[Key in keyof Uniforms]: MaybeDynamic<Uniforms[Key], Context, Props>|MaybeDynamic<Uniforms[Key], Context, Props>[];
}

@@ -665,0 +665,0 @@

@@ -106,3 +106,3 @@ var check = require('./util/check')

gl.vertexAttribPointer(i, binding.size, binding.type, binding.normalized, binding.stride, binding.offfset)
if (exti) {
if (exti && binding.divisor) {
exti.vertexAttribDivisorANGLE(i, binding.divisor)

@@ -147,3 +147,3 @@ }

gl.vertexAttribPointer(i, attr.size, attr.type, attr.normalized, attr.stride, attr.offset)
if (exti) {
if (exti && attr.divisor) {
exti.vertexAttribDivisorANGLE(i, attr.divisor)

@@ -204,7 +204,3 @@ }

for (var j = 0; j < vao.buffers.length; ++j) {
vao.buffers[j].destroy()
}
vao.buffers.length = 0
var bufUpdated = {}
var nattributes = vao.attributes

@@ -215,4 +211,17 @@ nattributes.length = attributes.length

var rec = nattributes[i] = new AttributeRecord()
if (Array.isArray(spec) || isTypedArray(spec) || isNDArrayLike(spec)) {
var buf = bufferState.create(spec, GL_ARRAY_BUFFER, false, true)
var data = spec.data || spec
if (Array.isArray(data) || isTypedArray(data) || isNDArrayLike(data)) {
var buf
if (vao.buffers[i]) {
buf = vao.buffers[i]
if (isTypedArray(data) && buf._buffer.byteLength >= data.byteLength) {
buf.subdata(data)
} else {
buf.destroy()
vao.buffers[i] = null
}
}
if (!vao.buffers[i]) {
buf = vao.buffers[i] = bufferState.create(spec, GL_ARRAY_BUFFER, false, true)
}
rec.buffer = bufferState.getBuffer(buf)

@@ -226,3 +235,3 @@ rec.size = rec.buffer.dimension | 0

rec.state = 1
vao.buffers.push(buf)
bufUpdated[i] = 1
} else if (bufferState.getBuffer(spec)) {

@@ -269,2 +278,10 @@ rec.buffer = bufferState.getBuffer(spec)

// retire unused buffers
for (var j = 0; j < vao.buffers.length; ++j) {
if (!bufUpdated[j] && vao.buffers[j]) {
vao.buffers[j].destroy()
vao.buffers[j] = null
}
}
vao.refresh()

@@ -275,2 +292,8 @@ return updateVAO

updateVAO.destroy = function () {
for (var j = 0; j < vao.buffers.length; ++j) {
if (vao.buffers[j]) {
vao.buffers[j].destroy()
}
}
vao.buffers.length = 0
vao.destroy()

@@ -277,0 +300,0 @@ }

@@ -0,4 +1,8 @@

var check = require('./util/check')
var VARIABLE_COUNTER = 0
var DYN_FUNC = 0
var DYN_CONSTANT = 5
var DYN_ARRAY = 6

@@ -59,4 +63,3 @@ function DynamicVariable (type, data) {

function isDynamic (x) {
return (typeof x === 'function' && !x._reglType) ||
x instanceof DynamicVariable
return (typeof x === 'function' && !x._reglType) || (x instanceof DynamicVariable)
}

@@ -67,4 +70,10 @@

return new DynamicVariable(DYN_FUNC, x)
} else if (typeof x === 'number' || typeof x === 'boolean') {
return new DynamicVariable(DYN_CONSTANT, x)
} else if (Array.isArray(x)) {
return new DynamicVariable(DYN_ARRAY, x.map((y, i) => unbox(y, path + '[' + i + ']')))
} else if (x instanceof DynamicVariable) {
return x
}
return x
check(false, 'invalid option type in uniform ' + path)
}

@@ -71,0 +80,0 @@

var check = require('./util/check')
var extend = require('./util/extend')
var values = require('./util/values')

@@ -65,2 +66,3 @@

this.attributes = []
this.refCount = 1

@@ -211,4 +213,7 @@ if (config.profile) {

var prevProgram = cache[vertId]
if (prevProgram && !attribLocations) {
return prevProgram
if (prevProgram) {
prevProgram.refCount++
if (!attribLocations) {
return prevProgram
}
}

@@ -222,3 +227,25 @@ var program = new REGLProgram(fragId, vertId)

programList.push(program)
return program
return extend(program, {
destroy: function () {
program.refCount--
if (program.refCount <= 0) {
gl.deleteProgram(program.program)
var idx = programList.indexOf(program)
programList.splice(idx, 1)
stats.shaderCount--
}
// no program is linked to this vert anymore
if (cache[program.vertId].refCount <= 0) {
gl.deleteShader(vertShaders[program.vertId])
delete vertShaders[program.vertId]
delete programCache[program.fragId][program.vertId]
}
// no program is linked to this frag anymore
if (!Object.keys(programCache[program.fragId]).length) {
gl.deleteShader(fragShaders[program.fragId])
delete fragShaders[program.fragId]
delete programCache[program.fragId]
}
}
})
},

@@ -225,0 +252,0 @@

@@ -1655,2 +1655,16 @@ var check = require('./util/check')

function refreshTextures () {
for (var i = 0; i < numTexUnits; ++i) {
var tex = textureUnits[i]
if (tex) {
tex.bindCount = 0
tex.unit = -1
textureUnits[i] = null
}
gl.activeTexture(GL_TEXTURE0 + i)
gl.bindTexture(GL_TEXTURE_2D, null)
gl.bindTexture(GL_TEXTURE_CUBE_MAP, null)
}
}
return {

@@ -1663,4 +1677,5 @@ create2D: createTexture2D,

},
restore: restoreTextures
restore: restoreTextures,
refresh: refreshTextures
}
}
{
"name": "regl",
"version": "1.6.1",
"version": "1.7.0",
"description": "regl is a fast functional WebGL framework.",

@@ -5,0 +5,0 @@ "main": "dist/regl.js",

@@ -662,3 +662,3 @@ // Type definitions for regl 1.3.1

> = {
[Key in keyof Uniforms]: MaybeDynamic<Uniforms[Key], Context, Props>;
[Key in keyof Uniforms]: MaybeDynamic<Uniforms[Key], Context, Props>|MaybeDynamic<Uniforms[Key], Context, Props>[];
}

@@ -665,0 +665,0 @@

@@ -315,3 +315,3 @@ var check = require('./lib/util/check')

function separateDynamic (object) {
function separateDynamic (object, useArrays) {
var staticItems = {}

@@ -323,5 +323,12 @@ var dynamicItems = {}

dynamicItems[option] = dynamic.unbox(value, option)
} else {
staticItems[option] = value
return
} else if (useArrays && Array.isArray(value)) {
for (var i = 0; i < value.length; ++i) {
if (dynamic.isDynamic(value[i])) {
dynamicItems[option] = dynamic.unbox(value, option)
return
}
}
}
staticItems[option] = value
})

@@ -335,6 +342,6 @@ return {

// Treat context variables separate from other dynamic variables
var context = separateDynamic(options.context || {})
var uniforms = separateDynamic(options.uniforms || {})
var attributes = separateDynamic(options.attributes || {})
var opts = separateDynamic(flattenNestedOptions(options))
var context = separateDynamic(options.context || {}, true)
var uniforms = separateDynamic(options.uniforms || {}, true)
var attributes = separateDynamic(options.attributes || {}, false)
var opts = separateDynamic(flattenNestedOptions(options), false)

@@ -396,3 +403,6 @@ var stats = {

return extend(REGLCommand, {
stats: stats
stats: stats,
destroy: function () {
compiled.destroy()
}
})

@@ -500,2 +510,3 @@ }

function refresh () {
textureState.refresh()
pollViewport()

@@ -502,0 +513,0 @@ core.procs.refresh()

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc