@luma.gl/webgl 9.0.0-alpha.27 → 9.0.0-alpha.29
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/helpers/get-shader-layout.d.ts +8 -5
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +59 -16
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +12 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +84 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -0
- package/dist/adapter/objects/webgl-vertex-array-object.js +2 -2
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +13 -4
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +23 -21
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +27 -4
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +25 -7
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +5 -2
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/buffer-with-accessor.d.ts +5 -15
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -1
- package/dist/classic/buffer-with-accessor.js +25 -30
- package/dist/classic/buffer-with-accessor.js.map +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +2 -2
- package/dist/classic/copy-and-blit.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +2 -1
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +2 -2
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/dist.dev.js +164 -83
- package/dist/index.cjs +207 -146
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist.min.js +22 -22
- package/package.json +5 -5
- package/src/adapter/helpers/get-shader-layout.ts +93 -33
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +123 -0
- package/src/adapter/objects/webgl-vertex-array-object.ts +2 -2
- package/src/adapter/resources/webgl-buffer.ts +40 -41
- package/src/adapter/resources/webgl-external-texture.ts +1 -1
- package/src/adapter/resources/webgl-render-pipeline.ts +51 -35
- package/src/adapter/webgl-device.ts +4 -2
- package/src/classic/buffer-with-accessor.ts +42 -43
- package/src/classic/copy-and-blit.ts +2 -3
- package/src/context/debug/webgl-developer-tools.ts +8 -2
- package/src/context/parameters/webgl-parameter-tables.ts +2 -2
- package/src/index.ts +1 -1
|
@@ -10,11 +10,12 @@ export class WEBGLBuffer extends Buffer {
|
|
|
10
10
|
_defineProperty(this, "gl", void 0);
|
|
11
11
|
_defineProperty(this, "gl2", void 0);
|
|
12
12
|
_defineProperty(this, "handle", void 0);
|
|
13
|
-
_defineProperty(this, "
|
|
13
|
+
_defineProperty(this, "glTarget", void 0);
|
|
14
|
+
_defineProperty(this, "glUsage", void 0);
|
|
15
|
+
_defineProperty(this, "glIndexType", GL.UNSIGNED_SHORT);
|
|
14
16
|
_defineProperty(this, "byteLength", void 0);
|
|
15
17
|
_defineProperty(this, "bytesUsed", void 0);
|
|
16
18
|
_defineProperty(this, "debugData", null);
|
|
17
|
-
_defineProperty(this, "webglUsage", void 0);
|
|
18
19
|
this.device = device;
|
|
19
20
|
this.gl = this.device.gl;
|
|
20
21
|
this.gl2 = this.device.gl2;
|
|
@@ -24,8 +25,9 @@ export class WEBGLBuffer extends Buffer {
|
|
|
24
25
|
...this.props,
|
|
25
26
|
data: typeof this.props.data
|
|
26
27
|
});
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
28
|
+
this.glTarget = getWebGLTarget(this.props.usage);
|
|
29
|
+
this.glUsage = getWebGLUsage(this.props.usage);
|
|
30
|
+
this.glIndexType = this.props.indexType === 'uint32' ? GL.UNSIGNED_INT : GL.UNSIGNED_SHORT;
|
|
29
31
|
this.debugData = null;
|
|
30
32
|
if (props.data) {
|
|
31
33
|
this._initWithData(props.data, props.byteOffset, props.byteLength);
|
|
@@ -37,11 +39,11 @@ export class WEBGLBuffer extends Buffer {
|
|
|
37
39
|
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
38
40
|
let byteLength = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : data.byteLength + byteOffset;
|
|
39
41
|
assert(ArrayBuffer.isView(data));
|
|
40
|
-
const
|
|
41
|
-
this.gl.bindBuffer(
|
|
42
|
-
this.gl.bufferData(
|
|
43
|
-
this.gl.bufferSubData(
|
|
44
|
-
this.gl.bindBuffer(
|
|
42
|
+
const glTarget = this._getWriteTarget();
|
|
43
|
+
this.gl.bindBuffer(glTarget, this.handle);
|
|
44
|
+
this.gl.bufferData(glTarget, byteLength, this.glUsage);
|
|
45
|
+
this.gl.bufferSubData(glTarget, byteOffset, data);
|
|
46
|
+
this.gl.bindBuffer(glTarget, null);
|
|
45
47
|
this.debugData = data.slice(0, DEBUG_DATA_LENGTH);
|
|
46
48
|
this.bytesUsed = byteLength;
|
|
47
49
|
this.byteLength = byteLength;
|
|
@@ -54,10 +56,10 @@ export class WEBGLBuffer extends Buffer {
|
|
|
54
56
|
if (byteLength === 0) {
|
|
55
57
|
data = new Float32Array(0);
|
|
56
58
|
}
|
|
57
|
-
const
|
|
58
|
-
this.gl.bindBuffer(
|
|
59
|
-
this.gl.bufferData(
|
|
60
|
-
this.gl.bindBuffer(
|
|
59
|
+
const glTarget = this._getWriteTarget();
|
|
60
|
+
this.gl.bindBuffer(glTarget, this.handle);
|
|
61
|
+
this.gl.bufferData(glTarget, data, this.glUsage);
|
|
62
|
+
this.gl.bindBuffer(glTarget, null);
|
|
61
63
|
this.debugData = null;
|
|
62
64
|
this.bytesUsed = byteLength;
|
|
63
65
|
this.byteLength = byteLength;
|
|
@@ -76,15 +78,15 @@ export class WEBGLBuffer extends Buffer {
|
|
|
76
78
|
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
77
79
|
const srcOffset = 0;
|
|
78
80
|
const byteLength = undefined;
|
|
79
|
-
const
|
|
80
|
-
this.gl.bindBuffer(
|
|
81
|
+
const glTarget = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.glTarget;
|
|
82
|
+
this.gl.bindBuffer(glTarget, this.handle);
|
|
81
83
|
if (srcOffset !== 0 || byteLength !== undefined) {
|
|
82
84
|
this.device.assertWebGL2();
|
|
83
|
-
this.gl2.bufferSubData(
|
|
85
|
+
this.gl2.bufferSubData(glTarget, byteOffset, data, srcOffset, byteLength);
|
|
84
86
|
} else {
|
|
85
|
-
this.gl.bufferSubData(
|
|
87
|
+
this.gl.bufferSubData(glTarget, byteOffset, data);
|
|
86
88
|
}
|
|
87
|
-
this.gl.bindBuffer(
|
|
89
|
+
this.gl.bindBuffer(glTarget, null);
|
|
88
90
|
}
|
|
89
91
|
async readAsync() {
|
|
90
92
|
let byteOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
@@ -101,10 +103,10 @@ export class WEBGLBuffer extends Buffer {
|
|
|
101
103
|
this.debugData = null;
|
|
102
104
|
}
|
|
103
105
|
_getWriteTarget() {
|
|
104
|
-
return this.
|
|
106
|
+
return this.glTarget;
|
|
105
107
|
}
|
|
106
108
|
_getReadTarget() {
|
|
107
|
-
return this.
|
|
109
|
+
return this.glTarget;
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
function getWebGLTarget(usage) {
|
|
@@ -129,6 +131,6 @@ function getWebGLUsage(usage) {
|
|
|
129
131
|
if (usage & Buffer.UNIFORM) {
|
|
130
132
|
return GL.DYNAMIC_DRAW;
|
|
131
133
|
}
|
|
132
|
-
return GL.
|
|
134
|
+
return GL.STATIC_DRAW;
|
|
133
135
|
}
|
|
134
136
|
//# sourceMappingURL=webgl-buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-buffer.js","names":["Buffer","assert","GL","DEBUG_DATA_LENGTH","WEBGLBuffer","constructor","device","props","arguments","length","undefined","_defineProperty","gl","gl2","handle","createBuffer","setSpectorMetadata","data","target","getWebGLTarget","usage","webglUsage","getWebGLUsage","debugData","_initWithData","byteOffset","byteLength","_initWithByteLength","ArrayBuffer","isView","_getWriteTarget","bindBuffer","bufferData","bufferSubData","slice","bytesUsed","trackAllocatedMemory","Float32Array","destroy","destroyed","removeStats","trackDeallocatedMemory","deleteBuffer","write","srcOffset","isWebGL2","COPY_WRITE_BUFFER","assertWebGL2","readAsync","Uint8Array","dstOffset","COPY_READ_BUFFER","getBufferSubData","_invalidateDebugData","_getReadTarget","INDEX","ELEMENT_ARRAY_BUFFER","VERTEX","ARRAY_BUFFER","UNIFORM","UNIFORM_BUFFER","STATIC_DRAW","DYNAMIC_DRAW"],"sources":["../../../src/adapter/resources/webgl-buffer.ts"],"sourcesContent":["import type {BufferProps} from '@luma.gl/api';\nimport {Buffer, assert} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n/** WebGL Buffer interface */\nexport class WEBGLBuffer extends Buffer {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLBuffer;\n readonly target: number;\n\n byteLength: number;\n bytesUsed: number;\n debugData: ArrayBuffer | null = null;\n\n webglUsage: number;\n\n // accessor: {};\n\n \n constructor(device: WebGLDevice, props: BufferProps = {}) {\n super(device, props);\n\n this.device = device;\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n\n const handle = typeof props === 'object' ? (props ).handle : undefined;\n this.handle = handle || this.gl.createBuffer();\n device.setSpectorMetadata(this.handle, {...this.props, data: typeof this.props.data});\n\n // In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n // otherwise buffer type will lock to generic (non-element) buffer\n // In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n // @ts-expect-error Hack - Checking for subclass prop\n this.target = this.props.target || getWebGLTarget(this.props.usage);\n // @ts-expect-error Hack - Checking for subclass prop\n this.webglUsage = this.props.webglUsage || getWebGLUsage(this.props.usage);\n this.debugData = null;\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._initWithData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._initWithByteLength(props.byteLength || 0);\n }\n\n // Deprecated: Merge main props and accessor\n // this.accessor = {...props.accessor};\n\n // Object.seal(this);\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {\n assert(ArrayBuffer.isView(data));\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, byteOffset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _initWithByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, this.webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n return this;\n }\n\n override destroy(): void {\n if (!this.destroyed && this.handle) {\n this.removeStats();\n this.trackDeallocatedMemory();\n this.gl.deleteBuffer(this.handle);\n this.destroyed = true;\n // @ts-expect-error\n this.handle = null;\n }\n }\n\n override write(data: ArrayBufferView, byteOffset: number = 0): void {\n const srcOffset = 0;\n const byteLength = undefined; // data.byteLength;\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n const target = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n this.device.assertWebGL2();\n this.gl2.bufferSubData(target, byteOffset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, byteOffset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n // this.debugData = data.slice(byteOffset, 40);\n }\n\n /** Read data from the buffer */\n override async readAsync(\n byteOffset: number = 0,\n byteLength?: number\n ): Promise<ArrayBuffer> {\n this.device.assertWebGL2();\n\n const data = new Uint8Array(byteLength);\n const dstOffset = 0;\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n // this.debugData = null;\n\n return data;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n _invalidateDebugData() {\n this.debugData = null;\n }\n\n _getWriteTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getReadTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;\n }\n}\n\n// static MAP_READ = 0x01;\n// static MAP_WRITE = 0x02;\n// static COPY_SRC = 0x0004;\n// static COPY_DST = 0x0008;\n// static INDEX = 0x0010;\n// static VERTEX = 0x0020;\n// static UNIFORM = 0x0040;\n// static STORAGE = 0x0080;\n// static INDIRECT = 0x0100;\n// static QUERY_RESOLVE = 0x0200;\n\nfunction getWebGLTarget(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.ELEMENT_ARRAY_BUFFER;\n }\n if (usage & Buffer.VERTEX) {\n return GL.ARRAY_BUFFER;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.UNIFORM_BUFFER;\n }\n\n // gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n // gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n // gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n // gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n // gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n return GL.ARRAY_BUFFER;\n}\n\nfunction getWebGLUsage(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.VERTEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.DYNAMIC_DRAW;\n }\n return GL.DYNAMIC_DRAW;\n}\n"],"mappings":";AACA,SAAQA,MAAM,EAAEC,MAAM,QAAO,cAAc;AAC3C,SAAQC,EAAE,QAAO,oBAAoB;AAGrC,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,OAAO,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAgBtCK,WAAWA,CAACC,MAAmB,EAA2B;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AEpB;AACF;AAaA,SAASC,cAAcA,CAACC,KAAa,EAAM;EACzC,IAAIA,KAAK,GAAGpB,MAAM,CAACuD,KAAK,EAAE;IACxB,OAAOrD,EAAE,CAACsD,oBAAoB;EAChC;EACA,IAAIpC,KAAK,GAAGpB,MAAM,CAACyD,MAAM,EAAE;IACzB,OAAOvD,EAAE,CAACwD,YAAY;EACxB;EACA,IAAItC,KAAK,GAAGpB,MAAM,CAAC2D,OAAO,EAAE;IAC1B,OAAOzD,EAAE,CAAC0D,cAAc;EAC1B;EAUA,OAAO1D,EAAE,CAACwD,YAAY;AACxB;AAEA,SAASpC,aAAaA,CAACF,KAAa,EAAM;EACxC,IAAIA,KAAK,GAAGpB,MAAM,CAACuD,KAAK,EAAE;IACxB,OAAOrD,EAAE,CAAC2D,WAAW;EACvB;EACA,IAAIzC,KAAK,GAAGpB,MAAM,CAACyD,MAAM,EAAE;IACzB,OAAOvD,EAAE,CAAC2D,WAAW;EACvB;EACA,IAAIzC,KAAK,GAAGpB,MAAM,CAAC2D,OAAO,EAAE;IAC1B,OAAOzD,EAAE,CAAC4D,YAAY;EACxB;EACA,OAAO5D,EAAE,CAAC4D,YAAY;AACxB"}
|
|
1
|
+
{"version":3,"file":"webgl-buffer.js","names":["Buffer","assert","GL","DEBUG_DATA_LENGTH","WEBGLBuffer","constructor","device","props","arguments","length","undefined","_defineProperty","UNSIGNED_SHORT","gl","gl2","handle","createBuffer","setSpectorMetadata","data","glTarget","getWebGLTarget","usage","glUsage","getWebGLUsage","glIndexType","indexType","UNSIGNED_INT","debugData","_initWithData","byteOffset","byteLength","_initWithByteLength","ArrayBuffer","isView","_getWriteTarget","bindBuffer","bufferData","bufferSubData","slice","bytesUsed","trackAllocatedMemory","Float32Array","destroy","destroyed","removeStats","trackDeallocatedMemory","deleteBuffer","write","srcOffset","isWebGL2","COPY_WRITE_BUFFER","assertWebGL2","readAsync","Uint8Array","dstOffset","COPY_READ_BUFFER","getBufferSubData","_invalidateDebugData","_getReadTarget","INDEX","ELEMENT_ARRAY_BUFFER","VERTEX","ARRAY_BUFFER","UNIFORM","UNIFORM_BUFFER","STATIC_DRAW","DYNAMIC_DRAW"],"sources":["../../../src/adapter/resources/webgl-buffer.ts"],"sourcesContent":["import type {BufferProps} from '@luma.gl/api';\nimport {Buffer, assert} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n/** WebGL Buffer interface */\nexport class WEBGLBuffer extends Buffer {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLBuffer;\n\n /** Target in OpenGL defines the type of buffer */\n readonly glTarget: GL.ARRAY_BUFFER | GL.ELEMENT_ARRAY_BUFFER | GL.UNIFORM_BUFFER;\n /** Usage is a hint on how frequently the buffer will be updates */\n readonly glUsage: GL.STATIC_DRAW | GL.DYNAMIC_DRAW;\n /** Index type is needed when issuing draw calls, so we pre-compute it */\n readonly glIndexType: GL.UNSIGNED_SHORT | GL.UNSIGNED_INT = GL.UNSIGNED_SHORT;\n\n /** Number of bytes allocated on the GPU for this buffer */\n byteLength: number;\n /** Number of bytes used */\n bytesUsed: number;\n /** A partial CPU-side copy of the data in this buffer, for debugging purposes */\n debugData: ArrayBuffer | null = null;\n\n constructor(device: WebGLDevice, props: BufferProps = {}) {\n super(device, props);\n\n this.device = device;\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n\n const handle = typeof props === 'object' ? (props ).handle : undefined;\n this.handle = handle || this.gl.createBuffer();\n device.setSpectorMetadata(this.handle, {...this.props, data: typeof this.props.data});\n\n // - In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n // otherwise buffer type will lock to generic (non-element) buffer\n // - In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n this.glTarget = getWebGLTarget(this.props.usage);\n this.glUsage = getWebGLUsage(this.props.usage);\n this.glIndexType = this.props.indexType === 'uint32' ? GL.UNSIGNED_INT : GL.UNSIGNED_SHORT;\n\n this.debugData = null;\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._initWithData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._initWithByteLength(props.byteLength || 0);\n }\n }\n\n // PRIVATE METHODS\n\n /** Allocate a new buffer and initialize to contents of typed array */\n _initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {\n assert(ArrayBuffer.isView(data));\n\n const glTarget = this._getWriteTarget();\n this.gl.bindBuffer(glTarget, this.handle);\n this.gl.bufferData(glTarget, byteLength, this.glUsage);\n this.gl.bufferSubData(glTarget, byteOffset, data);\n this.gl.bindBuffer(glTarget, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _initWithByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const glTarget = this._getWriteTarget();\n\n this.gl.bindBuffer(glTarget, this.handle);\n this.gl.bufferData(glTarget, data, this.glUsage);\n this.gl.bindBuffer(glTarget, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n return this;\n }\n\n override destroy(): void {\n if (!this.destroyed && this.handle) {\n this.removeStats();\n this.trackDeallocatedMemory();\n this.gl.deleteBuffer(this.handle);\n this.destroyed = true;\n // @ts-expect-error\n this.handle = null;\n }\n }\n\n override write(data: ArrayBufferView, byteOffset: number = 0): void {\n const srcOffset = 0;\n const byteLength = undefined; // data.byteLength;\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n const glTarget = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n this.gl.bindBuffer(glTarget, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n this.device.assertWebGL2();\n this.gl2.bufferSubData(glTarget, byteOffset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(glTarget, byteOffset, data);\n }\n this.gl.bindBuffer(glTarget, null);\n\n // TODO - update local `data` if offsets are right\n // this.debugData = data.slice(byteOffset, 40);\n }\n\n /** Read data from the buffer */\n override async readAsync(\n byteOffset: number = 0,\n byteLength?: number\n ): Promise<ArrayBuffer> {\n this.device.assertWebGL2();\n\n const data = new Uint8Array(byteLength);\n const dstOffset = 0;\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n // this.debugData = null;\n\n return data;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n _invalidateDebugData() {\n this.debugData = null;\n }\n\n _getWriteTarget() {\n return this.glTarget;\n // return this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n }\n\n _getReadTarget() {\n return this.glTarget;\n // return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.glTarget;\n }\n}\n\n// static MAP_READ = 0x01;\n// static MAP_WRITE = 0x02;\n// static COPY_SRC = 0x0004;\n// static COPY_DST = 0x0008;\n// static INDEX = 0x0010;\n// static VERTEX = 0x0020;\n// static UNIFORM = 0x0040;\n// static STORAGE = 0x0080;\n// static INDIRECT = 0x0100;\n// static QUERY_RESOLVE = 0x0200;\n\nfunction getWebGLTarget(usage: number): GL.ARRAY_BUFFER | GL.ELEMENT_ARRAY_BUFFER | GL.UNIFORM_BUFFER {\n if (usage & Buffer.INDEX) {\n return GL.ELEMENT_ARRAY_BUFFER;\n }\n if (usage & Buffer.VERTEX) {\n return GL.ARRAY_BUFFER;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.UNIFORM_BUFFER;\n }\n\n // gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n // gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n // gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n // gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n // gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n return GL.ARRAY_BUFFER;\n}\n\n/** @todo usage is not passed correctly */\nfunction getWebGLUsage(usage: number): GL.STATIC_DRAW | GL.DYNAMIC_DRAW {\n if (usage & Buffer.INDEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.VERTEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.DYNAMIC_DRAW;\n }\n return GL.STATIC_DRAW;\n}\n"],"mappings":";AACA,SAAQA,MAAM,EAAEC,MAAM,QAAO,cAAc;AAC3C,SAAQC,EAAE,QAAO,oBAAoB;AAGrC,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,OAAO,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAoBtCK,WAAWA,CAACC,MAAmB,EAA2B;IAAA,IAAzBC,KAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACtD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,sBAVqCT,EAAE,CAACU,cAAc;IAAAD,eAAA;IAAAA,eAAA;IAA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,KAAK,GAAGrB,MAAM,CAAC6D,MAAM,EAAE;IACzB,OAAO3D,EAAE,CAAC4D,YAAY;EACxB;EACA,IAAIzC,KAAK,GAAGrB,MAAM,CAAC+D,OAAO,EAAE;IAC1B,OAAO7D,EAAE,CAAC8D,cAAc;EAC1B;EAUA,OAAO9D,EAAE,CAAC4D,YAAY;AACxB;AAGA,SAASvC,aAAaA,CAACF,KAAa,EAAoC;EACtE,IAAIA,KAAK,GAAGrB,MAAM,CAAC2D,KAAK,EAAE;IACxB,OAAOzD,EAAE,CAAC+D,WAAW;EACvB;EACA,IAAI5C,KAAK,GAAGrB,MAAM,CAAC6D,MAAM,EAAE;IACzB,OAAO3D,EAAE,CAAC+D,WAAW;EACvB;EACA,IAAI5C,KAAK,GAAGrB,MAAM,CAAC+D,OAAO,EAAE;IAC1B,OAAO7D,EAAE,CAACgE,YAAY;EACxB;EACA,OAAOhE,EAAE,CAAC+D,WAAW;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport class WEBGLExternalTexture extends WEBGLTexture {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLTexture;\n\n data;\n\n width: number = undefined;\n height: number = undefined;\n depth: number = undefined;\n\n format = undefined;\n type = undefined;\n dataFormat = undefined;\n border = undefined;\n mipmaps: boolean = undefined;\n\n textureUnit: number = undefined;\n\n sampler: WEBGLSampler;\n\n // Program.draw() checks the loaded flag of all textures to avoid\n // Textures that are still loading from promises\n // Set to true as soon as texture has been initialized with valid data\n loaded = false;\n _video;\n\n readonly target: GL;\n // target cannot be modified by bind:\n // textures are special because when you first bind them to a target,\n // they get special information. When you first bind a texture as a\n // GL_TEXTURE_2D, you are actually setting special state in the texture.\n // You are saying that this texture is a 2D texture.\n // And it will always be a 2D texture; this state cannot be changed ever.\n // If you have a texture that was first bound as a GL_TEXTURE_2D,\n // you must always bind it as a GL_TEXTURE_2D;\n // attempting to bind it as GL_TEXTURE_3D will give rise to an error\n // (while run-time).\n\n static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {\n const {format, linearFiltering} = options;\n let supported = true;\n if (format) {\n supported = supported && isFormatSupported(device.gl, format);\n supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));\n }\n return supported;\n }\n\n // eslint-disable-next-line max-statements\n constructor(device: Device | WebGLRenderingContext, props: TextureProps) {\n super(WebGLDevice.attach(device), {id: uid('texture'), ...props});\n\n this.
|
|
1
|
+
{"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport class WEBGLExternalTexture extends WEBGLTexture {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLTexture;\n\n data;\n\n width: number = undefined;\n height: number = undefined;\n depth: number = undefined;\n\n format = undefined;\n type = undefined;\n dataFormat = undefined;\n border = undefined;\n mipmaps: boolean = undefined;\n\n textureUnit: number = undefined;\n\n sampler: WEBGLSampler;\n\n // Program.draw() checks the loaded flag of all textures to avoid\n // Textures that are still loading from promises\n // Set to true as soon as texture has been initialized with valid data\n loaded = false;\n _video;\n\n readonly target: GL;\n // target cannot be modified by bind:\n // textures are special because when you first bind them to a target,\n // they get special information. When you first bind a texture as a\n // GL_TEXTURE_2D, you are actually setting special state in the texture.\n // You are saying that this texture is a 2D texture.\n // And it will always be a 2D texture; this state cannot be changed ever.\n // If you have a texture that was first bound as a GL_TEXTURE_2D,\n // you must always bind it as a GL_TEXTURE_2D;\n // attempting to bind it as GL_TEXTURE_3D will give rise to an error\n // (while run-time).\n\n static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {\n const {format, linearFiltering} = options;\n let supported = true;\n if (format) {\n supported = supported && isFormatSupported(device.gl, format);\n supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));\n }\n return supported;\n }\n\n // eslint-disable-next-line max-statements\n constructor(device: Device | WebGLRenderingContext, props: TextureProps) {\n super(WebGLDevice.attach(device), {id: uid('texture'), ...props});\n\n this.glTarget = getWebGLTextureTarget(props);\n\n this.device = WebGLDevice.attach(device);\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n this.handle = this.props.handle || this.gl.createTexture();\n\n let data = props.data;\n\n const isVideo = typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement;\n // @ts-expect-error\n if (isVideo && data.readyState < HTMLVideoElement.HAVE_METADATA) {\n this._video = null; // Declare member before the object is sealed\n data.addEventListener('loadeddata', () => this.initialize(props));\n return this;\n }\n\n update(): this {\n if (this._video) {\n const {video, parameters, lastTime} = this._video;\n // @ts-expect-error\n if (lastTime === video.currentTime || video.readyState < HTMLVideoElement.HAVE_CURRENT_DATA) {\n return;\n }\n this.setSubImageData({\n data: video,\n parameters\n });\n if (this.mipmaps) {\n this.generateMipmap();\n }\n this._video.lastTime = video.currentTime;\n }\n }\n\n\n*/"],"mappings":""}
|
|
@@ -1,20 +1,37 @@
|
|
|
1
|
-
import type { RenderPipelineProps, RenderPass, Buffer, Binding, ShaderLayout, TypedArray } from '@luma.gl/api';
|
|
1
|
+
import type { RenderPipelineProps, RenderPass, Buffer, Binding, ShaderLayout, TypedArray, BufferMapping } from '@luma.gl/api';
|
|
2
2
|
import { RenderPipeline } from '@luma.gl/api';
|
|
3
3
|
import { WebGLDevice } from '../webgl-device';
|
|
4
|
+
import { WEBGLBuffer } from './webgl-buffer';
|
|
4
5
|
import { WEBGLShader } from './webgl-shader';
|
|
5
6
|
import { WEBGLVertexArrayObject } from '../objects/webgl-vertex-array-object';
|
|
6
7
|
/** Creates a new render pipeline */
|
|
7
8
|
export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
9
|
+
/** The WebGL device that created this render pipeline */
|
|
8
10
|
device: WebGLDevice;
|
|
11
|
+
/** Handle to underlying WebGL program */
|
|
9
12
|
handle: WebGLProgram;
|
|
13
|
+
/** vertex shader */
|
|
10
14
|
vs: WEBGLShader;
|
|
15
|
+
/** fragment shader */
|
|
11
16
|
fs: WEBGLShader;
|
|
17
|
+
/** The merged layout */
|
|
12
18
|
layout: ShaderLayout;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
/** The layout extracted from shader by WebGL introspection APIs */
|
|
20
|
+
introspectedLayout: ShaderLayout;
|
|
21
|
+
/** Buffer map describing buffer interleaving etc */
|
|
22
|
+
bufferMap: BufferMapping[];
|
|
23
|
+
/** Uniforms set on this model */
|
|
16
24
|
uniforms: Record<string, any>;
|
|
25
|
+
/** Bindings set on this model */
|
|
17
26
|
bindings: Record<string, any>;
|
|
27
|
+
/** Any constant attributes */
|
|
28
|
+
constantAttributes: Record<string, TypedArray>;
|
|
29
|
+
/** Index buffer is stored separately */
|
|
30
|
+
_indexBuffer?: WEBGLBuffer;
|
|
31
|
+
/** WebGL varyings */
|
|
32
|
+
varyings: string[] | null;
|
|
33
|
+
/** Stores attribute bindings */
|
|
34
|
+
vertexArrayObject: WEBGLVertexArrayObject;
|
|
18
35
|
_textureUniforms: Record<string, any>;
|
|
19
36
|
_textureIndexCounter: number;
|
|
20
37
|
_uniformCount: number;
|
|
@@ -61,5 +78,11 @@ export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
61
78
|
/** Apply any bindings */
|
|
62
79
|
_applyBindings(): void;
|
|
63
80
|
_applyUniforms(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Constant attributes are only supported in WebGL, not in WebGPU
|
|
83
|
+
* Any attribute that is disabled in the current vertex array object
|
|
84
|
+
* is read from the context's global constant value for that attribute location.
|
|
85
|
+
*/
|
|
86
|
+
_applyConstantAttributes(): void;
|
|
64
87
|
}
|
|
65
88
|
//# sourceMappingURL=webgl-render-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,OAAO,EACP,YAAY,EAIZ,UAAU,
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,OAAO,EACP,YAAY,EAIZ,UAAU,EACV,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAgC,MAAM,cAAc,CAAC;AAS3E,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAK5E,oCAAoC;AACpC,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,yDAAyD;IACzD,MAAM,EAAE,WAAW,CAAC;IACpB,yCAAyC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB;IACpB,EAAE,EAAE,WAAW,CAAC;IAChB,sBAAsB;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,mEAAmE;IACnE,kBAAkB,EAAE,YAAY,CAAC;IACjC,oDAAoD;IACpD,SAAS,EAAE,aAAa,EAAE,CAAC;IAE3B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,8BAA8B;IAC9B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE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A0BzB;;;;OAIG;IACH,sBAAsB;IAkBtB,yBAAyB;IACzB,cAAc;IA6Dd,cAAc;IAUd;;;;OAIG;IACH,wBAAwB,IAAI,IAAI;CAUjC"}
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import { RenderPipeline, cast, log, decodeVertexFormat } from '@luma.gl/api';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
4
|
import { getWebGLDataType } from "../converters/texture-formats.js";
|
|
5
|
-
import { getShaderLayout } from "../helpers/get-shader-layout.js";
|
|
5
|
+
import { getShaderLayout, mergeShaderLayout, mergeBufferMap } from "../helpers/get-shader-layout.js";
|
|
6
6
|
import { withDeviceParameters, withGLParameters } from "../converters/device-parameters.js";
|
|
7
7
|
import { setUniform } from "../helpers/set-uniform.js";
|
|
8
8
|
import { WEBGLBuffer } from "./webgl-buffer.js";
|
|
@@ -17,11 +17,14 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
17
17
|
_defineProperty(this, "vs", void 0);
|
|
18
18
|
_defineProperty(this, "fs", void 0);
|
|
19
19
|
_defineProperty(this, "layout", void 0);
|
|
20
|
-
_defineProperty(this, "
|
|
21
|
-
_defineProperty(this, "
|
|
22
|
-
_defineProperty(this, "_indexBuffer", void 0);
|
|
20
|
+
_defineProperty(this, "introspectedLayout", void 0);
|
|
21
|
+
_defineProperty(this, "bufferMap", void 0);
|
|
23
22
|
_defineProperty(this, "uniforms", {});
|
|
24
23
|
_defineProperty(this, "bindings", {});
|
|
24
|
+
_defineProperty(this, "constantAttributes", {});
|
|
25
|
+
_defineProperty(this, "_indexBuffer", void 0);
|
|
26
|
+
_defineProperty(this, "varyings", null);
|
|
27
|
+
_defineProperty(this, "vertexArrayObject", void 0);
|
|
25
28
|
_defineProperty(this, "_textureUniforms", {});
|
|
26
29
|
_defineProperty(this, "_textureIndexCounter", 0);
|
|
27
30
|
_defineProperty(this, "_uniformCount", 0);
|
|
@@ -44,7 +47,10 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
44
47
|
(_this$device$gl = this.device.gl2) === null || _this$device$gl === void 0 ? void 0 : _this$device$gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
45
48
|
}
|
|
46
49
|
this._compileAndLink();
|
|
47
|
-
this.
|
|
50
|
+
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
51
|
+
this.layout = mergeShaderLayout(this.introspectedLayout, props.layout);
|
|
52
|
+
this.bufferMap = props.bufferMap || [];
|
|
53
|
+
this.layout = mergeBufferMap(this.layout, this.bufferMap);
|
|
48
54
|
this.vertexArrayObject = new WEBGLVertexArrayObject(this.device);
|
|
49
55
|
}
|
|
50
56
|
destroy() {
|
|
@@ -56,7 +62,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
56
62
|
setIndexBuffer(indexBuffer) {
|
|
57
63
|
const webglBuffer = cast(indexBuffer);
|
|
58
64
|
this.vertexArrayObject.setElementBuffer(webglBuffer);
|
|
59
|
-
this._indexBuffer =
|
|
65
|
+
this._indexBuffer = webglBuffer;
|
|
60
66
|
}
|
|
61
67
|
setAttributes(attributes) {
|
|
62
68
|
for (const [name, buffer] of Object.entries(attributes)) {
|
|
@@ -96,6 +102,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
96
102
|
}
|
|
97
103
|
this.vertexArrayObject.setConstant(attribute.location, value);
|
|
98
104
|
}
|
|
105
|
+
Object.assign(this.constantAttributes, attributes);
|
|
99
106
|
}
|
|
100
107
|
setBindings(bindings) {
|
|
101
108
|
for (const [name, value] of Object.entries(bindings)) {
|
|
@@ -140,7 +147,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
140
147
|
} = options;
|
|
141
148
|
const drawMode = getDrawMode(this.props.topology);
|
|
142
149
|
const isIndexed = Boolean(this._indexBuffer);
|
|
143
|
-
const indexType = (
|
|
150
|
+
const indexType = (_this$_indexBuffer = this._indexBuffer) === null || _this$_indexBuffer === void 0 ? void 0 : _this$_indexBuffer.glIndexType;
|
|
144
151
|
const isInstanced = Number(options.instanceCount) > 0;
|
|
145
152
|
if (!this._areTexturesRenderable() || options.vertexCount === 0) {
|
|
146
153
|
return false;
|
|
@@ -154,6 +161,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
154
161
|
}
|
|
155
162
|
this._applyBindings();
|
|
156
163
|
this._applyUniforms();
|
|
164
|
+
this._applyConstantAttributes();
|
|
157
165
|
const webglRenderPass = renderPass;
|
|
158
166
|
withDeviceParameters(this.device, this.props.parameters, () => {
|
|
159
167
|
withGLParameters(this.device, webglRenderPass.glParameters, () => {
|
|
@@ -274,6 +282,16 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
274
282
|
}
|
|
275
283
|
}
|
|
276
284
|
}
|
|
285
|
+
_applyConstantAttributes() {
|
|
286
|
+
for (const [name, value] of Object.entries(this.constantAttributes)) {
|
|
287
|
+
const attribute = getAttributeLayout(this.layout, name);
|
|
288
|
+
if (!attribute) {
|
|
289
|
+
log.warn("Ignoring constant value supplied for unknown attribute \"".concat(name, "\" in pipeline \"").concat(this.id, "\""))();
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
this.vertexArrayObject.setConstant(attribute.location, value);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
277
295
|
}
|
|
278
296
|
function getDrawMode(topology) {
|
|
279
297
|
switch (topology) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","decodeVertexFormat","GL","getWebGLDataType","getShaderLayout","withDeviceParameters","withGLParameters","setUniform","WEBGLBuffer","WEBGLTexture","WEBGLVertexArrayObject","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","_defineProperty","handle","gl","createProgram","setSpectorMetadata","id","vs","fs","varyings","bufferMode","SEPARATE_ATTRIBS","length","_this$device$gl","assertWebGL2","gl2","transformFeedbackVaryings","_compileAndLink","layout","vertexArrayObject","destroy","deleteProgram","destroyed","setIndexBuffer","indexBuffer","webglBuffer","setElementBuffer","_indexBuffer","setAttributes","attributes","name","buffer","Object","entries","attribute","getAttributeLayout","warn","concat","decoded","format","type","typeString","components","size","byteLength","stride","normalized","integer","divisor","stepMode","setBuffer","location","offset","setConstantAttributes","value","setConstant","setBindings","bindings","binding","find","Error","setUniforms","uniforms","assign","draw","options","_this$_indexBuffer","renderPass","vertexCount","instanceCount","firstVertex","drawMode","getDrawMode","topology","isIndexed","Boolean","indexType","UNSIGNED_SHORT","UNSIGNED_INT","isInstanced","Number","_areTexturesRenderable","useProgram","bind","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","webglRenderPass","parameters","glParameters","_this$device$gl2","drawElementsInstanced","drawElements","_this$device$gl3","drawArraysInstanced","drawArrays","end","attachShader","time","linkProgram","timeEnd","debug","level","linked","getProgramParameter","LINK_STATUS","getProgramInfoLog","validateProgram","validated","VALIDATE_STATUS","texturesRenderable","texture","_textureUniforms","update","loaded","undefined","textureUnit","uniformBufferIndex","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","_this$uniforms$name","POINTS","LINES","LINE_STRIP","LINE_LOOP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],"sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"sourcesContent":["import type {\n RenderPipelineProps,\n RenderPass,\n Buffer,\n Binding,\n ShaderLayout,\n PrimitiveTopology,\n // BindingLayout,\n AttributeLayout,\n TypedArray\n} from '@luma.gl/api';\nimport {RenderPipeline, cast, log, decodeVertexFormat} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\n\nimport {getWebGLDataType} from '../converters/texture-formats';\nimport {getShaderLayout} from '../helpers/get-shader-layout';\nimport {withDeviceParameters, withGLParameters} from '../converters/device-parameters';\nimport {setUniform} from '../helpers/set-uniform';\n// import {copyUniform, checkUniformValues} from '../../classes/uniforms';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLShader} from './webgl-shader';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLVertexArrayObject} from '../objects/webgl-vertex-array-object';\nimport {WEBGLRenderPass} from './webgl-render-pass';\n\nconst LOG_PROGRAM_PERF_PRIORITY = 4;\n\n/** Creates a new render pipeline */\nexport class WEBGLRenderPipeline extends RenderPipeline {\n device: WebGLDevice;\n handle: WebGLProgram;\n vs: WEBGLShader;\n fs: WEBGLShader;\n layout: ShaderLayout;\n\n // configuration: ProgramConfiguration;\n // Experimental flag to avoid deleting Program object while it is cached\n varyings: string[] | null = null;\n vertexArrayObject: WEBGLVertexArrayObject;\n _indexBuffer?: Buffer;\n uniforms: Record<string, any> = {};\n bindings: Record<string, any> = {};\n _textureUniforms: Record<string, any> = {};\n _textureIndexCounter: number = 0;\n _uniformCount: number = 0;\n _uniformSetters: Record<string, Function> = {}; // TODO are these used?\n\n constructor(device: WebGLDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.gl.createProgram();\n this.device.setSpectorMetadata(this.handle, {id: this.props.id});\n\n // Create shaders if needed\n this.vs = cast<WEBGLShader>(props.vs);\n this.fs = cast<WEBGLShader>(props.fs);\n // assert(this.vs.stage === 'vertex');\n // assert(this.fs.stage === 'fragment');\n\n // Setup varyings if supplied\n // @ts-expect-error WebGL only\n const {varyings, bufferMode = GL.SEPARATE_ATTRIBS} = props;\n if (varyings && varyings.length > 0) {\n this.device.assertWebGL2();\n this.varyings = varyings;\n this.device.gl2?.transformFeedbackVaryings(this.handle, varyings, bufferMode);\n }\n\n this._compileAndLink();\n\n this.layout = props.layout || getShaderLayout(this.device.gl, this.handle);\n this.vertexArrayObject = new WEBGLVertexArrayObject(this.device);\n }\n\n override destroy(): void {\n if (this.handle) {\n this.device.gl.deleteProgram(this.handle);\n // this.handle = null;\n this.destroyed = true;\n }\n }\n\n setIndexBuffer(indexBuffer: Buffer): void {\n const webglBuffer = cast<WEBGLBuffer>(indexBuffer);\n this.vertexArrayObject.setElementBuffer(webglBuffer);\n this._indexBuffer = indexBuffer;\n }\n\n /** @todo needed for portable model */\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const webglBuffer = cast<WEBGLBuffer>(buffer);\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring buffer supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\" (buffer \"${buffer.id}\")`)();\n continue; // eslint-disable-line no-continue\n }\n const decoded = decodeVertexFormat(attribute.format);\n const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;\n const divisor = attribute.stepMode === 'instance' ? 1 : 0;\n const type = getWebGLDataType(typeString);\n this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {\n size,\n type,\n stride,\n offset: 0,\n normalized,\n integer,\n divisor\n });\n }\n }\n\n /**\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param attributes \n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [name, value] of Object.entries(attributes)) {\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring constant value supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\"`)();\n continue; // eslint-disable-line no-continue\n }\n this.vertexArrayObject.setConstant(attribute.location, value);\n }\n }\n\n /** \n * Bindings include: textures, samplers and uniform buffers\n * @todo needed for portable model \n */\n setBindings(bindings: Record<string, Binding>): void {\n // if (log.priority >= 2) {\n // checkUniformValues(uniforms, this.id, this._uniformSetters);\n // }\n\n for (const [name, value] of Object.entries(bindings)) {\n const binding = this.layout.bindings.find((binding) => binding.name === name);\n if (!binding) {\n log.warn(`Unknown binding ${name} in render pipeline ${this.id}`)();\n continue; // eslint-disable-line no-continue\n }\n if (!value) {\n log.warn(`Unsetting binding ${name} in render pipeline ${this.id}`)();\n }\n switch (binding.type) {\n case 'uniform':\n // @ts-expect-error\n if (!(value instanceof WEBGLBuffer) && !(value.buffer instanceof WEBGLBuffer)) {\n throw new Error('buffer value');\n }\n break;\n case 'texture':\n if (!(value instanceof WEBGLTexture)) {\n throw new Error('texture value');\n }\n break;\n case 'sampler':\n log.warn(`Ignoring sampler ${name}`)();\n break;\n default:\n throw new Error(binding.type);\n }\n\n this.bindings[name] = value;\n }\n }\n\n setUniforms(uniforms: Record<string, any>) {\n // TODO - check against layout\n Object.assign(this.uniforms, uniforms);\n }\n\n /** @todo needed for portable model\n * @note The WebGL API is offers many ways to draw things\n * This function unifies those ways into a single call using common parameters with sane defaults\n */\n draw(options: {\n renderPass: RenderPass;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): boolean {\n const {\n renderPass,\n vertexCount,\n // indexCount,\n instanceCount,\n firstVertex = 0,\n // firstIndex,\n // firstInstance,\n // baseVertex\n } = options;\n\n const drawMode = getDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(this._indexBuffer);\n const indexType = this._indexBuffer?.props.indexType === 'uint16' ? GL.UNSIGNED_SHORT : GL.UNSIGNED_INT;\n const isInstanced: boolean = Number(options.instanceCount) > 0;\n\n // Avoid WebGL draw call when not rendering any data or values are incomplete\n // Note: async textures set as uniforms might still be loading.\n // Now that all uniforms have been updated, check if any texture\n // in the uniforms is not yet initialized, then we don't draw\n if (!this._areTexturesRenderable() || options.vertexCount === 0) {\n // (isInstanced && instanceCount === 0)\n return false;\n }\n\n this.device.gl.useProgram(this.handle);\n\n this.vertexArrayObject.bind(() => {\n const primitiveMode = getGLPrimitive(this.props.topology);\n const transformFeedback: any = null;\n if (transformFeedback) {\n transformFeedback.begin(primitiveMode);\n }\n\n // We have to apply bindings before every draw call since other draw calls will overwrite\n this._applyBindings();\n this._applyUniforms();\n\n const webglRenderPass = renderPass as WEBGLRenderPass;\n\n // TODO - double context push/pop\n withDeviceParameters(this.device, this.props.parameters, () => {\n withGLParameters(this.device, webglRenderPass.glParameters, () => {\n // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension\n if (isIndexed && isInstanced) {\n // ANGLE_instanced_arrays extension\n this.device.gl2?.drawElementsInstanced(\n drawMode,\n vertexCount || 0, // indexCount?\n indexType,\n firstVertex,\n instanceCount || 0\n );\n // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n // this.device.gl2.drawRangeElements(drawMode, start, end, vertexCount, indexType, offset);\n } else if (isIndexed) {\n this.device.gl.drawElements(drawMode, vertexCount || 0, indexType, firstVertex); // indexCount?\n } else if (isInstanced) {\n this.device.gl2?.drawArraysInstanced(drawMode, firstVertex, vertexCount || 0, instanceCount || 0);\n } else {\n this.device.gl.drawArrays(drawMode, firstVertex, vertexCount || 0);\n }\n });\n\n if (transformFeedback) {\n transformFeedback.end();\n }\n });\n });\n\n return true;\n }\n\n // setAttributes(attributes: Record<string, Buffer>): void {}\n // setBindings(bindings: Record<string, Binding>): void {}\n\n protected _compileAndLink() {\n const {gl} = this.device;\n gl.attachShader(this.handle, this.vs.handle);\n gl.attachShader(this.handle, this.fs.handle);\n log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n gl.linkProgram(this.handle);\n log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n\n // Avoid checking program linking error in production\n // @ts-expect-error\n if (gl.debug || log.level > 0) {\n const linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS);\n if (!linked) {\n throw new Error(`Error linking: ${gl.getProgramInfoLog(this.handle)}`);\n }\n\n gl.validateProgram(this.handle);\n const validated = gl.getProgramParameter(this.handle, gl.VALIDATE_STATUS);\n if (!validated) {\n throw new Error(`Error validating: ${gl.getProgramInfoLog(this.handle)}`);\n }\n }\n }\n\n // PRIVATE METHODS\n\n /**\n * Checks if all texture-values uniforms are renderable (i.e. loaded)\n * Update a texture if needed (e.g. from video)\n * Note: This is currently done before every draw call\n */\n _areTexturesRenderable() {\n let texturesRenderable = true;\n\n for (const [, texture] of Object.entries(this._textureUniforms)) {\n texture.update();\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n\n for (const [, texture] of Object.entries(this.bindings)) {\n // texture.update();\n if (texture.loaded !== undefined) {\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n }\n\n return texturesRenderable;\n }\n\n /** Apply any bindings */\n _applyBindings() {\n this.device.gl.useProgram(this.handle);\n\n const {gl2} = this.device;\n if (!gl2) {\n throw new Error('bindings');\n }\n\n let textureUnit = 0;\n let uniformBufferIndex = 0;\n for (const binding of this.layout.bindings) {\n const value = this.bindings[binding.name];\n if (!value) {\n throw new Error(`No value for binding ${binding.name} in ${this.id}`);\n }\n switch (binding.type) {\n case 'uniform':\n // Set buffer\n const {name} = binding;\n const location = gl2.getUniformBlockIndex(this.handle, name);\n if (location === GL.INVALID_INDEX) {\n throw new Error(`Invalid uniform block name ${name}`);\n }\n gl2.uniformBlockBinding(this.handle, uniformBufferIndex, location);\n // console.debug(binding, location);\n if (value instanceof WEBGLBuffer) {\n gl2.bindBufferBase(GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);\n } else {\n gl2.bindBufferRange(\n GL.UNIFORM_BUFFER,\n uniformBufferIndex,\n value.buffer.handle,\n value.offset || 0,\n value.size || value.buffer.byteLength - value.offset\n );\n }\n uniformBufferIndex += 1;\n break;\n\n case 'texture':\n if (!(value instanceof WEBGLTexture)) {\n throw new Error('texture');\n }\n const texture: WEBGLTexture = value;\n gl2.activeTexture(GL.TEXTURE0 + textureUnit);\n gl2.bindTexture(texture.target, texture.handle);\n // gl2.bindSampler(textureUnit, sampler.handle);\n textureUnit += 1;\n break;\n\n case 'sampler':\n // ignore\n break;\n\n case 'storage':\n case 'read-only-storage':\n throw new Error(`binding type '${binding.type}' not supported in WebGL`);\n }\n }\n }\n\n _applyUniforms() {\n for (const uniformLayout of this.layout.uniforms || []) {\n const {name, location, type, textureUnit} = uniformLayout;\n const value = this.uniforms[name] ?? textureUnit;\n if (value !== undefined) {\n setUniform(this.device.gl, location, type, value);\n }\n }\n }\n}\n\n/** Get the primitive type for transform feedback */\nfunction getDrawMode(\n topology: PrimitiveTopology\n): GL.POINTS | GL.LINES | GL.LINE_STRIP | GL.LINE_LOOP | GL.TRIANGLES | GL.TRIANGLE_STRIP | GL.TRIANGLE_FAN {\n // prettier-ignore\n switch (topology) {\n case 'point-list': return GL.POINTS;\n case 'line-list': return GL.LINES;\n case 'line-strip': return GL.LINE_STRIP;\n case 'line-loop': return GL.LINE_LOOP;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLE_STRIP;\n case 'triangle-fan': return GL.TRIANGLE_FAN;\n default: throw new Error(topology);\n }\n}\n\n/** Get the primitive type for transform feedback */\nfunction getGLPrimitive(topology: PrimitiveTopology): GL.POINTS | GL.LINES | GL.TRIANGLES {\n // prettier-ignore\n switch (topology) {\n case 'point-list': return GL.POINTS;\n case 'line-list': return GL.LINES;\n case 'line-strip': return GL.LINES;\n case 'line-loop': return GL.LINES;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLES;\n case 'triangle-fan': return GL.TRIANGLES;\n default: throw new Error(topology);\n }\n}\n\n// function getAttributesByLocation(\n// attributes: Record<string, Buffer>,\n// layout: ShaderLayout\n// ): Record<number, Buffer> {\n// const byLocation: Record<number, Buffer> = {};\n// for (const [name, buffer] of Object.entries(attributes)) {\n// const attribute = getAttributeLayout(layout, name);\n// if (attribute) {\n// byLocation[attribute.location] = buffer;\n// }\n// }\n// return byLocation;\n// }\n\nfunction getAttributeLayout(layout: ShaderLayout, name: string): AttributeLayout | null {\n return layout.attributes.find((binding) => binding.name === name) || null;\n}\n\n/* TODO\nfunction getBindingLayout(layout: ShaderLayout, name: string): BindingLayout {\n const binding = layout.bindings.find((binding) => binding.name === name);\n if (!binding) {\n throw new Error(`Unknown binding ${name}`);\n }\n return binding;\n}\n*/\n"],"mappings":";AAWA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,GAAG,EAAEC,kBAAkB,QAAO,cAAc;AAC1E,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,gBAAgB;AAAA,SAChBC,eAAe;AAAA,SACfC,oBAAoB,EAAEC,gBAAgB;AAAA,SACtCC,UAAU;AAAA,SAIVC,WAAW;AAAA,SAEXC,YAAY;AAAA,SACZC,sBAAsB;AAG9B,MAAMC,yBAAyB,GAAG,CAAC;AAGnC,OAAO,MAAMC,mBAAmB,SAASd,cAAc,CAAC;EAmBtDe,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAXK,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAGA,CAAC,CAAC;IAAAA,eAAA,mBACF,CAAC,CAAC;IAAAA,eAAA,2BACM,CAAC,CAAC;IAAAA,eAAA,+BACX,CAAC;IAAAA,eAAA,wBACR,CAAC;IAAAA,eAAA,0BACmB,CAAC,CAAC;IAI5C,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACI,EAAE,CAACC,aAAa,CAAC,CAAC;IACjE,IAAI,CAACL,MAAM,CAACM,kBAAkB,CAAC,IAAI,CAACH,MAAM,EAAE;MAACI,EAAE,EAAE,IAAI,CAACN,KAAK,CAACM;IAAE,CAAC,CAAC;IAGhE,IAAI,CAACC,EAAE,GAAGvB,IAAI,CAAcgB,KAAK,CAACO,EAAE,CAAC;IACrC,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lJ,EAAE,CAACmJ,KAAK;IACjC,KAAK,YAAY;MAAE,OAAOnJ,EAAE,CAACmJ,KAAK;IAClC,KAAK,WAAW;MAAE,OAAOnJ,EAAE,CAACmJ,KAAK;IACjC,KAAK,eAAe;MAAE,OAAOnJ,EAAE,CAACsJ,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOtJ,EAAE,CAACsJ,SAAS;IAC1C,KAAK,cAAc;MAAE,OAAOtJ,EAAE,CAACsJ,SAAS;IACxC;MAAS,MAAM,IAAI7E,KAAK,CAACa,QAAQ,CAAC;EACpC;AACF;AAgBA,SAAStC,kBAAkBA,CAACjB,MAAoB,EAAEY,IAAY,EAA0B;EACtF,OAAOZ,MAAM,CAACW,UAAU,CAAC8B,IAAI,CAAED,OAAO,IAAKA,OAAO,CAAC5B,IAAI,KAAKA,IAAI,CAAC,IAAI,IAAI;AAC3E"}
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","decodeVertexFormat","GL","getWebGLDataType","getShaderLayout","mergeShaderLayout","mergeBufferMap","withDeviceParameters","withGLParameters","setUniform","WEBGLBuffer","WEBGLTexture","WEBGLVertexArrayObject","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","_defineProperty","handle","gl","createProgram","setSpectorMetadata","id","vs","fs","varyings","bufferMode","SEPARATE_ATTRIBS","length","_this$device$gl","assertWebGL2","gl2","transformFeedbackVaryings","_compileAndLink","introspectedLayout","layout","bufferMap","vertexArrayObject","destroy","deleteProgram","destroyed","setIndexBuffer","indexBuffer","webglBuffer","setElementBuffer","_indexBuffer","setAttributes","attributes","name","buffer","Object","entries","attribute","getAttributeLayout","warn","concat","decoded","format","type","typeString","components","size","byteLength","stride","normalized","integer","divisor","stepMode","setBuffer","location","offset","setConstantAttributes","value","setConstant","assign","constantAttributes","setBindings","bindings","binding","find","Error","setUniforms","uniforms","draw","options","_this$_indexBuffer","renderPass","vertexCount","instanceCount","firstVertex","drawMode","getDrawMode","topology","isIndexed","Boolean","indexType","glIndexType","isInstanced","Number","_areTexturesRenderable","useProgram","bind","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","_applyConstantAttributes","webglRenderPass","parameters","glParameters","_this$device$gl2","drawElementsInstanced","drawElements","_this$device$gl3","drawArraysInstanced","drawArrays","end","attachShader","time","linkProgram","timeEnd","debug","level","linked","getProgramParameter","LINK_STATUS","getProgramInfoLog","validateProgram","validated","VALIDATE_STATUS","texturesRenderable","texture","_textureUniforms","update","loaded","undefined","textureUnit","uniformBufferIndex","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","_this$uniforms$name","POINTS","LINES","LINE_STRIP","LINE_LOOP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],"sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"sourcesContent":["import type {\n RenderPipelineProps,\n RenderPass,\n Buffer,\n Binding,\n ShaderLayout,\n PrimitiveTopology,\n // BindingLayout,\n AttributeLayout,\n TypedArray,\n BufferMapping\n} from '@luma.gl/api';\nimport {RenderPipeline, cast, log, decodeVertexFormat} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\n\nimport {getWebGLDataType} from '../converters/texture-formats';\nimport {getShaderLayout, mergeShaderLayout, mergeBufferMap} from '../helpers/get-shader-layout';\nimport {withDeviceParameters, withGLParameters} from '../converters/device-parameters';\nimport {setUniform} from '../helpers/set-uniform';\n// import {copyUniform, checkUniformValues} from '../../classes/uniforms';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLShader} from './webgl-shader';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLVertexArrayObject} from '../objects/webgl-vertex-array-object';\nimport {WEBGLRenderPass} from './webgl-render-pass';\n\nconst LOG_PROGRAM_PERF_PRIORITY = 4;\n\n/** Creates a new render pipeline */\nexport class WEBGLRenderPipeline extends RenderPipeline {\n /** The WebGL device that created this render pipeline */\n device: WebGLDevice;\n /** Handle to underlying WebGL program */\n handle: WebGLProgram;\n /** vertex shader */\n vs: WEBGLShader;\n /** fragment shader */\n fs: WEBGLShader;\n /** The merged layout */\n layout: ShaderLayout;\n /** The layout extracted from shader by WebGL introspection APIs */\n introspectedLayout: ShaderLayout;\n /** Buffer map describing buffer interleaving etc */\n bufferMap: BufferMapping[];\n\n /** Uniforms set on this model */\n uniforms: Record<string, any> = {};\n /** Bindings set on this model */\n bindings: Record<string, any> = {};\n /** Any constant attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Index buffer is stored separately */\n _indexBuffer?: WEBGLBuffer;\n /** WebGL varyings */\n varyings: string[] | null = null;\n\n /** Stores attribute bindings */\n vertexArrayObject: WEBGLVertexArrayObject;\n\n _textureUniforms: Record<string, any> = {};\n _textureIndexCounter: number = 0;\n _uniformCount: number = 0;\n _uniformSetters: Record<string, Function> = {}; // TODO are these used?\n\n constructor(device: WebGLDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.gl.createProgram();\n this.device.setSpectorMetadata(this.handle, {id: this.props.id});\n\n // Create shaders if needed\n this.vs = cast<WEBGLShader>(props.vs);\n this.fs = cast<WEBGLShader>(props.fs);\n // assert(this.vs.stage === 'vertex');\n // assert(this.fs.stage === 'fragment');\n\n // Setup varyings if supplied\n // @ts-expect-error WebGL only\n const {varyings, bufferMode = GL.SEPARATE_ATTRIBS} = props;\n if (varyings && varyings.length > 0) {\n this.device.assertWebGL2();\n this.varyings = varyings;\n this.device.gl2?.transformFeedbackVaryings(this.handle, varyings, bufferMode);\n }\n\n this._compileAndLink();\n\n this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);\n // Merge provided layout with introspected layout\n this.layout = mergeShaderLayout(this.introspectedLayout, props.layout); \n // Merge layout with any buffer map overrides\n this.bufferMap = props.bufferMap || [];\n this.layout = mergeBufferMap(this.layout, this.bufferMap); \n this.vertexArrayObject = new WEBGLVertexArrayObject(this.device);\n }\n\n override destroy(): void {\n if (this.handle) {\n this.device.gl.deleteProgram(this.handle);\n // this.handle = null;\n this.destroyed = true;\n }\n }\n\n setIndexBuffer(indexBuffer: Buffer): void {\n const webglBuffer = cast<WEBGLBuffer>(indexBuffer);\n this.vertexArrayObject.setElementBuffer(webglBuffer);\n this._indexBuffer = webglBuffer;\n }\n\n /** @todo needed for portable model */\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const webglBuffer = cast<WEBGLBuffer>(buffer);\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring buffer supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\" (buffer \"${buffer.id}\")`)();\n continue; // eslint-disable-line no-continue\n }\n const decoded = decodeVertexFormat(attribute.format);\n const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;\n const divisor = attribute.stepMode === 'instance' ? 1 : 0;\n const type = getWebGLDataType(typeString);\n this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {\n size,\n type,\n stride,\n offset: 0,\n normalized,\n integer,\n divisor\n });\n }\n }\n\n /**\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param attributes \n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [name, value] of Object.entries(attributes)) {\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring constant value supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\"`)();\n continue; // eslint-disable-line no-continue\n }\n this.vertexArrayObject.setConstant(attribute.location, value);\n }\n Object.assign(this.constantAttributes, attributes);\n }\n\n /** \n * Bindings include: textures, samplers and uniform buffers\n * @todo needed for portable model \n */\n setBindings(bindings: Record<string, Binding>): void {\n // if (log.priority >= 2) {\n // checkUniformValues(uniforms, this.id, this._uniformSetters);\n // }\n\n for (const [name, value] of Object.entries(bindings)) {\n const binding = this.layout.bindings.find((binding) => binding.name === name);\n if (!binding) {\n log.warn(`Unknown binding ${name} in render pipeline ${this.id}`)();\n continue; // eslint-disable-line no-continue\n }\n if (!value) {\n log.warn(`Unsetting binding ${name} in render pipeline ${this.id}`)();\n }\n switch (binding.type) {\n case 'uniform':\n // @ts-expect-error\n if (!(value instanceof WEBGLBuffer) && !(value.buffer instanceof WEBGLBuffer)) {\n throw new Error('buffer value');\n }\n break;\n case 'texture':\n if (!(value instanceof WEBGLTexture)) {\n throw new Error('texture value');\n }\n break;\n case 'sampler':\n log.warn(`Ignoring sampler ${name}`)();\n break;\n default:\n throw new Error(binding.type);\n }\n\n this.bindings[name] = value;\n }\n }\n\n setUniforms(uniforms: Record<string, any>) {\n // TODO - check against layout\n Object.assign(this.uniforms, uniforms);\n }\n\n /** @todo needed for portable model\n * @note The WebGL API is offers many ways to draw things\n * This function unifies those ways into a single call using common parameters with sane defaults\n */\n draw(options: {\n renderPass: RenderPass;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): boolean {\n const {\n renderPass,\n vertexCount,\n // indexCount,\n instanceCount,\n firstVertex = 0,\n // firstIndex,\n // firstInstance,\n // baseVertex\n } = options;\n\n const drawMode = getDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(this._indexBuffer);\n const indexType = this._indexBuffer?.glIndexType;\n const isInstanced: boolean = Number(options.instanceCount) > 0;\n\n // Avoid WebGL draw call when not rendering any data or values are incomplete\n // Note: async textures set as uniforms might still be loading.\n // Now that all uniforms have been updated, check if any texture\n // in the uniforms is not yet initialized, then we don't draw\n if (!this._areTexturesRenderable() || options.vertexCount === 0) {\n // (isInstanced && instanceCount === 0)\n return false;\n }\n\n this.device.gl.useProgram(this.handle);\n\n this.vertexArrayObject.bind(() => {\n const primitiveMode = getGLPrimitive(this.props.topology);\n const transformFeedback: any = null;\n if (transformFeedback) {\n transformFeedback.begin(primitiveMode);\n }\n\n // We have to apply bindings before every draw call since other draw calls will overwrite\n this._applyBindings();\n this._applyUniforms();\n this._applyConstantAttributes();\n\n const webglRenderPass = renderPass as WEBGLRenderPass;\n\n // TODO - double context push/pop\n withDeviceParameters(this.device, this.props.parameters, () => {\n withGLParameters(this.device, webglRenderPass.glParameters, () => {\n // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension\n if (isIndexed && isInstanced) {\n // ANGLE_instanced_arrays extension\n this.device.gl2?.drawElementsInstanced(\n drawMode,\n vertexCount || 0, // indexCount?\n indexType,\n firstVertex,\n instanceCount || 0\n );\n // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n // this.device.gl2.drawRangeElements(drawMode, start, end, vertexCount, indexType, offset);\n } else if (isIndexed) {\n this.device.gl.drawElements(drawMode, vertexCount || 0, indexType, firstVertex); // indexCount?\n } else if (isInstanced) {\n this.device.gl2?.drawArraysInstanced(drawMode, firstVertex, vertexCount || 0, instanceCount || 0);\n } else {\n this.device.gl.drawArrays(drawMode, firstVertex, vertexCount || 0);\n }\n });\n\n if (transformFeedback) {\n transformFeedback.end();\n }\n });\n });\n\n return true;\n }\n\n // setAttributes(attributes: Record<string, Buffer>): void {}\n // setBindings(bindings: Record<string, Binding>): void {}\n\n protected _compileAndLink() {\n const {gl} = this.device;\n gl.attachShader(this.handle, this.vs.handle);\n gl.attachShader(this.handle, this.fs.handle);\n log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n gl.linkProgram(this.handle);\n log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n\n // Avoid checking program linking error in production\n // @ts-expect-error\n if (gl.debug || log.level > 0) {\n const linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS);\n if (!linked) {\n throw new Error(`Error linking: ${gl.getProgramInfoLog(this.handle)}`);\n }\n\n gl.validateProgram(this.handle);\n const validated = gl.getProgramParameter(this.handle, gl.VALIDATE_STATUS);\n if (!validated) {\n throw new Error(`Error validating: ${gl.getProgramInfoLog(this.handle)}`);\n }\n }\n }\n\n // PRIVATE METHODS\n\n /**\n * Checks if all texture-values uniforms are renderable (i.e. loaded)\n * Update a texture if needed (e.g. from video)\n * Note: This is currently done before every draw call\n */\n _areTexturesRenderable() {\n let texturesRenderable = true;\n\n for (const [, texture] of Object.entries(this._textureUniforms)) {\n texture.update();\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n\n for (const [, texture] of Object.entries(this.bindings)) {\n // texture.update();\n if (texture.loaded !== undefined) {\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n }\n\n return texturesRenderable;\n }\n\n /** Apply any bindings */\n _applyBindings() {\n this.device.gl.useProgram(this.handle);\n\n const {gl2} = this.device;\n if (!gl2) {\n throw new Error('bindings');\n }\n\n let textureUnit = 0;\n let uniformBufferIndex = 0;\n for (const binding of this.layout.bindings) {\n const value = this.bindings[binding.name];\n if (!value) {\n throw new Error(`No value for binding ${binding.name} in ${this.id}`);\n }\n switch (binding.type) {\n case 'uniform':\n // Set buffer\n const {name} = binding;\n const location = gl2.getUniformBlockIndex(this.handle, name);\n if (location === GL.INVALID_INDEX) {\n throw new Error(`Invalid uniform block name ${name}`);\n }\n gl2.uniformBlockBinding(this.handle, uniformBufferIndex, location);\n // console.debug(binding, location);\n if (value instanceof WEBGLBuffer) {\n gl2.bindBufferBase(GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);\n } else {\n gl2.bindBufferRange(\n GL.UNIFORM_BUFFER,\n uniformBufferIndex,\n value.buffer.handle,\n value.offset || 0,\n value.size || value.buffer.byteLength - value.offset\n );\n }\n uniformBufferIndex += 1;\n break;\n\n case 'texture':\n if (!(value instanceof WEBGLTexture)) {\n throw new Error('texture');\n }\n const texture: WEBGLTexture = value;\n gl2.activeTexture(GL.TEXTURE0 + textureUnit);\n gl2.bindTexture(texture.target, texture.handle);\n // gl2.bindSampler(textureUnit, sampler.handle);\n textureUnit += 1;\n break;\n\n case 'sampler':\n // ignore\n break;\n\n case 'storage':\n case 'read-only-storage':\n throw new Error(`binding type '${binding.type}' not supported in WebGL`);\n }\n }\n }\n\n _applyUniforms() {\n for (const uniformLayout of this.layout.uniforms || []) {\n const {name, location, type, textureUnit} = uniformLayout;\n const value = this.uniforms[name] ?? textureUnit;\n if (value !== undefined) {\n setUniform(this.device.gl, location, type, value);\n }\n }\n }\n\n /**\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n */\n _applyConstantAttributes(): void {\n for (const [name, value] of Object.entries(this.constantAttributes)) {\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring constant value supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\"`)();\n continue; // eslint-disable-line no-continue\n }\n this.vertexArrayObject.setConstant(attribute.location, value);\n }\n } \n}\n\n/** Get the primitive type for draw */\nfunction getDrawMode(\n topology: PrimitiveTopology\n): GL.POINTS | GL.LINES | GL.LINE_STRIP | GL.LINE_LOOP | GL.TRIANGLES | GL.TRIANGLE_STRIP | GL.TRIANGLE_FAN {\n // prettier-ignore\n switch (topology) {\n case 'point-list': return GL.POINTS;\n case 'line-list': return GL.LINES;\n case 'line-strip': return GL.LINE_STRIP;\n case 'line-loop': return GL.LINE_LOOP;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLE_STRIP;\n case 'triangle-fan': return GL.TRIANGLE_FAN;\n default: throw new Error(topology);\n }\n}\n\n/** Get the primitive type for transform feedback */\nfunction getGLPrimitive(topology: PrimitiveTopology): GL.POINTS | GL.LINES | GL.TRIANGLES {\n // prettier-ignore\n switch (topology) {\n case 'point-list': return GL.POINTS;\n case 'line-list': return GL.LINES;\n case 'line-strip': return GL.LINES;\n case 'line-loop': return GL.LINES;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLES;\n case 'triangle-fan': return GL.TRIANGLES;\n default: throw new Error(topology);\n }\n}\n\nfunction getAttributeLayout(layout: ShaderLayout, name: string): AttributeLayout | null {\n return layout.attributes.find((binding) => binding.name === name) || null;\n}\n"],"mappings":";AAYA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,GAAG,EAAEC,kBAAkB,QAAO,cAAc;AAC1E,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,gBAAgB;AAAA,SAChBC,eAAe,EAAEC,iBAAiB,EAAEC,cAAc;AAAA,SAClDC,oBAAoB,EAAEC,gBAAgB;AAAA,SACtCC,UAAU;AAAA,SAIVC,WAAW;AAAA,SAEXC,YAAY;AAAA,SACZC,sBAAsB;AAG9B,MAAMC,yBAAyB,GAAG,CAAC;AAGnC,OAAO,MAAMC,mBAAmB,SAAShB,cAAc,CAAC;EAmCtDiB,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAnBS,CAAC,CAAC;IAAAA,eAAA,mBAEF,CAAC,CAAC;IAAAA,eAAA,6BAEe,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,mBAIvB,IAAI;IAAAA,eAAA;IAAAA,eAAA,2BAKQ,CAAC,CAAC;IAAAA,eAAA,+BACX,CAAC;IAAAA,eAAA,wBACR,CAAC;IAAAA,eAAA,0BACmB,CAAC,CAAC;IAI5C,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACI,EAAE,CAACC,aAAa,CAAC,CAAC;IACjE,IAAI,CAACL,MAAM,CAACM,kBAAkB,CAAC,IAAI,CAACH,MAAM,EAAE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E,EAAE,qBAAqB,CAAC;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IACnD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAS;IAEhC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,iEAAiE;IACjE,QAAQ,CAAC,eAAe;;;;MAA0D;IAElF,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC/C,WAAW,EAAE,OAAO,CAAS;IAE7B,8CAA8C;IAC9C,OAAO,MAAC;IAER,OAAO,CAAC,YAAY,CAAC,CAAc;IAEnC,mCAAmC;IACnC,IAAI,WAAW,IAAK,WAAW,CAG9B;IAED;;;OAGG;IACM,UAAU,IAAI,OAAO;IAe9B,8DAA8D;IAC9D,SAAS,IAAI,IAAI;IAIjB,8CAA8C;IAC9C,QAAQ,IAAI,IAAI;IAIhB;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMlE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,qBAAqB,GAAG,MAAM;CAa7D"}
|
|
@@ -53,10 +53,13 @@ export class WebGLDevice extends Device {
|
|
|
53
53
|
if (typeof props.canvas === 'string') {
|
|
54
54
|
await CanvasContext.pageLoaded;
|
|
55
55
|
}
|
|
56
|
-
if (props.debug) {
|
|
56
|
+
if (log.get('debug') || props.debug) {
|
|
57
57
|
await loadWebGLDeveloperTools();
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
const {
|
|
60
|
+
spector
|
|
61
|
+
} = props;
|
|
62
|
+
if (log.get('spector') || spector) {
|
|
60
63
|
await loadSpectorJS();
|
|
61
64
|
}
|
|
62
65
|
log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
|