@luma.gl/webgl 9.0.0-alpha.42 → 9.0.0-alpha.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +10 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +9 -3
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/dist.dev.js +46 -2
- package/dist/index.cjs +13 -2
- package/dist.min.js +22 -22
- package/package.json +5 -5
- package/src/adapter/resources/webgl-render-pass.ts +6 -0
- package/src/adapter/resources/webgl-render-pipeline.ts +17 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgl",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.43",
|
|
4
4
|
"description": "WebGL2 adapter for the luma.gl API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
|
-
"@luma.gl/constants": "9.0.0-alpha.
|
|
48
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
47
|
+
"@luma.gl/constants": "9.0.0-alpha.43",
|
|
48
|
+
"@luma.gl/core": "9.0.0-alpha.43",
|
|
49
49
|
"@probe.gl/env": "^4.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@luma.gl/test-utils": "9.0.0-alpha.
|
|
52
|
+
"@luma.gl/test-utils": "9.0.0-alpha.43"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "1527d42e56ce203938534bf0d3318d303ebde066"
|
|
55
55
|
}
|
|
@@ -6,6 +6,7 @@ import {WebGLDevice} from '../webgl-device';
|
|
|
6
6
|
import {GL, GLParameters} from '@luma.gl/constants';
|
|
7
7
|
import {withGLParameters} from '../../context/state-tracker/with-parameters';
|
|
8
8
|
import {setGLParameters} from '../../context/parameters/unified-parameter-api';
|
|
9
|
+
import {pushContextState, popContextState} from '../../context/state-tracker/track-context-state';
|
|
9
10
|
|
|
10
11
|
// Should collapse during minification
|
|
11
12
|
const GL_DEPTH_BUFFER_BIT = 0x00000100;
|
|
@@ -25,6 +26,7 @@ export class WEBGLRenderPass extends RenderPass {
|
|
|
25
26
|
this.device = device;
|
|
26
27
|
|
|
27
28
|
// TODO - do parameters (scissorRect) affect the clear operation?
|
|
29
|
+
pushContextState(this.device.gl);
|
|
28
30
|
this.setParameters(this.props.parameters);
|
|
29
31
|
|
|
30
32
|
// Hack - for now WebGL draws in "immediate mode" (instead of queueing the operations)...
|
|
@@ -32,6 +34,10 @@ export class WEBGLRenderPass extends RenderPass {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
end(): void {
|
|
37
|
+
popContextState(this.device.gl);
|
|
38
|
+
if (this.props.framebuffer) {
|
|
39
|
+
setGLParameters(this.device, {framebuffer: null});
|
|
40
|
+
}
|
|
35
41
|
// should add commands to CommandEncoder.
|
|
36
42
|
}
|
|
37
43
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type {UniformValue, RenderPipelineProps, Binding} from '@luma.gl/core';
|
|
5
5
|
import type {ShaderLayout, PrimitiveTopology} from '@luma.gl/core';
|
|
6
6
|
import type {RenderPass, VertexArray} from '@luma.gl/core';
|
|
7
|
-
import {RenderPipeline, cast, log} from '@luma.gl/core';
|
|
7
|
+
import {RenderPipeline, cast, splitUniformsAndBindings, log} from '@luma.gl/core';
|
|
8
8
|
import {mergeShaderLayout} from '@luma.gl/core';
|
|
9
9
|
// import {mergeShaderLayout, getAttributeInfosFromLayouts} from '@luma.gl/core';
|
|
10
10
|
import {GL} from '@luma.gl/constants';
|
|
@@ -131,7 +131,14 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
131
131
|
// }
|
|
132
132
|
|
|
133
133
|
for (const [name, value] of Object.entries(bindings)) {
|
|
134
|
-
|
|
134
|
+
// Accept both `xyz` and `xyzUniforms` as valid names for `xyzUniforms` uniform block
|
|
135
|
+
// This convention allows shaders to name uniform blocks as `uniform appUniforms {} app;`
|
|
136
|
+
// and reference them as `app` from both GLSL and JS.
|
|
137
|
+
// TODO - this is rather hacky - we could also remap the name directly in the shader layout.
|
|
138
|
+
const binding =
|
|
139
|
+
this.shaderLayout.bindings.find(binding => binding.name === name) ||
|
|
140
|
+
this.shaderLayout.bindings.find(binding => binding.name === `${name}Uniforms`);
|
|
141
|
+
|
|
135
142
|
if (!binding) {
|
|
136
143
|
const validBindings = this.shaderLayout.bindings
|
|
137
144
|
.map(binding => `"${binding.name}"`)
|
|
@@ -168,6 +175,12 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
setUniforms(uniforms: Record<string, UniformValue>) {
|
|
178
|
+
const {bindings} = splitUniformsAndBindings(uniforms);
|
|
179
|
+
Object.keys(bindings).forEach(name => {
|
|
180
|
+
log.warn(
|
|
181
|
+
`Unsupported value "${bindings[name]}" used in setUniforms() for key ${name}. Use setBindings() instead?`
|
|
182
|
+
)();
|
|
183
|
+
});
|
|
171
184
|
// TODO - check against layout
|
|
172
185
|
Object.assign(this.uniforms, uniforms);
|
|
173
186
|
}
|
|
@@ -386,7 +399,8 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
386
399
|
let textureUnit = 0;
|
|
387
400
|
let uniformBufferIndex = 0;
|
|
388
401
|
for (const binding of this.shaderLayout.bindings) {
|
|
389
|
-
|
|
402
|
+
// Accept both `xyz` and `xyzUniforms` as valid names for `xyzUniforms` uniform block
|
|
403
|
+
const value = this.bindings[binding.name] || this.bindings[binding.name.replace(/Uniforms$/, '')];
|
|
390
404
|
if (!value) {
|
|
391
405
|
throw new Error(`No value for binding ${binding.name} in ${this.id}`);
|
|
392
406
|
}
|