@luma.gl/webgl 9.0.0-beta.5 → 9.0.0-beta.7
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/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +128 -71
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +20 -19
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
- package/dist/adapter/converters/shader-formats.js +40 -20
- package/dist/adapter/converters/texture-formats.d.ts +16 -11
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +224 -205
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +22 -21
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +19 -5
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +89 -43
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.js +22 -19
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +33 -48
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.js +42 -87
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
- package/dist/adapter/helpers/decode-webgl-types.js +47 -46
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +35 -34
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +3 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +42 -41
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js +40 -39
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +2 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +2 -2
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +30 -17
- package/dist/adapter/objects/webgl-resource.d.ts +2 -24
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +6 -101
- package/dist/adapter/resources/webgl-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +16 -15
- package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +32 -31
- package/dist/adapter/resources/webgl-command-encoder.d.ts +8 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +4 -2
- package/dist/adapter/resources/webgl-external-texture.js +6 -5
- package/dist/adapter/resources/webgl-framebuffer.d.ts +6 -10
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +60 -53
- package/dist/adapter/resources/webgl-query-set.d.ts +44 -0
- package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-query-set.js +136 -0
- package/dist/adapter/resources/webgl-render-pass.d.ts +3 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +20 -12
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +52 -61
- package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +5 -4
- package/dist/adapter/resources/webgl-shader.d.ts +3 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +15 -9
- package/dist/adapter/resources/webgl-texture-view.d.ts +14 -0
- package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-texture-view.js +18 -0
- package/dist/adapter/resources/webgl-texture.d.ts +6 -4
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +39 -32
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +10 -10
- package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -3
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +10 -9
- package/dist/adapter/webgl-canvas-context.d.ts +2 -2
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +3 -2
- package/dist/adapter/webgl-device.d.ts +35 -30
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +110 -109
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +8 -7
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +5 -4
- package/dist/classic/copy-and-blit.d.ts +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +19 -19
- package/dist/classic/format-utils.d.ts.map +1 -1
- package/dist/classic/format-utils.js +16 -15
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +20 -19
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +2 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +7 -6
- package/dist/context/{context → helpers}/create-browser-context.d.ts.map +1 -1
- package/dist/context/{context → helpers}/create-browser-context.js +2 -1
- package/dist/context/{context/context-data.d.ts → helpers/webgl-context-data.d.ts} +2 -3
- package/dist/context/helpers/webgl-context-data.d.ts.map +1 -0
- package/dist/context/helpers/webgl-context-data.js +21 -0
- package/dist/context/helpers/webgl-extensions.d.ts +4 -0
- package/dist/context/helpers/webgl-extensions.d.ts.map +1 -0
- package/dist/context/helpers/webgl-extensions.js +10 -0
- package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +7 -11
- package/dist/context/parameters/webgl-parameter-tables.d.ts +12 -13
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +302 -295
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +2 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +5 -4
- package/dist/context/state-tracker/with-parameters.d.ts +2 -3
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +6 -8
- package/dist/dist.dev.js +1635 -1387
- package/dist/index.cjs +1766 -1534
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +25 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist.min.js +6 -6
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +114 -27
- package/src/adapter/converters/sampler-parameters.ts +12 -3
- package/src/adapter/converters/shader-formats.ts +47 -22
- package/src/adapter/converters/texture-formats.ts +138 -114
- package/src/adapter/converters/vertex-formats.ts +3 -3
- package/src/adapter/device-helpers/webgl-device-features.ts +102 -50
- package/src/adapter/device-helpers/webgl-device-info.ts +28 -19
- package/src/adapter/device-helpers/webgl-device-limits.ts +46 -150
- package/src/adapter/helpers/decode-webgl-types.ts +13 -7
- package/src/adapter/helpers/get-shader-layout.ts +4 -3
- package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
- package/src/adapter/helpers/set-uniform.ts +2 -1
- package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
- package/src/adapter/objects/constants-to-keys.ts +2 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +36 -14
- package/src/adapter/objects/webgl-resource.ts +7 -125
- package/src/adapter/resources/webgl-buffer.ts +4 -3
- package/src/adapter/resources/webgl-command-buffer.ts +5 -5
- package/src/adapter/resources/webgl-command-encoder.ts +14 -11
- package/src/adapter/resources/webgl-external-texture.ts +6 -5
- package/src/adapter/resources/webgl-framebuffer.ts +61 -53
- package/src/adapter/resources/webgl-query-set.ts +171 -0
- package/src/adapter/resources/webgl-render-pass.ts +20 -11
- package/src/adapter/resources/webgl-render-pipeline.ts +54 -54
- package/src/adapter/resources/webgl-sampler.ts +2 -1
- package/src/adapter/resources/webgl-shader.ts +12 -5
- package/src/adapter/resources/webgl-texture-view.ts +28 -0
- package/src/adapter/resources/webgl-texture.ts +14 -3
- package/src/adapter/resources/webgl-transform-feedback.ts +2 -7
- package/src/adapter/resources/webgl-vertex-array.ts +4 -3
- package/src/adapter/webgl-canvas-context.ts +6 -4
- package/src/adapter/webgl-device.ts +116 -107
- package/src/classic/accessor.ts +5 -4
- package/src/classic/clear.ts +14 -8
- package/src/classic/copy-and-blit.ts +11 -4
- package/src/classic/format-utils.ts +2 -1
- package/src/classic/typed-array-utils.ts +3 -7
- package/src/context/debug/spector.ts +9 -6
- package/src/context/debug/webgl-developer-tools.ts +27 -14
- package/src/context/{context → helpers}/create-browser-context.ts +3 -2
- package/src/context/helpers/webgl-context-data.ts +31 -0
- package/src/context/helpers/webgl-extensions.ts +17 -0
- package/src/context/parameters/unified-parameter-api.ts +6 -17
- package/src/context/parameters/webgl-parameter-tables.ts +69 -32
- package/src/context/state-tracker/deep-array-equal.ts +2 -1
- package/src/context/state-tracker/track-context-state.ts +11 -6
- package/src/context/state-tracker/with-parameters.ts +8 -8
- package/src/index.ts +7 -6
- package/src/types.ts +2 -1
- package/dist/adapter/device-helpers/device-features.d.ts +0 -6
- package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-features.js +0 -65
- package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
- package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js +0 -92
- package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js +0 -87
- package/dist/context/context/context-data.d.ts.map +0 -1
- package/dist/context/context/context-data.js +0 -33
- package/src/context/context/context-data.ts +0 -44
- /package/dist/context/{context → helpers}/create-browser-context.d.ts +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import {DeviceInfo} from '@luma.gl/core';
|
|
5
|
-
import {GL} from '@luma.gl/constants';
|
|
6
|
+
import {GL, GLExtensions} from '@luma.gl/constants';
|
|
7
|
+
import {getWebGLExtension} from '../../context/helpers/webgl-extensions';
|
|
6
8
|
|
|
7
9
|
/** @returns strings identifying the GPU vendor and driver. */
|
|
8
|
-
export function getDeviceInfo(gl: WebGL2RenderingContext): DeviceInfo {
|
|
10
|
+
export function getDeviceInfo(gl: WebGL2RenderingContext, extensions: GLExtensions): DeviceInfo {
|
|
9
11
|
// "Masked" info is always available, but don't contain much useful information
|
|
10
12
|
const vendorMasked = gl.getParameter(GL.VENDOR);
|
|
11
13
|
const rendererMasked = gl.getParameter(GL.RENDERER);
|
|
12
14
|
|
|
13
15
|
// If we are lucky, unmasked info is available
|
|
14
16
|
// https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/
|
|
15
|
-
|
|
17
|
+
getWebGLExtension(gl, 'WEBGL_debug_renderer_info', extensions);
|
|
18
|
+
const ext = extensions.WEBGL_debug_renderer_info;
|
|
16
19
|
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : GL.VENDOR);
|
|
17
20
|
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : GL.RENDERER);
|
|
18
21
|
const vendor = vendorUnmasked || vendorMasked;
|
|
@@ -47,44 +50,50 @@ export function getDeviceInfo(gl: WebGL2RenderingContext): DeviceInfo {
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/** "Sniff" the GPU type from the info. This works best if unmasked info is available. */
|
|
50
|
-
function identifyGPUVendor(
|
|
51
|
-
|
|
53
|
+
function identifyGPUVendor(
|
|
54
|
+
vendor: string,
|
|
55
|
+
renderer: string
|
|
56
|
+
): 'nvidia' | 'intel' | 'apple' | 'amd' | 'software' | 'unknown' {
|
|
57
|
+
if (/NVIDIA/i.exec(vendor) || /NVIDIA/i.exec(renderer)) {
|
|
52
58
|
return 'nvidia';
|
|
53
59
|
}
|
|
54
|
-
if (
|
|
60
|
+
if (/INTEL/i.exec(vendor) || /INTEL/i.exec(renderer)) {
|
|
55
61
|
return 'intel';
|
|
56
62
|
}
|
|
57
|
-
if (
|
|
63
|
+
if (/Apple/i.exec(vendor) || /Apple/i.exec(renderer)) {
|
|
58
64
|
return 'apple';
|
|
59
65
|
}
|
|
60
66
|
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
/AMD/i.exec(vendor) ||
|
|
68
|
+
/AMD/i.exec(renderer) ||
|
|
69
|
+
/ATI/i.exec(vendor) ||
|
|
70
|
+
/ATI/i.exec(renderer)
|
|
65
71
|
) {
|
|
66
72
|
return 'amd';
|
|
67
73
|
}
|
|
68
|
-
if (
|
|
74
|
+
if (/SwiftShader/i.exec(vendor) || /SwiftShader/i.exec(renderer)) {
|
|
69
75
|
return 'software';
|
|
70
76
|
}
|
|
71
|
-
|
|
77
|
+
|
|
72
78
|
return 'unknown';
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
/** "Sniff" the GPU backend from the info. This works best if unmasked info is available. */
|
|
76
82
|
function identifyGPUBackend(vendor: string, renderer: string): 'opengl' | 'metal' | 'unknown' {
|
|
77
|
-
if (
|
|
83
|
+
if (/Metal/i.exec(vendor) || /Metal/i.exec(renderer)) {
|
|
78
84
|
return 'metal';
|
|
79
85
|
}
|
|
80
|
-
if (
|
|
86
|
+
if (/ANGLE/i.exec(vendor) || /ANGLE/i.exec(renderer)) {
|
|
81
87
|
return 'opengl';
|
|
82
|
-
}
|
|
88
|
+
}
|
|
83
89
|
return 'unknown';
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
function identifyGPUType(
|
|
87
|
-
|
|
92
|
+
function identifyGPUType(
|
|
93
|
+
vendor: string,
|
|
94
|
+
renderer: string
|
|
95
|
+
): 'discrete' | 'integrated' | 'cpu' | 'unknown' {
|
|
96
|
+
if (/SwiftShader/i.exec(vendor) || /SwiftShader/i.exec(renderer)) {
|
|
88
97
|
return 'cpu';
|
|
89
98
|
}
|
|
90
99
|
|
|
@@ -1,157 +1,53 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
+
import {DeviceLimits} from '@luma.gl/core';
|
|
5
6
|
import {GL} from '@luma.gl/constants';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
[GL.MAX_CUBE_MAP_TEXTURE_SIZE]: number;
|
|
45
|
-
[GL.MAX_TEXTURE_IMAGE_UNITS]: number;
|
|
46
|
-
[GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: number;
|
|
47
|
-
[GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: number;
|
|
48
|
-
[GL.MAX_RENDERBUFFER_SIZE]: number;
|
|
49
|
-
[GL.MAX_VARYING_VECTORS]: number;
|
|
50
|
-
[GL.MAX_VERTEX_ATTRIBS]: number;
|
|
51
|
-
[GL.MAX_VERTEX_UNIFORM_VECTORS]: number;
|
|
52
|
-
[GL.MAX_FRAGMENT_UNIFORM_VECTORS]: number;
|
|
53
|
-
[GL.MAX_VIEWPORT_DIMS]: [number, number];
|
|
54
|
-
|
|
55
|
-
// Extensions
|
|
56
|
-
[GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: number;
|
|
57
|
-
|
|
58
|
-
// WebGL2 Limits
|
|
59
|
-
[GL.MAX_3D_TEXTURE_SIZE]: number;
|
|
60
|
-
[GL.MAX_ARRAY_TEXTURE_LAYERS]: number;
|
|
61
|
-
// [GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: number;
|
|
62
|
-
[GL.MAX_COLOR_ATTACHMENTS]: number;
|
|
63
|
-
[GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: number;
|
|
64
|
-
[GL.MAX_COMBINED_UNIFORM_BLOCKS]: number;
|
|
65
|
-
[GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: number;
|
|
66
|
-
[GL.MAX_DRAW_BUFFERS]: number;
|
|
67
|
-
[GL.MAX_ELEMENT_INDEX]: number;
|
|
68
|
-
[GL.MAX_ELEMENTS_INDICES]: number;
|
|
69
|
-
[GL.MAX_ELEMENTS_VERTICES]: number;
|
|
70
|
-
[GL.MAX_FRAGMENT_INPUT_COMPONENTS]: number;
|
|
71
|
-
[GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: number;
|
|
72
|
-
[GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: number;
|
|
73
|
-
[GL.MAX_SAMPLES]: number;
|
|
74
|
-
// [GL.MAX_SERVER_WAIT_TIMEOUT]: number;
|
|
75
|
-
[GL.MAX_TEXTURE_LOD_BIAS]: number;
|
|
76
|
-
[GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: number;
|
|
77
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: number;
|
|
78
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: number;
|
|
79
|
-
[GL.MAX_UNIFORM_BLOCK_SIZE]: number;
|
|
80
|
-
[GL.MAX_UNIFORM_BUFFER_BINDINGS]: number;
|
|
81
|
-
[GL.MAX_VARYING_COMPONENTS]: number;
|
|
82
|
-
[GL.MAX_VERTEX_OUTPUT_COMPONENTS]: number;
|
|
83
|
-
[GL.MAX_VERTEX_UNIFORM_BLOCKS]: number;
|
|
84
|
-
[GL.MAX_VERTEX_UNIFORM_COMPONENTS]: number;
|
|
85
|
-
[GL.MIN_PROGRAM_TEXEL_OFFSET]: number;
|
|
86
|
-
[GL.MAX_PROGRAM_TEXEL_OFFSET]: number;
|
|
87
|
-
[GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: number;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export function getWebGLLimits(gl: WebGL2RenderingContext): WebGLLimits {
|
|
91
|
-
function get<T = number>(pname: number): T {
|
|
92
|
-
return gl.getParameter(pname) as T;
|
|
93
|
-
}
|
|
94
|
-
function get2(pname: number, defaultValue?: number): number;
|
|
95
|
-
function get2<T>(pname: number, defaultValue: T): T;
|
|
96
|
-
function get2<T>(pname: number, defaultValue: T): T {
|
|
97
|
-
return (gl.getParameter(pname) as T) || defaultValue;
|
|
8
|
+
// prettier-ignore
|
|
9
|
+
export class WebGLDeviceLimits extends DeviceLimits {
|
|
10
|
+
get maxTextureDimension1D() { return 0; } // WebGL does not support 1D textures
|
|
11
|
+
get maxTextureDimension2D() { return this.getParameter(GL.MAX_TEXTURE_SIZE); }
|
|
12
|
+
get maxTextureDimension3D() { return this.getParameter(GL.MAX_3D_TEXTURE_SIZE); }
|
|
13
|
+
get maxTextureArrayLayers() { return this.getParameter(GL.MAX_ARRAY_TEXTURE_LAYERS); }
|
|
14
|
+
get maxBindGroups() { return 0; }
|
|
15
|
+
get maxDynamicUniformBuffersPerPipelineLayout() { return 0; } // TBD
|
|
16
|
+
get maxDynamicStorageBuffersPerPipelineLayout() { return 0; } // TBD
|
|
17
|
+
get maxSampledTexturesPerShaderStage() { return this.getParameter(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS); } // ) TBD
|
|
18
|
+
get maxSamplersPerShaderStage() { return this.getParameter(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS); }
|
|
19
|
+
get maxStorageBuffersPerShaderStage() { return 0; } // TBD
|
|
20
|
+
get maxStorageTexturesPerShaderStage() { return 0; } // TBD
|
|
21
|
+
get maxUniformBuffersPerShaderStage() { return this.getParameter(GL.MAX_UNIFORM_BUFFER_BINDINGS); }
|
|
22
|
+
get maxUniformBufferBindingSize() { return this.getParameter(GL.MAX_UNIFORM_BLOCK_SIZE); }
|
|
23
|
+
get maxStorageBufferBindingSize() { return 0; }
|
|
24
|
+
get minUniformBufferOffsetAlignment() { return this.getParameter(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT); }
|
|
25
|
+
get minStorageBufferOffsetAlignment() { return 0; }
|
|
26
|
+
get maxVertexBuffers() { return 16; } // WebGL 2 supports 16 buffers, see https://github.com/gpuweb/gpuweb/issues/4284
|
|
27
|
+
get maxVertexAttributes() { return this.getParameter(GL.MAX_VERTEX_ATTRIBS); }
|
|
28
|
+
get maxVertexBufferArrayStride() { return 2048; } // TBD, this is just the default value from WebGPU
|
|
29
|
+
get maxInterStageShaderComponents() { return this.getParameter(GL.MAX_VARYING_COMPONENTS); }
|
|
30
|
+
get maxComputeWorkgroupStorageSize() { return 0; } // WebGL does not support compute shaders
|
|
31
|
+
get maxComputeInvocationsPerWorkgroup() { return 0; } // WebGL does not support compute shaders
|
|
32
|
+
get maxComputeWorkgroupSizeX() { return 0; } // WebGL does not support compute shaders
|
|
33
|
+
get maxComputeWorkgroupSizeY() { return 0; } // WebGL does not support compute shaders
|
|
34
|
+
get maxComputeWorkgroupSizeZ() { return 0; } // WebGL does not support compute shaders
|
|
35
|
+
get maxComputeWorkgroupsPerDimension() { return 0;} // WebGL does not support compute shaders
|
|
36
|
+
|
|
37
|
+
// PRIVATE
|
|
38
|
+
|
|
39
|
+
protected gl: WebGL2RenderingContext;
|
|
40
|
+
protected limits: Partial<Record<GL, number>> = {};
|
|
41
|
+
|
|
42
|
+
constructor(gl: WebGL2RenderingContext) {
|
|
43
|
+
super();
|
|
44
|
+
this.gl = gl;
|
|
98
45
|
}
|
|
99
|
-
// function getMaxAnistropy() {
|
|
100
|
-
// const extension = gl.getExtension('EXT_texture_filter_anisotropic');
|
|
101
|
-
// }
|
|
102
|
-
return {
|
|
103
|
-
[GL.ALIASED_LINE_WIDTH_RANGE]: get(GL.ALIASED_LINE_WIDTH_RANGE),
|
|
104
|
-
[GL.ALIASED_POINT_SIZE_RANGE]: get(GL.ALIASED_POINT_SIZE_RANGE),
|
|
105
|
-
[GL.MAX_TEXTURE_SIZE]: get(GL.MAX_TEXTURE_SIZE),
|
|
106
|
-
[GL.MAX_CUBE_MAP_TEXTURE_SIZE]: get(GL.MAX_CUBE_MAP_TEXTURE_SIZE), // GLint
|
|
107
|
-
[GL.MAX_TEXTURE_IMAGE_UNITS]: get(GL.MAX_TEXTURE_IMAGE_UNITS), // GLint
|
|
108
|
-
[GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: get(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS), // GLint
|
|
109
|
-
[GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: get(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS), // GLint
|
|
110
|
-
[GL.MAX_RENDERBUFFER_SIZE]: get(GL.MAX_RENDERBUFFER_SIZE), // GLint
|
|
111
|
-
[GL.MAX_VARYING_VECTORS]: get(GL.MAX_VARYING_VECTORS), // GLint
|
|
112
|
-
[GL.MAX_VERTEX_ATTRIBS]: get(GL.MAX_VERTEX_ATTRIBS), // GLint
|
|
113
|
-
[GL.MAX_VERTEX_UNIFORM_VECTORS]: get(GL.MAX_VERTEX_UNIFORM_VECTORS), // GLint
|
|
114
|
-
[GL.MAX_FRAGMENT_UNIFORM_VECTORS]: get(GL.MAX_FRAGMENT_UNIFORM_VECTORS), // GLint
|
|
115
|
-
[GL.MAX_VIEWPORT_DIMS]: get(GL.MAX_VIEWPORT_DIMS),
|
|
116
46
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
[
|
|
122
|
-
|
|
123
|
-
// [GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: get2(GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL), // GLint64
|
|
124
|
-
[GL.MAX_COLOR_ATTACHMENTS]: get2(GL.MAX_COLOR_ATTACHMENTS), // GLint
|
|
125
|
-
[GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: get2(
|
|
126
|
-
GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
|
|
127
|
-
), // GLint64
|
|
128
|
-
[GL.MAX_COMBINED_UNIFORM_BLOCKS]: get2(GL.MAX_COMBINED_UNIFORM_BLOCKS), // GLint
|
|
129
|
-
[GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: get2(GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS), // GLint64
|
|
130
|
-
[GL.MAX_DRAW_BUFFERS]: get2(GL.MAX_DRAW_BUFFERS), // GLint
|
|
131
|
-
[GL.MAX_ELEMENT_INDEX]: get2(GL.MAX_ELEMENT_INDEX), // GLint64
|
|
132
|
-
[GL.MAX_ELEMENTS_INDICES]: get2(GL.MAX_ELEMENTS_INDICES), // GLint
|
|
133
|
-
[GL.MAX_ELEMENTS_VERTICES]: get2(GL.MAX_ELEMENTS_VERTICES), // GLint
|
|
134
|
-
[GL.MAX_FRAGMENT_INPUT_COMPONENTS]: get2(GL.MAX_FRAGMENT_INPUT_COMPONENTS), // GLint
|
|
135
|
-
[GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: get2(GL.MAX_FRAGMENT_UNIFORM_BLOCKS), // GLint
|
|
136
|
-
[GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: get2(GL.MAX_FRAGMENT_UNIFORM_COMPONENTS), // GLint
|
|
137
|
-
[GL.MAX_SAMPLES]: get2(GL.MAX_SAMPLES), // GLint
|
|
138
|
-
// [GL.MAX_SERVER_WAIT_TIMEOUT]: get2(GL.MAX_SERVER_WAIT_TIMEOUT), // GLint64
|
|
139
|
-
[GL.MAX_TEXTURE_LOD_BIAS]: get2(GL.MAX_TEXTURE_LOD_BIAS), // GLfloat
|
|
140
|
-
[GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: get2(
|
|
141
|
-
GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
|
|
142
|
-
), // GLint
|
|
143
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: get2(GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS), // GLint
|
|
144
|
-
[GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: get2(
|
|
145
|
-
GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS
|
|
146
|
-
), // GLint
|
|
147
|
-
[GL.MAX_UNIFORM_BLOCK_SIZE]: get2(GL.MAX_UNIFORM_BLOCK_SIZE), // GLint64
|
|
148
|
-
[GL.MAX_UNIFORM_BUFFER_BINDINGS]: get2(GL.MAX_UNIFORM_BUFFER_BINDINGS), // GLint
|
|
149
|
-
[GL.MAX_VARYING_COMPONENTS]: get2(GL.MAX_VARYING_COMPONENTS), // GLint
|
|
150
|
-
[GL.MAX_VERTEX_OUTPUT_COMPONENTS]: get2(GL.MAX_VERTEX_OUTPUT_COMPONENTS), // GLint
|
|
151
|
-
[GL.MAX_VERTEX_UNIFORM_BLOCKS]: get2(GL.MAX_VERTEX_UNIFORM_BLOCKS), // GLint
|
|
152
|
-
[GL.MAX_VERTEX_UNIFORM_COMPONENTS]: get2(GL.MAX_VERTEX_UNIFORM_COMPONENTS), // GLint
|
|
153
|
-
[GL.MIN_PROGRAM_TEXEL_OFFSET]: get2(GL.MIN_PROGRAM_TEXEL_OFFSET), // GLint
|
|
154
|
-
[GL.MAX_PROGRAM_TEXEL_OFFSET]: get2(GL.MAX_PROGRAM_TEXEL_OFFSET), // GLint
|
|
155
|
-
[GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: get2(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT) // GLint
|
|
156
|
-
};
|
|
47
|
+
protected getParameter(parameter: GL): number {
|
|
48
|
+
if (this.limits[parameter] === undefined) {
|
|
49
|
+
this.limits[parameter] = this.gl.getParameter(parameter);
|
|
50
|
+
}
|
|
51
|
+
return this.limits[parameter];
|
|
52
|
+
}
|
|
157
53
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import {ShaderUniformType, ShaderAttributeType, VertexFormat} from '@luma.gl/core';
|
|
@@ -67,9 +68,11 @@ const COMPOSITE_GL_TYPES: Record<
|
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
/** Decomposes a composite type (GL.VEC3) into a basic type (GL.FLOAT) and components (3) */
|
|
70
|
-
export function decodeGLUniformType(
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
export function decodeGLUniformType(glUniformType: GL): {
|
|
72
|
+
format: ShaderUniformType;
|
|
73
|
+
components: number;
|
|
74
|
+
glType: GLDataType;
|
|
75
|
+
} {
|
|
73
76
|
const typeAndSize = COMPOSITE_GL_TYPES[glUniformType];
|
|
74
77
|
if (!typeAndSize) {
|
|
75
78
|
throw new Error('uniform');
|
|
@@ -87,11 +90,11 @@ export function decodeGLAttributeType(glAttributeType: GL): {
|
|
|
87
90
|
} {
|
|
88
91
|
const typeAndSize = COMPOSITE_GL_TYPES[glAttributeType];
|
|
89
92
|
if (!typeAndSize) {
|
|
90
|
-
throw new Error('attribute')
|
|
93
|
+
throw new Error('attribute');
|
|
91
94
|
}
|
|
92
95
|
const [, components, , shaderType, vertexFormat] = typeAndSize;
|
|
93
96
|
// TODO sanity - if (shaderType.startsWith('mat' ...))
|
|
94
|
-
const attributeType = shaderType as unknown as ShaderAttributeType
|
|
97
|
+
const attributeType = shaderType as unknown as ShaderAttributeType;
|
|
95
98
|
return {attributeType, vertexFormat, components}; // , glType};
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -107,7 +110,10 @@ export function decomposeCompositeGLDataType(
|
|
|
107
110
|
return {type, components};
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
export function getCompositeGLDataType(
|
|
113
|
+
export function getCompositeGLDataType(
|
|
114
|
+
type: GL,
|
|
115
|
+
components
|
|
116
|
+
): {glType: GLDataType; name: string} | null {
|
|
111
117
|
switch (type) {
|
|
112
118
|
case GL.BYTE:
|
|
113
119
|
case GL.UNSIGNED_BYTE:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import type {
|
|
@@ -105,7 +106,7 @@ function readAttributeDeclarations(
|
|
|
105
106
|
if (location >= 0) {
|
|
106
107
|
const {attributeType} = decodeGLAttributeType(compositeType);
|
|
107
108
|
|
|
108
|
-
// Whether an attribute is instanced is essentially fixed by the structure of the shader code,
|
|
109
|
+
// Whether an attribute is instanced is essentially fixed by the structure of the shader code,
|
|
109
110
|
// so it is arguably a static property of the shader.
|
|
110
111
|
// There is no hint in the shader declarations
|
|
111
112
|
// Heuristic: Any attribute name containing the word "instance" will be assumed to be instanced
|
|
@@ -115,7 +116,7 @@ function readAttributeDeclarations(
|
|
|
115
116
|
name,
|
|
116
117
|
location,
|
|
117
118
|
stepMode,
|
|
118
|
-
type: attributeType
|
|
119
|
+
type: attributeType
|
|
119
120
|
// size - for arrays, size is the number of elements in the array
|
|
120
121
|
});
|
|
121
122
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import type {CompilerMessage} from '@luma.gl/core';
|
|
@@ -8,7 +9,7 @@ import type {CompilerMessage} from '@luma.gl/core';
|
|
|
8
9
|
* This follows documented WebGL conventions for compilation logs.
|
|
9
10
|
* Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)
|
|
10
11
|
*/
|
|
11
|
-
export function parseShaderCompilerLog(errLog: string)
|
|
12
|
+
export function parseShaderCompilerLog(errLog: string): readonly CompilerMessage[] {
|
|
12
13
|
// Parse the error - note: browser and driver dependent
|
|
13
14
|
const lines = errLog.split(/\r?\n/);
|
|
14
15
|
|
|
@@ -30,7 +31,7 @@ export function parseShaderCompilerLog(errLog: string) : readonly CompilerMessag
|
|
|
30
31
|
lineNum: 0,
|
|
31
32
|
linePos: 0
|
|
32
33
|
});
|
|
33
|
-
continue; // eslint-disable-line no-continue
|
|
34
|
+
continue; // eslint-disable-line no-continue
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
const [messageType, linePosition, lineNumber, ...rest] = segments;
|
|
@@ -50,15 +51,18 @@ export function parseShaderCompilerLog(errLog: string) : readonly CompilerMessag
|
|
|
50
51
|
type: getMessageType(messageType),
|
|
51
52
|
lineNum,
|
|
52
53
|
linePos // TODO
|
|
53
|
-
})
|
|
54
|
+
});
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
return messages;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
/** Ensure supported type */
|
|
60
|
-
function getMessageType(messageType: string): 'warning' | 'error' | 'info' {
|
|
61
|
+
function getMessageType(messageType: string): 'warning' | 'error' | 'info' {
|
|
61
62
|
const MESSAGE_TYPES = ['warning', 'error', 'info'];
|
|
62
63
|
const lowerCaseType = messageType.toLowerCase();
|
|
63
|
-
return (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as
|
|
64
|
+
return (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as
|
|
65
|
+
| 'warning'
|
|
66
|
+
| 'error'
|
|
67
|
+
| 'info';
|
|
64
68
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import {GL, GLPrimitiveTopology, GLPrimitive} from '@luma.gl/constants';
|
|
@@ -27,7 +28,10 @@ export function getPrimitiveDrawMode(drawMode: GLPrimitiveTopology): GLPrimitive
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// Counts the number of complete "primitives" given a number of vertices and a drawMode
|
|
30
|
-
export function getPrimitiveCount(options: {
|
|
31
|
+
export function getPrimitiveCount(options: {
|
|
32
|
+
drawMode: GLPrimitiveTopology;
|
|
33
|
+
vertexCount: number;
|
|
34
|
+
}): number {
|
|
31
35
|
const {drawMode, vertexCount} = options;
|
|
32
36
|
switch (drawMode) {
|
|
33
37
|
case GL.POINTS:
|
|
@@ -48,7 +52,10 @@ export function getPrimitiveCount(options: {drawMode: GLPrimitiveTopology, verte
|
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
// Counts the number of vertices after splitting the vertex stream into separate "primitives"
|
|
51
|
-
export function getVertexCount(options: {
|
|
55
|
+
export function getVertexCount(options: {
|
|
56
|
+
drawMode: GLPrimitiveTopology;
|
|
57
|
+
vertexCount: number;
|
|
58
|
+
}): number {
|
|
52
59
|
const {drawMode, vertexCount} = options;
|
|
53
60
|
const primitiveCount = getPrimitiveCount({drawMode, vertexCount});
|
|
54
61
|
switch (getPrimitiveDrawMode(drawMode)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import {assert, ResourceProps, TextureFormat} from '@luma.gl/core';
|
|
@@ -6,7 +7,10 @@ import {GL} from '@luma.gl/constants';
|
|
|
6
7
|
import {WebGLDevice} from '../webgl-device';
|
|
7
8
|
import {WebGLResource} from './webgl-resource';
|
|
8
9
|
import {isRenderbufferFormatSupported} from '../converters/texture-formats';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
convertTextureFormatToGL,
|
|
12
|
+
getTextureFormatBytesPerPixel
|
|
13
|
+
} from '../converters/texture-formats';
|
|
10
14
|
|
|
11
15
|
export type RenderbufferProps = ResourceProps & {
|
|
12
16
|
format: TextureFormat;
|
|
@@ -32,23 +36,35 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
|
|
|
32
36
|
userData: undefined,
|
|
33
37
|
format: undefined, // 'depth16unorm'
|
|
34
38
|
width: 1,
|
|
35
|
-
height: 1,
|
|
39
|
+
height: 1,
|
|
36
40
|
samples: 0
|
|
37
|
-
};
|
|
41
|
+
};
|
|
38
42
|
|
|
39
|
-
override get [Symbol.toStringTag](): string {
|
|
43
|
+
override get [Symbol.toStringTag](): string {
|
|
44
|
+
return 'Renderbuffer';
|
|
45
|
+
}
|
|
40
46
|
|
|
41
|
-
get width(): number {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
get
|
|
45
|
-
|
|
47
|
+
get width(): number {
|
|
48
|
+
return this.props.width;
|
|
49
|
+
}
|
|
50
|
+
get height(): number {
|
|
51
|
+
return this.props.height;
|
|
52
|
+
}
|
|
53
|
+
get format(): TextureFormat {
|
|
54
|
+
return this.props.format;
|
|
55
|
+
}
|
|
56
|
+
get samples(): number {
|
|
57
|
+
return this.props.samples;
|
|
58
|
+
}
|
|
59
|
+
get attachment() {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
46
62
|
|
|
47
63
|
/** WebGL format constant */
|
|
48
64
|
glFormat: GL;
|
|
49
65
|
|
|
50
66
|
static isTextureFormatSupported(device: WebGLDevice, format: TextureFormat): boolean {
|
|
51
|
-
return isRenderbufferFormatSupported(device.gl, format);
|
|
67
|
+
return isRenderbufferFormatSupported(device.gl, format, device._extensions);
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
constructor(device: WebGLDevice, props: RenderbufferProps) {
|
|
@@ -61,7 +77,7 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
|
|
|
61
77
|
this._initialize(this.props);
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
resize(size: {width: number
|
|
80
|
+
resize(size: {width: number; height: number}): void {
|
|
65
81
|
// Don't resize if width/height haven't changed
|
|
66
82
|
if (size.width !== this.width || size.height !== this.height) {
|
|
67
83
|
Object.assign(this.props, {...size, format: this.format, samples: this.samples});
|
|
@@ -81,7 +97,13 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
|
|
|
81
97
|
this.gl.bindRenderbuffer(GL.RENDERBUFFER, this.handle);
|
|
82
98
|
|
|
83
99
|
if (samples !== 0) {
|
|
84
|
-
this.gl.renderbufferStorageMultisample(
|
|
100
|
+
this.gl.renderbufferStorageMultisample(
|
|
101
|
+
GL.RENDERBUFFER,
|
|
102
|
+
samples,
|
|
103
|
+
this.glFormat,
|
|
104
|
+
width,
|
|
105
|
+
height
|
|
106
|
+
);
|
|
85
107
|
} else {
|
|
86
108
|
this.gl.renderbufferStorage(GL.RENDERBUFFER, this.glFormat, width, height);
|
|
87
109
|
}
|
|
@@ -89,7 +111,7 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
|
|
|
89
111
|
this.gl.bindRenderbuffer(GL.RENDERBUFFER, null);
|
|
90
112
|
|
|
91
113
|
this.trackAllocatedMemory(
|
|
92
|
-
width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.
|
|
114
|
+
width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.format)
|
|
93
115
|
);
|
|
94
116
|
}
|
|
95
117
|
|