@luma.gl/webgl 9.3.0-alpha.4 → 9.3.0-alpha.8
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 +1 -1
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +4 -1
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +1 -1
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/shader-formats.d.ts +1 -64
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
- package/dist/adapter/converters/shader-formats.js +1 -64
- package/dist/adapter/converters/shader-formats.js.map +1 -1
- package/dist/adapter/converters/webgl-shadertypes.d.ts +1 -3
- package/dist/adapter/converters/webgl-shadertypes.d.ts.map +1 -1
- package/dist/adapter/converters/webgl-shadertypes.js +1 -6
- package/dist/adapter/converters/webgl-shadertypes.js.map +1 -1
- package/dist/adapter/converters/webgl-texture-table.d.ts +8 -4
- package/dist/adapter/converters/webgl-texture-table.d.ts.map +1 -1
- package/dist/adapter/converters/webgl-texture-table.js +122 -58
- package/dist/adapter/converters/webgl-texture-table.js.map +1 -1
- package/dist/adapter/converters/webgl-vertex-formats.d.ts +1 -1
- package/dist/adapter/converters/webgl-vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/webgl-vertex-formats.js +1 -1
- package/dist/adapter/converters/webgl-vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +1 -2
- package/dist/adapter/device-helpers/webgl-device-features.js.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.js +6 -1
- package/dist/adapter/device-helpers/webgl-device-info.js.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.js +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.js.map +1 -1
- package/dist/adapter/helpers/format-utils.d.ts +1 -1
- package/dist/adapter/helpers/format-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/format-utils.js +1 -1
- package/dist/adapter/helpers/format-utils.js.map +1 -1
- package/dist/adapter/helpers/get-shader-layout-from-glsl.js +30 -19
- package/dist/adapter/helpers/get-shader-layout-from-glsl.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +1 -1
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/webgl-texture-utils.d.ts +1 -1
- package/dist/adapter/helpers/webgl-texture-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-texture-utils.js +4 -4
- package/dist/adapter/helpers/webgl-texture-utils.js.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.d.ts +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -1
- 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 +20 -5
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +3 -3
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +22 -36
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +6 -5
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +23 -8
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +3 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +10 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-query-set.d.ts +37 -31
- package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-query-set.js +247 -96
- package/dist/adapter/resources/webgl-query-set.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +25 -11
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +17 -21
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +69 -167
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- 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 +1 -1
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +15 -8
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-shared-render-pipeline.d.ts +24 -0
- package/dist/adapter/resources/webgl-shared-render-pipeline.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-shared-render-pipeline.js +155 -0
- package/dist/adapter/resources/webgl-shared-render-pipeline.js.map +1 -0
- package/dist/adapter/resources/webgl-texture.d.ts +27 -6
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +199 -101
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.d.ts +2 -2
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +6 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +36 -4
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/adapter/webgl-presentation-context.d.ts +21 -0
- package/dist/adapter/webgl-presentation-context.d.ts.map +1 -0
- package/dist/adapter/webgl-presentation-context.js +64 -0
- package/dist/adapter/webgl-presentation-context.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/webgl-constants.d.ts +822 -0
- package/dist/constants/webgl-constants.d.ts.map +1 -0
- package/dist/constants/webgl-constants.js +928 -0
- package/dist/constants/webgl-constants.js.map +1 -0
- package/dist/constants/webgl-types.d.ts +480 -0
- package/dist/constants/webgl-types.d.ts.map +1 -0
- package/dist/constants/webgl-types.js +6 -0
- package/dist/constants/webgl-types.js.map +1 -0
- package/dist/context/debug/webgl-developer-tools.js +1 -1
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/helpers/webgl-context-data.d.ts +1 -1
- package/dist/context/helpers/webgl-context-data.d.ts.map +1 -1
- package/dist/context/helpers/webgl-extensions.d.ts +1 -1
- package/dist/context/helpers/webgl-extensions.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/context/polyfills/polyfill-webgl1-extensions.js +1 -1
- package/dist/context/polyfills/polyfill-webgl1-extensions.js.map +1 -1
- package/dist/dist.dev.js +1473 -824
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +3 -5491
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/webgl-constants.d.ts +2 -0
- package/dist/webgl-constants.d.ts.map +1 -0
- package/dist/webgl-constants.js +5 -0
- package/dist/webgl-constants.js.map +1 -0
- package/dist/webgl-types.d.ts +2 -0
- package/dist/webgl-types.d.ts.map +1 -0
- package/dist/{types.js → webgl-types.js} +1 -1
- package/dist/webgl-types.js.map +1 -0
- package/package.json +18 -4
- package/src/adapter/converters/device-parameters.ts +6 -2
- package/src/adapter/converters/sampler-parameters.ts +1 -1
- package/src/adapter/converters/shader-formats.ts +1 -66
- package/src/adapter/converters/webgl-shadertypes.ts +1 -9
- package/src/adapter/converters/webgl-texture-table.ts +160 -68
- package/src/adapter/converters/webgl-vertex-formats.ts +1 -1
- package/src/adapter/device-helpers/webgl-device-features.ts +2 -3
- package/src/adapter/device-helpers/webgl-device-info.ts +7 -1
- package/src/adapter/device-helpers/webgl-device-limits.ts +1 -1
- package/src/adapter/helpers/format-utils.ts +1 -1
- package/src/adapter/helpers/get-shader-layout-from-glsl.ts +38 -20
- package/src/adapter/helpers/set-uniform.ts +1 -1
- package/src/adapter/helpers/webgl-texture-utils.ts +4 -4
- package/src/adapter/helpers/webgl-topology-utils.ts +1 -1
- package/src/adapter/resources/webgl-buffer.ts +17 -5
- package/src/adapter/resources/webgl-command-buffer.ts +28 -28
- package/src/adapter/resources/webgl-command-encoder.ts +28 -11
- package/src/adapter/resources/webgl-framebuffer.ts +12 -1
- package/src/adapter/resources/webgl-query-set.ts +295 -101
- package/src/adapter/resources/webgl-render-pass.ts +26 -13
- package/src/adapter/resources/webgl-render-pipeline.ts +101 -196
- package/src/adapter/resources/webgl-sampler.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +15 -8
- package/src/adapter/resources/webgl-shared-render-pipeline.ts +211 -0
- package/src/adapter/resources/webgl-texture.ts +324 -122
- package/src/adapter/resources/webgl-transform-feedback.ts +1 -1
- package/src/adapter/resources/webgl-vertex-array.ts +1 -1
- package/src/adapter/webgl-device.ts +50 -6
- package/src/adapter/webgl-presentation-context.ts +93 -0
- package/src/constants/index.d.ts.map +1 -0
- package/src/constants/index.js.map +1 -0
- package/src/constants/index.ts +31 -0
- package/src/constants/webgl-constants.d.ts.map +1 -0
- package/src/constants/webgl-constants.js.map +1 -0
- package/src/constants/webgl-constants.ts +1051 -0
- package/src/constants/webgl-types.d.ts.map +1 -0
- package/src/constants/webgl-types.js.map +1 -0
- package/src/constants/webgl-types.ts +813 -0
- package/src/context/debug/webgl-developer-tools.ts +1 -1
- package/src/context/helpers/webgl-context-data.ts +1 -1
- package/src/context/helpers/webgl-extensions.ts +1 -1
- package/src/context/parameters/unified-parameter-api.ts +1 -1
- package/src/context/parameters/webgl-parameter-tables.ts +1 -1
- package/src/context/polyfills/polyfill-webgl1-extensions.ts +1 -1
- package/src/index.ts +26 -0
- package/src/webgl-constants.d.ts.map +1 -0
- package/src/webgl-constants.js.map +1 -0
- package/src/webgl-constants.ts +5 -0
- package/src/webgl-types.d.ts.map +1 -0
- package/src/webgl-types.js.map +1 -0
- package/src/webgl-types.ts +29 -0
- package/dist/types.d.ts +0 -11
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type { WebGLDeviceLimits } from "./adapter/device-helpers/webgl-device-limits.js";
|
|
2
|
+
export { GL } from "./constants/webgl-constants.js";
|
|
3
|
+
export type { GLTextureTarget, GLTextureCubeMapTarget, GLTexelDataFormat, GLPrimitiveTopology, GLPrimitive, GLDataType, GLPixelType, GLUniformType, GLSamplerType, GLFunction, GLBlendEquation, GLBlendFunction, GLStencilOp, GLSamplerParameters, GLValueParameters, GLPackParameters, GLUnpackParameters, GLFunctionParameters, GLParameters, GLLimits, GLExtensions, GLPolygonMode, GLProvokingVertex } from "./constants/webgl-types.js";
|
|
2
4
|
export { webgl2Adapter } from "./adapter/webgl-adapter.js";
|
|
3
5
|
export type { WebGLAdapter } from "./adapter/webgl-adapter.js";
|
|
4
6
|
export { WebGLDevice } from "./adapter/webgl-device.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EAAC,iBAAiB,EAAC,wDAAqD;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EAAC,iBAAiB,EAAC,wDAAqD;AACpF,OAAO,EAAC,EAAE,EAAC,uCAAoC;AAC/C,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,iBAAiB,EAClB,mCAAgC;AAGjC,OAAO,EAAC,aAAa,EAAC,mCAAgC;AACtD,YAAY,EAAC,YAAY,EAAC,mCAAgC;AAG1D,OAAO,EAAC,WAAW,EAAC,kCAA+B;AACnD,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAGlE,OAAO,EAAC,WAAW,EAAC,4CAAyC;AAC7D,OAAO,EAAC,YAAY,EAAC,6CAA0C;AAE/D,OAAO,EAAC,WAAW,EAAC,4CAAyC;AAC7D,OAAO,EAAC,YAAY,EAAC,6CAA0C;AAC/D,OAAO,EAAC,gBAAgB,EAAC,iDAA8C;AACvE,OAAO,EAAC,UAAU,EAAC,2CAAwC;AAE3D,OAAO,EAAC,mBAAmB,EAAC,qDAAkD;AAE9E,OAAO,EAAC,mBAAmB,EAAC,qDAAkD;AAC9E,OAAO,EAAC,eAAe,EAAC,iDAA8C;AAEtE,OAAO,EAAC,gBAAgB,EAAC,kDAA+C;AAGxE,OAAO,EAAC,sBAAsB,EAAC,wDAAqD;AAIpF,OAAO,EAAC,mBAAmB,EAAE,oBAAoB,EAAC,kDAA+C;AAGjG,OAAO,EAAC,uBAAuB,EAAC,yDAAsD;AACtF,OAAO,EAAC,iBAAiB,EAAC,uDAAoD;AAG9E,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,sDAAmD;AAEpD,OAAO,EAAC,gBAAgB,EAAC,mDAAgD"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAUpC,OAAO,EAAC,EAAE,EAAC,uCAAoC;AA2B/C,wBAAwB;AACxB,OAAO,EAAC,aAAa,EAAC,mCAAgC;AAGtD,uBAAuB;AACvB,OAAO,EAAC,WAAW,EAAC,kCAA+B;AACnD,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAElE,yBAAyB;AACzB,OAAO,EAAC,WAAW,EAAC,4CAAyC;AAC7D,OAAO,EAAC,YAAY,EAAC,6CAA0C;AAC/D,mFAAmF;AACnF,OAAO,EAAC,WAAW,EAAC,4CAAyC;AAC7D,OAAO,EAAC,YAAY,EAAC,6CAA0C;AAC/D,OAAO,EAAC,gBAAgB,EAAC,iDAA8C;AACvE,OAAO,EAAC,UAAU,EAAC,2CAAwC;AAE3D,OAAO,EAAC,mBAAmB,EAAC,qDAAkD;AAC9E,mFAAmF;AACnF,OAAO,EAAC,mBAAmB,EAAC,qDAAkD;AAC9E,OAAO,EAAC,eAAe,EAAC,iDAA8C;AACtE,2EAA2E;AAC3E,OAAO,EAAC,gBAAgB,EAAC,kDAA+C;AAExE,wBAAwB;AACxB,OAAO,EAAC,sBAAsB,EAAC,wDAAqD;AAEpF,wBAAwB;AAExB,OAAO,EAAC,mBAAmB,EAAE,oBAAoB,EAAC,kDAA+C;AAEjG,yBAAyB;AACzB,OAAO,EAAC,uBAAuB,EAAC,yDAAsD;AACtF,OAAO,EAAC,iBAAiB,EAAC,uDAAoD;AAE9E,0BAA0B;AAC1B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,sDAAmD;AAEpD,OAAO,EAAC,gBAAgB,EAAC,mDAAgD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-constants.d.ts","sourceRoot":"","sources":["../src/webgl-constants.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,EAAE,EAAC,uCAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-constants.js","sourceRoot":"","sources":["../src/webgl-constants.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,EAAE,EAAC,uCAAoC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { GLTextureTarget, GLTextureCubeMapTarget, GLTexelDataFormat, GLPrimitiveTopology, GLPrimitive, GLDataType, GLPixelType, GLUniformType, GLSamplerType, GLFunction, GLBlendEquation, GLBlendFunction, GLStencilOp, GLSamplerParameters, GLValueParameters, GLPackParameters, GLUnpackParameters, GLFunctionParameters, GLParameters, GLLimits, GLExtensions, GLPolygonMode, GLProvokingVertex } from "./constants/webgl-types.js";
|
|
2
|
+
//# sourceMappingURL=webgl-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-types.d.ts","sourceRoot":"","sources":["../src/webgl-types.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,iBAAiB,EAClB,mCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-types.js","sourceRoot":"","sources":["../src/webgl-types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgl",
|
|
3
|
-
"version": "9.3.0-alpha.
|
|
3
|
+
"version": "9.3.0-alpha.8",
|
|
4
4
|
"description": "WebGL2 adapter for the luma.gl core API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"import": "./dist/index.js",
|
|
27
27
|
"require": "./dist/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./constants": {
|
|
30
|
+
"types": "./dist/constants/index.d.ts",
|
|
31
|
+
"import": "./dist/constants/index.js",
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./webgl-constants": {
|
|
35
|
+
"types": "./dist/webgl-constants.d.ts",
|
|
36
|
+
"import": "./dist/webgl-constants.js",
|
|
37
|
+
"require": "./dist/index.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./webgl-types": {
|
|
40
|
+
"types": "./dist/webgl-types.d.ts",
|
|
41
|
+
"import": "./dist/webgl-types.js",
|
|
42
|
+
"require": "./dist/index.cjs"
|
|
28
43
|
}
|
|
29
44
|
},
|
|
30
45
|
"files": [
|
|
@@ -40,12 +55,11 @@
|
|
|
40
55
|
"prepublishOnly": "npm run build-minified-bundle && npm run build-dev-bundle"
|
|
41
56
|
},
|
|
42
57
|
"peerDependencies": {
|
|
43
|
-
"@luma.gl/core": "9.
|
|
58
|
+
"@luma.gl/core": "9.3.0-alpha.6"
|
|
44
59
|
},
|
|
45
60
|
"dependencies": {
|
|
46
|
-
"@luma.gl/constants": "9.3.0-alpha.4",
|
|
47
61
|
"@math.gl/types": "^4.1.0",
|
|
48
62
|
"@probe.gl/env": "^4.1.1"
|
|
49
63
|
},
|
|
50
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "371f0979c1cd01563badc36118f314365a66e1a1"
|
|
51
65
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type {CompareFunction, StencilOperation, BlendOperation, BlendFactor} from '@luma.gl/core';
|
|
6
6
|
import {Device, log, Parameters, PolygonMode, ProvokingVertex} from '@luma.gl/core';
|
|
7
|
-
import {GL} from '@luma.gl/constants';
|
|
7
|
+
import {GL} from '@luma.gl/webgl/constants';
|
|
8
8
|
import type {
|
|
9
9
|
GLBlendEquation,
|
|
10
10
|
GLBlendFunction,
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
GLPolygonMode,
|
|
14
14
|
GLProvokingVertex,
|
|
15
15
|
GLStencilOp
|
|
16
|
-
} from '@luma.gl/constants';
|
|
16
|
+
} from '@luma.gl/webgl/constants';
|
|
17
17
|
import {setGLParameters} from '../../context/parameters/unified-parameter-api';
|
|
18
18
|
import {WebGLDevice} from '../webgl-device';
|
|
19
19
|
|
|
@@ -232,6 +232,10 @@ export function setDeviceParameters(device: Device, parameters: Parameters) {
|
|
|
232
232
|
gl.depthFunc(convertCompareFunction('depthCompare', parameters.depthCompare));
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
if (parameters.clearDepth !== undefined) {
|
|
236
|
+
gl.clearDepth(parameters.clearDepth);
|
|
237
|
+
}
|
|
238
|
+
|
|
235
239
|
if (parameters.stencilWriteMask) {
|
|
236
240
|
const mask = parameters.stencilWriteMask;
|
|
237
241
|
gl.stencilMaskSeparate(GL.FRONT, mask);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// SAMPLER FILTERS
|
|
6
6
|
import {SamplerProps} from '@luma.gl/core';
|
|
7
|
-
import {GL, GLSamplerParameters} from '@luma.gl/constants';
|
|
7
|
+
import {GL, GLSamplerParameters} from '@luma.gl/webgl/constants';
|
|
8
8
|
import {convertCompareFunction} from './device-parameters';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {GL, GLDataType, GLPixelType} from '@luma.gl/constants';
|
|
5
|
+
import {GL, GLDataType, GLPixelType} from '@luma.gl/webgl/constants';
|
|
6
6
|
import {SignedDataType} from '@luma.gl/core';
|
|
7
7
|
|
|
8
8
|
/** Get shadertypes data type from GL constants */
|
|
@@ -28,68 +28,3 @@ const GL_DATA_TYPE_MAP: Record<GLDataType | GLPixelType, SignedDataType> = {
|
|
|
28
28
|
[GL.UNSIGNED_INT_24_8]: 'uint32',
|
|
29
29
|
[GL.FLOAT_32_UNSIGNED_INT_24_8_REV]: 'uint32'
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
/** Get shader data type from GL constants *
|
|
33
|
-
export function getPrimitiveTypeFromGL(type: GL): PrimitiveDataType {
|
|
34
|
-
switch (type) {
|
|
35
|
-
case GL.INT:
|
|
36
|
-
return 'i32';
|
|
37
|
-
case GL.UNSIGNED_INT:
|
|
38
|
-
return 'u32';
|
|
39
|
-
case GL.SHORT:
|
|
40
|
-
return 'i32';
|
|
41
|
-
case GL.UNSIGNED_SHORT:
|
|
42
|
-
return 'u32';
|
|
43
|
-
case GL.BYTE:
|
|
44
|
-
return 'i32';
|
|
45
|
-
case GL.UNSIGNED_BYTE:
|
|
46
|
-
return 'u32';
|
|
47
|
-
case GL.FLOAT:
|
|
48
|
-
return 'f32';
|
|
49
|
-
case GL.HALF_FLOAT:
|
|
50
|
-
return 'f16';
|
|
51
|
-
default:
|
|
52
|
-
throw new Error(String(type));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Get shader attribute type from GL constants *
|
|
57
|
-
export function getShaderAttributeTypeFromGL(
|
|
58
|
-
type: GL,
|
|
59
|
-
components: 1 | 2 | 3 | 4
|
|
60
|
-
): AttributeShaderType {
|
|
61
|
-
const dataType = getPrimitiveTypeFromGL(type);
|
|
62
|
-
switch (components) {
|
|
63
|
-
case 1:
|
|
64
|
-
return dataType;
|
|
65
|
-
case 2:
|
|
66
|
-
return `vec2<${dataType}>`;
|
|
67
|
-
case 3:
|
|
68
|
-
return `vec2<${dataType}>`;
|
|
69
|
-
case 4:
|
|
70
|
-
return `vec2<${dataType}>`;
|
|
71
|
-
default:
|
|
72
|
-
throw new Error(String(components));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
/** GetGL constant from shader data type
|
|
78
|
-
export function getGLFromShaderDataType(
|
|
79
|
-
type: PrimitiveDataType
|
|
80
|
-
): GL.INT | GL.UNSIGNED_INT | GL.FLOAT | GL.HALF_FLOAT {
|
|
81
|
-
switch (type) {
|
|
82
|
-
// TODO
|
|
83
|
-
case 'i32':
|
|
84
|
-
return GL.INT;
|
|
85
|
-
case 'u32':
|
|
86
|
-
return GL.UNSIGNED_INT;
|
|
87
|
-
case 'f32':
|
|
88
|
-
return GL.FLOAT;
|
|
89
|
-
case 'f16':
|
|
90
|
-
return GL.HALF_FLOAT;
|
|
91
|
-
default:
|
|
92
|
-
throw new Error(String(type));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {VariableShaderType, SignedDataType, VertexFormat, NormalizedDataType} from '@luma.gl/core';
|
|
6
|
-
import {GL, GLUniformType, GLSamplerType, GLDataType} from '@luma.gl/constants';
|
|
6
|
+
import {GL, GLUniformType, GLSamplerType, GLDataType} from '@luma.gl/webgl/constants';
|
|
7
7
|
|
|
8
8
|
export type TextureBindingInfo = {
|
|
9
9
|
viewDimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
@@ -15,14 +15,6 @@ export function convertDataTypeToGLDataType(normalizedType: NormalizedDataType):
|
|
|
15
15
|
return NORMALIZED_SHADER_TYPE_TO_WEBGL[normalizedType];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/** Converts to a luma shadertype to a GL data type (GL.BYTE, GL.FLOAT32 etc) */
|
|
19
|
-
export function convertShaderVariableTypeToGLDataType(
|
|
20
|
-
normalizedType: VariableShaderType
|
|
21
|
-
): GLDataType {
|
|
22
|
-
// @ts-ignore TODO
|
|
23
|
-
return NORMALIZED_SHADER_TYPE_TO_WEBGL[normalizedType];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
18
|
/** Convert a WebGL "compisite type (e.g. GL.VEC3) into the corresponding luma shader uniform type */
|
|
27
19
|
export function convertGLUniformTypeToShaderVariableType(
|
|
28
20
|
glUniformType: GLUniformType
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
DeviceTextureFormatCapabilities
|
|
10
10
|
} from '@luma.gl/core';
|
|
11
11
|
import {textureFormatDecoder} from '@luma.gl/core';
|
|
12
|
-
import {GL, GLPixelType, GLExtensions, GLTexelDataFormat} from '@luma.gl/constants';
|
|
12
|
+
import {GL, GLPixelType, GLExtensions, GLTexelDataFormat} from '@luma.gl/webgl/constants';
|
|
13
13
|
import {getWebGLExtension} from '../../context/helpers/webgl-extensions';
|
|
14
14
|
import {getGLFromVertexType} from './webgl-vertex-formats';
|
|
15
15
|
|
|
@@ -32,32 +32,44 @@ const X_ATC = 'WEBGL_compressed_texture_atc';
|
|
|
32
32
|
const EXT_texture_norm16 = 'EXT_texture_norm16';
|
|
33
33
|
const EXT_render_snorm = 'EXT_render_snorm';
|
|
34
34
|
const EXT_color_buffer_float = 'EXT_color_buffer_float';
|
|
35
|
+
const SNORM8_COLOR_RENDERABLE: DeviceFeature = 'snorm8-renderable-webgl';
|
|
36
|
+
const NORM16_COLOR_RENDERABLE: DeviceFeature = 'norm16-renderable-webgl';
|
|
37
|
+
const SNORM16_COLOR_RENDERABLE: DeviceFeature = 'snorm16-renderable-webgl';
|
|
38
|
+
const FLOAT16_COLOR_RENDERABLE: DeviceFeature = 'float16-renderable-webgl';
|
|
39
|
+
const FLOAT32_COLOR_RENDERABLE: DeviceFeature = 'float32-renderable-webgl';
|
|
40
|
+
const RGB9E5UFLOAT_COLOR_RENDERABLE: DeviceFeature = 'rgb9e5ufloat-renderable-webgl';
|
|
41
|
+
|
|
42
|
+
type TextureFeatureDefinition = {
|
|
43
|
+
extensions?: string[];
|
|
44
|
+
features?: DeviceFeature[];
|
|
45
|
+
};
|
|
35
46
|
|
|
36
47
|
// prettier-ignore
|
|
37
|
-
export const TEXTURE_FEATURES: Partial<Record<DeviceFeature,
|
|
38
|
-
'float32-renderable-webgl': [
|
|
39
|
-
'float16-renderable-webgl': ['EXT_color_buffer_half_float'],
|
|
40
|
-
'rgb9e5ufloat-renderable-webgl': ['WEBGL_render_shared_exponent'],
|
|
41
|
-
'snorm8-renderable-webgl': [EXT_render_snorm],
|
|
42
|
-
'norm16-
|
|
43
|
-
'
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
export const TEXTURE_FEATURES: Partial<Record<DeviceFeature, TextureFeatureDefinition>> = {
|
|
49
|
+
'float32-renderable-webgl': {extensions: [EXT_color_buffer_float]},
|
|
50
|
+
'float16-renderable-webgl': {extensions: ['EXT_color_buffer_half_float']},
|
|
51
|
+
'rgb9e5ufloat-renderable-webgl': {extensions: ['WEBGL_render_shared_exponent']},
|
|
52
|
+
'snorm8-renderable-webgl': {extensions: [EXT_render_snorm]},
|
|
53
|
+
'norm16-webgl': {extensions: [EXT_texture_norm16]},
|
|
54
|
+
'norm16-renderable-webgl': {features: ['norm16-webgl']},
|
|
55
|
+
'snorm16-renderable-webgl': {features: ['norm16-webgl'], extensions: [EXT_render_snorm]},
|
|
56
|
+
|
|
57
|
+
'float32-filterable': {extensions: ['OES_texture_float_linear']},
|
|
58
|
+
'float16-filterable-webgl': {extensions: ['OES_texture_half_float_linear']},
|
|
59
|
+
'texture-filterable-anisotropic-webgl': {extensions: ['EXT_texture_filter_anisotropic']},
|
|
60
|
+
|
|
61
|
+
'texture-blend-float-webgl': {extensions: ['EXT_float_blend']},
|
|
62
|
+
|
|
63
|
+
'texture-compression-bc': {extensions: [X_S3TC, X_S3TC_SRGB, X_RGTC, X_BPTC]},
|
|
52
64
|
// 'texture-compression-bc3-srgb-webgl': [X_S3TC_SRGB],
|
|
53
65
|
// 'texture-compression-bc3-webgl': [X_S3TC],
|
|
54
|
-
'texture-compression-bc5-webgl': [X_RGTC],
|
|
55
|
-
'texture-compression-bc7-webgl': [X_BPTC],
|
|
56
|
-
'texture-compression-etc2': [X_ETC2],
|
|
57
|
-
'texture-compression-astc': [X_ASTC],
|
|
58
|
-
'texture-compression-etc1-webgl': [X_ETC1],
|
|
59
|
-
'texture-compression-pvrtc-webgl': [X_PVRTC],
|
|
60
|
-
'texture-compression-atc-webgl': [X_ATC]
|
|
66
|
+
'texture-compression-bc5-webgl': {extensions: [X_RGTC]},
|
|
67
|
+
'texture-compression-bc7-webgl': {extensions: [X_BPTC]},
|
|
68
|
+
'texture-compression-etc2': {extensions: [X_ETC2]},
|
|
69
|
+
'texture-compression-astc': {extensions: [X_ASTC]},
|
|
70
|
+
'texture-compression-etc1-webgl': {extensions: [X_ETC1]},
|
|
71
|
+
'texture-compression-pvrtc-webgl': {extensions: [X_PVRTC]},
|
|
72
|
+
'texture-compression-atc-webgl': {extensions: [X_ATC]}
|
|
61
73
|
};
|
|
62
74
|
|
|
63
75
|
export function isTextureFeature(feature: DeviceFeature): boolean {
|
|
@@ -70,8 +82,36 @@ export function checkTextureFeature(
|
|
|
70
82
|
feature: DeviceFeature,
|
|
71
83
|
extensions: GLExtensions
|
|
72
84
|
): boolean {
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
return hasTextureFeature(gl, feature, extensions, new Set<DeviceFeature>());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function hasTextureFeature(
|
|
89
|
+
gl: WebGL2RenderingContext,
|
|
90
|
+
feature: DeviceFeature,
|
|
91
|
+
extensions: GLExtensions,
|
|
92
|
+
seenFeatures: Set<DeviceFeature>
|
|
93
|
+
): boolean {
|
|
94
|
+
const definition = TEXTURE_FEATURES[feature];
|
|
95
|
+
if (!definition) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (seenFeatures.has(feature)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
seenFeatures.add(feature);
|
|
104
|
+
const hasDependentFeatures = (definition.features || []).every(dependentFeature =>
|
|
105
|
+
hasTextureFeature(gl, dependentFeature, extensions, seenFeatures)
|
|
106
|
+
);
|
|
107
|
+
seenFeatures.delete(feature);
|
|
108
|
+
if (!hasDependentFeatures) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (definition.extensions || []).every(extension =>
|
|
113
|
+
Boolean(getWebGLExtension(gl, extension, extensions))
|
|
114
|
+
);
|
|
75
115
|
}
|
|
76
116
|
|
|
77
117
|
// TEXTURE FORMATS
|
|
@@ -81,6 +121,8 @@ type WebGLFormatInfo = {
|
|
|
81
121
|
gl?: GL;
|
|
82
122
|
/** compressed */
|
|
83
123
|
x?: string;
|
|
124
|
+
/** color-renderable capability gate. false means never color-renderable on WebGL. */
|
|
125
|
+
r?: DeviceFeature | false;
|
|
84
126
|
types?: GLPixelType[];
|
|
85
127
|
dataFormat?: GLTexelDataFormat;
|
|
86
128
|
/** if depthTexture is set this is a depth/stencil format that can be set to a texture */
|
|
@@ -99,21 +141,21 @@ type WebGLFormatInfo = {
|
|
|
99
141
|
export const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {
|
|
100
142
|
// 8-bit formats
|
|
101
143
|
'r8unorm': {gl: GL.R8, rb: true},
|
|
102
|
-
'r8snorm': {gl: GL.R8_SNORM},
|
|
144
|
+
'r8snorm': {gl: GL.R8_SNORM, r: SNORM8_COLOR_RENDERABLE},
|
|
103
145
|
'r8uint': {gl: GL.R8UI, rb: true},
|
|
104
146
|
'r8sint': {gl: GL.R8I, rb: true},
|
|
105
147
|
|
|
106
148
|
// 16-bit formats
|
|
107
149
|
'rg8unorm': {gl: GL.RG8, rb: true},
|
|
108
|
-
'rg8snorm': {gl: GL.RG8_SNORM},
|
|
150
|
+
'rg8snorm': {gl: GL.RG8_SNORM, r: SNORM8_COLOR_RENDERABLE},
|
|
109
151
|
'rg8uint': {gl: GL.RG8UI, rb: true},
|
|
110
152
|
'rg8sint': {gl: GL.RG8I, rb: true},
|
|
111
153
|
|
|
112
154
|
'r16uint': {gl: GL.R16UI, rb: true},
|
|
113
155
|
'r16sint': {gl: GL.R16I, rb: true},
|
|
114
|
-
'r16float': {gl: GL.R16F, rb: true},
|
|
115
|
-
'r16unorm': {gl: GL.R16_EXT, rb: true},
|
|
116
|
-
'r16snorm': {gl: GL.R16_SNORM_EXT},
|
|
156
|
+
'r16float': {gl: GL.R16F, rb: true, r: FLOAT16_COLOR_RENDERABLE},
|
|
157
|
+
'r16unorm': {gl: GL.R16_EXT, rb: true, r: NORM16_COLOR_RENDERABLE},
|
|
158
|
+
'r16snorm': {gl: GL.R16_SNORM_EXT, r: SNORM16_COLOR_RENDERABLE},
|
|
117
159
|
|
|
118
160
|
// Packed 16-bit formats
|
|
119
161
|
'rgba4unorm-webgl': {gl: GL.RGBA4, rb: true},
|
|
@@ -127,7 +169,7 @@ export const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {
|
|
|
127
169
|
// 32-bit formats
|
|
128
170
|
'rgba8unorm': {gl: GL.RGBA8},
|
|
129
171
|
'rgba8unorm-srgb': {gl: GL.SRGB8_ALPHA8},
|
|
130
|
-
'rgba8snorm': {gl: GL.RGBA8_SNORM},
|
|
172
|
+
'rgba8snorm': {gl: GL.RGBA8_SNORM, r: SNORM8_COLOR_RENDERABLE},
|
|
131
173
|
'rgba8uint': {gl: GL.RGBA8UI},
|
|
132
174
|
'rgba8sint': {gl: GL.RGBA8I},
|
|
133
175
|
// reverse colors, webgpu only
|
|
@@ -136,41 +178,41 @@ export const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {
|
|
|
136
178
|
|
|
137
179
|
'rg16uint': {gl: GL.RG16UI},
|
|
138
180
|
'rg16sint': {gl: GL.RG16I},
|
|
139
|
-
'rg16float': {gl: GL.RG16F, rb: true},
|
|
140
|
-
'rg16unorm': {gl: GL.RG16_EXT},
|
|
141
|
-
'rg16snorm': {gl: GL.RG16_SNORM_EXT},
|
|
181
|
+
'rg16float': {gl: GL.RG16F, rb: true, r: FLOAT16_COLOR_RENDERABLE},
|
|
182
|
+
'rg16unorm': {gl: GL.RG16_EXT, r: NORM16_COLOR_RENDERABLE},
|
|
183
|
+
'rg16snorm': {gl: GL.RG16_SNORM_EXT, r: SNORM16_COLOR_RENDERABLE},
|
|
142
184
|
|
|
143
185
|
'r32uint': {gl: GL.R32UI, rb: true},
|
|
144
186
|
'r32sint': {gl: GL.R32I, rb: true},
|
|
145
|
-
'r32float': {gl: GL.R32F},
|
|
187
|
+
'r32float': {gl: GL.R32F, r: FLOAT32_COLOR_RENDERABLE},
|
|
146
188
|
|
|
147
189
|
// Packed 32-bit formats
|
|
148
|
-
'rgb9e5ufloat': {gl: GL.RGB9_E5}, // , filter: true},
|
|
190
|
+
'rgb9e5ufloat': {gl: GL.RGB9_E5, r: RGB9E5UFLOAT_COLOR_RENDERABLE}, // , filter: true},
|
|
149
191
|
'rg11b10ufloat': {gl: GL.R11F_G11F_B10F, rb: true},
|
|
150
192
|
'rgb10a2unorm': {gl: GL.RGB10_A2, rb: true},
|
|
151
193
|
'rgb10a2uint': {gl: GL.RGB10_A2UI, rb: true},
|
|
152
194
|
|
|
153
195
|
// 48-bit formats
|
|
154
|
-
'rgb16unorm-webgl': {gl: GL.RGB16_EXT}, // rgb not renderable
|
|
155
|
-
'rgb16snorm-webgl': {gl: GL.RGB16_SNORM_EXT}, // rgb not renderable
|
|
196
|
+
'rgb16unorm-webgl': {gl: GL.RGB16_EXT, r: false}, // rgb not renderable
|
|
197
|
+
'rgb16snorm-webgl': {gl: GL.RGB16_SNORM_EXT, r: false}, // rgb not renderable
|
|
156
198
|
|
|
157
199
|
// 64-bit formats
|
|
158
200
|
'rg32uint': {gl: GL.RG32UI, rb: true},
|
|
159
201
|
'rg32sint': {gl: GL.RG32I, rb: true},
|
|
160
|
-
'rg32float': {gl: GL.RG32F, rb: true},
|
|
202
|
+
'rg32float': {gl: GL.RG32F, rb: true, r: FLOAT32_COLOR_RENDERABLE},
|
|
161
203
|
'rgba16uint': {gl: GL.RGBA16UI, rb: true},
|
|
162
204
|
'rgba16sint': {gl: GL.RGBA16I, rb: true},
|
|
163
|
-
'rgba16float': {gl: GL.RGBA16F},
|
|
164
|
-
'rgba16unorm': {gl: GL.RGBA16_EXT, rb: true},
|
|
165
|
-
'rgba16snorm': {gl: GL.RGBA16_SNORM_EXT},
|
|
205
|
+
'rgba16float': {gl: GL.RGBA16F, r: FLOAT16_COLOR_RENDERABLE},
|
|
206
|
+
'rgba16unorm': {gl: GL.RGBA16_EXT, rb: true, r: NORM16_COLOR_RENDERABLE},
|
|
207
|
+
'rgba16snorm': {gl: GL.RGBA16_SNORM_EXT, r: SNORM16_COLOR_RENDERABLE},
|
|
166
208
|
|
|
167
209
|
// 96-bit formats (deprecated!)
|
|
168
|
-
'rgb32float-webgl': {gl: GL.RGB32F, x: EXT_color_buffer_float, dataFormat: GL.RGB, types: [GL.FLOAT]},
|
|
210
|
+
'rgb32float-webgl': {gl: GL.RGB32F, x: EXT_color_buffer_float, r: FLOAT32_COLOR_RENDERABLE, dataFormat: GL.RGB, types: [GL.FLOAT]},
|
|
169
211
|
|
|
170
212
|
// 128-bit formats
|
|
171
213
|
'rgba32uint': {gl: GL.RGBA32UI, rb: true},
|
|
172
214
|
'rgba32sint': {gl: GL.RGBA32I, rb: true},
|
|
173
|
-
'rgba32float': {gl: GL.RGBA32F, rb: true},
|
|
215
|
+
'rgba32float': {gl: GL.RGBA32F, rb: true, r: FLOAT32_COLOR_RENDERABLE},
|
|
174
216
|
|
|
175
217
|
// Depth and stencil formats
|
|
176
218
|
'stencil8': {gl: GL.STENCIL_INDEX8, rb: true}, // 8 stencil bits
|
|
@@ -237,8 +279,8 @@ export const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {
|
|
|
237
279
|
'astc-8x6-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR},
|
|
238
280
|
'astc-8x8-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_8x8_KHR},
|
|
239
281
|
'astc-8x8-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR},
|
|
240
|
-
'astc-10x5-unorm': {gl: GL.
|
|
241
|
-
'astc-10x5-unorm-srgb': {gl: GL.
|
|
282
|
+
'astc-10x5-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x5_KHR},
|
|
283
|
+
'astc-10x5-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR},
|
|
242
284
|
'astc-10x6-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x6_KHR},
|
|
243
285
|
'astc-10x6-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR},
|
|
244
286
|
'astc-10x8-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x8_KHR},
|
|
@@ -254,7 +296,7 @@ export const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {
|
|
|
254
296
|
|
|
255
297
|
'pvrtc-rgb4unorm-webgl': {gl: GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},
|
|
256
298
|
'pvrtc-rgba4unorm-webgl': {gl: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},
|
|
257
|
-
'pvrtc-
|
|
299
|
+
'pvrtc-rgb2unorm-webgl': {gl: GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG},
|
|
258
300
|
'pvrtc-rgba2unorm-webgl': {gl: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG},
|
|
259
301
|
|
|
260
302
|
// WEBGL_compressed_texture_etc1
|
|
@@ -270,26 +312,6 @@ export const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {
|
|
|
270
312
|
|
|
271
313
|
// FUNCTIONS
|
|
272
314
|
|
|
273
|
-
/** Checks if a texture format is supported */
|
|
274
|
-
export function isWebGLTextureFormatCapabilitiesed(
|
|
275
|
-
gl: WebGL2RenderingContext,
|
|
276
|
-
format: TextureFormat,
|
|
277
|
-
extensions: GLExtensions
|
|
278
|
-
): boolean {
|
|
279
|
-
const webglTextureInfo = WEBGL_TEXTURE_FORMATS[format];
|
|
280
|
-
// Check that we have a GL constant
|
|
281
|
-
if (!webglTextureInfo?.gl) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Check extensions
|
|
286
|
-
const extension = webglTextureInfo.x;
|
|
287
|
-
if (extension) {
|
|
288
|
-
return Boolean(getWebGLExtension(gl, extension, extensions));
|
|
289
|
-
}
|
|
290
|
-
return true;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
315
|
/** Checks if a texture format is supported, renderable, filterable etc */
|
|
294
316
|
export function getTextureFormatCapabilitiesWebGL(
|
|
295
317
|
gl: WebGL2RenderingContext,
|
|
@@ -308,12 +330,29 @@ export function getTextureFormatCapabilitiesWebGL(
|
|
|
308
330
|
supported = supported && Boolean(getWebGLExtension(gl, webglFormatInfo.x, extensions));
|
|
309
331
|
}
|
|
310
332
|
|
|
333
|
+
// WebGL2 exposes STENCIL_INDEX8 for renderbuffers, but standalone stencil textures are not
|
|
334
|
+
// valid texture storage targets. Report them as unsupported texture formats to avoid invalid
|
|
335
|
+
// constructor paths and misleading capability checks.
|
|
336
|
+
if (formatSupport.format === 'stencil8') {
|
|
337
|
+
supported = false;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const renderFeatureSupported =
|
|
341
|
+
webglFormatInfo?.r === false
|
|
342
|
+
? false
|
|
343
|
+
: webglFormatInfo?.r === undefined || checkTextureFeature(gl, webglFormatInfo.r, extensions);
|
|
344
|
+
const renderable =
|
|
345
|
+
supported &&
|
|
346
|
+
formatSupport.render &&
|
|
347
|
+
renderFeatureSupported &&
|
|
348
|
+
isColorRenderableTextureFormat(gl, formatSupport.format, extensions);
|
|
349
|
+
|
|
311
350
|
return {
|
|
312
351
|
format: formatSupport.format,
|
|
313
352
|
// @ts-ignore
|
|
314
353
|
create: supported && formatSupport.create,
|
|
315
354
|
// @ts-ignore
|
|
316
|
-
render:
|
|
355
|
+
render: renderable,
|
|
317
356
|
// @ts-ignore
|
|
318
357
|
filter: supported && formatSupport.filter,
|
|
319
358
|
// @ts-ignore
|
|
@@ -323,6 +362,59 @@ export function getTextureFormatCapabilitiesWebGL(
|
|
|
323
362
|
};
|
|
324
363
|
}
|
|
325
364
|
|
|
365
|
+
function isColorRenderableTextureFormat(
|
|
366
|
+
gl: WebGL2RenderingContext,
|
|
367
|
+
format: TextureFormat,
|
|
368
|
+
extensions: GLExtensions
|
|
369
|
+
): boolean {
|
|
370
|
+
const webglFormatInfo = WEBGL_TEXTURE_FORMATS[format];
|
|
371
|
+
const internalFormat = webglFormatInfo?.gl;
|
|
372
|
+
if (internalFormat === undefined) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (webglFormatInfo?.x && !getWebGLExtension(gl, webglFormatInfo.x, extensions)) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const previousTexture = gl.getParameter(GL.TEXTURE_BINDING_2D) as WebGLTexture | null;
|
|
381
|
+
const previousFramebuffer = gl.getParameter(GL.FRAMEBUFFER_BINDING) as WebGLFramebuffer | null;
|
|
382
|
+
const texture = gl.createTexture();
|
|
383
|
+
const framebuffer = gl.createFramebuffer();
|
|
384
|
+
if (!texture || !framebuffer) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Isolate the probe from any prior driver errors so the result reflects only this format.
|
|
389
|
+
const noError = Number(GL.NO_ERROR);
|
|
390
|
+
let error = Number(gl.getError());
|
|
391
|
+
while (error !== noError) {
|
|
392
|
+
error = gl.getError();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
let renderable = false;
|
|
396
|
+
try {
|
|
397
|
+
gl.bindTexture(GL.TEXTURE_2D, texture);
|
|
398
|
+
gl.texStorage2D(GL.TEXTURE_2D, 1, internalFormat, 1, 1);
|
|
399
|
+
if (Number(gl.getError()) !== noError) {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer);
|
|
404
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, GL.COLOR_ATTACHMENT0, GL.TEXTURE_2D, texture, 0);
|
|
405
|
+
renderable =
|
|
406
|
+
Number(gl.checkFramebufferStatus(GL.FRAMEBUFFER)) === Number(GL.FRAMEBUFFER_COMPLETE) &&
|
|
407
|
+
Number(gl.getError()) === noError;
|
|
408
|
+
} finally {
|
|
409
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, previousFramebuffer);
|
|
410
|
+
gl.deleteFramebuffer(framebuffer);
|
|
411
|
+
gl.bindTexture(GL.TEXTURE_2D, previousTexture);
|
|
412
|
+
gl.deleteTexture(texture);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return renderable;
|
|
416
|
+
}
|
|
417
|
+
|
|
326
418
|
/** Get parameters necessary to work with format in WebGL: internalFormat, dataFormat, type, compressed, */
|
|
327
419
|
export function getTextureFormatWebGL(format: TextureFormat): {
|
|
328
420
|
internalFormat: GL;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// Provides a function that enables simple checking of which WebGL features are
|
|
7
7
|
|
|
8
8
|
import {DeviceFeature, DeviceFeatures} from '@luma.gl/core';
|
|
9
|
-
import {GLExtensions} from '@luma.gl/constants';
|
|
9
|
+
import {GLExtensions} from '@luma.gl/webgl/constants';
|
|
10
10
|
import {getWebGLExtension} from '../../context/helpers/webgl-extensions';
|
|
11
11
|
import {
|
|
12
12
|
isTextureFeature,
|
|
@@ -21,13 +21,12 @@ import {
|
|
|
21
21
|
const WEBGL_FEATURES: Partial<Record<DeviceFeature, boolean | string>> = {
|
|
22
22
|
// optional WebGPU features
|
|
23
23
|
'depth-clip-control': 'EXT_depth_clamp', // TODO these seem subtly different
|
|
24
|
-
|
|
24
|
+
'timestamp-query': 'EXT_disjoint_timer_query_webgl2',
|
|
25
25
|
// "indirect-first-instance"
|
|
26
26
|
// Textures are handled by getTextureFeatures()
|
|
27
27
|
// 'depth32float-stencil8' // GPUTextureFormat 'depth32float-stencil8'
|
|
28
28
|
|
|
29
29
|
// optional WebGL features
|
|
30
|
-
'timer-query-webgl': 'EXT_disjoint_timer_query_webgl2',
|
|
31
30
|
'compilation-status-async-webgl': 'KHR_parallel_shader_compile',
|
|
32
31
|
'polygon-mode-webgl': 'WEBGL_polygon_mode',
|
|
33
32
|
'provoking-vertex-webgl': 'WEBGL_provoking_vertex',
|