@arcgis/core 5.1.0-next.84 → 5.1.0-next.86
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/assets/components/assets/icon/gpsReceiver16.json +1 -0
- package/assets/components/assets/icon/gpsReceiver24.json +1 -0
- package/assets/components/assets/icon/gpsReceiver32.json +1 -0
- package/assets/components/assets/icon/totalStation16.json +1 -0
- package/assets/components/assets/icon/totalStation24.json +1 -0
- package/assets/components/assets/icon/totalStation32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e89dc473f46a5584d2ef.js → 004af103a94d21cb4889.js} +3 -3
- package/assets/esri/core/workers/chunks/{67abbe81c16de26f61d8.js → 1bad4331a43169f3cc34.js} +1 -1
- package/assets/esri/core/workers/chunks/27f67a3828b78d4c1413.js +1 -0
- package/assets/esri/core/workers/chunks/2c916b93d8a6e6b9c0d7.js +1 -0
- package/assets/esri/core/workers/chunks/{db86a1119e4e58ecfbda.js → 2f8b173d1dac73ba0d9e.js} +1 -1
- package/assets/esri/core/workers/chunks/49e8144effc299dfcd66.js +1 -0
- package/assets/esri/core/workers/chunks/5166f204fd078dced5db.js +1 -0
- package/assets/esri/core/workers/chunks/{45c83eb7c2a06166e3b0.js → 56717ff315c6ec874142.js} +1 -1
- package/assets/esri/core/workers/chunks/577cbc131b21c351fae5.js +2 -0
- package/assets/esri/core/workers/chunks/{72691fe14024e35f85d0.js → 618106f5fbdf88ef2278.js} +1 -1
- package/assets/esri/core/workers/chunks/61fada8942b65fa0b5e1.js +1 -0
- package/assets/esri/core/workers/chunks/{05c5f68e117fc58ae801.js → 701b823763e941b71f4f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e2c0c6d724f7639d4c1.js → 713ab619060bd5087479.js} +13 -13
- package/assets/esri/core/workers/chunks/{a9b5ce00323cd5574bf7.js → 7160e3e7340beb7fdb42.js} +1 -1
- package/assets/esri/core/workers/chunks/{0219edb509e01270d42d.js → 99c6bd2125f4eb6796fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff713926985a284f5d81.js → a844547bf33a8527ee9f.js} +2 -2
- package/assets/esri/core/workers/chunks/aa6808146c76b2d49b64.js +1 -0
- package/assets/esri/core/workers/chunks/{9cac70164d8528c283af.js → add000f51c778114c028.js} +1 -1
- package/assets/esri/core/workers/chunks/b23e677c33db6f9bac8a.js +1 -0
- package/assets/esri/core/workers/chunks/{dfe1139124fda0d6c059.js → b575292013bceef9b015.js} +1 -1
- package/assets/esri/core/workers/chunks/bae8f2a5dfe0cfbc0688.js +1 -0
- package/assets/esri/core/workers/chunks/bb5f909a2f26fc6a21b0.js +2 -0
- package/assets/esri/core/workers/chunks/{28a45bd26eb5c9b3ec7c.js → ce66c551b7083913eee5.js} +1 -1
- package/assets/esri/core/workers/chunks/{22bdea4ca52970c29504.js → d0aee7c80c5c7e23d216.js} +1 -1
- package/assets/esri/core/workers/chunks/{f4220b6eab0865318033.js → d8de7fe49dba9ed589df.js} +1 -1
- package/assets/esri/core/workers/chunks/ded2f19a1685db2137f4.js +2 -0
- package/assets/esri/core/workers/chunks/{f77d23ee60c876b01e4b.js → e9a42f0262fc44a79d4b.js} +1 -1
- package/assets/esri/core/workers/chunks/edbdee69440dbfc05644.js +1 -0
- package/assets/esri/core/workers/chunks/ee057c85cdf6beb5b012.js +2 -0
- package/assets/esri/core/workers/chunks/f9fe3c9867b0bdb2aec6.js +596 -0
- package/assets/esri/core/workers/chunks/ff57a071156d8a7e47be.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/chunks/EdgeShader.glsl.js +13 -9
- package/chunks/Fog.glsl.js +1 -1
- package/chunks/GlowBlur.glsl.js +9 -13
- package/chunks/GlowComposition.glsl.js +10 -10
- package/chunks/ShadowCastVisualize.glsl.js +10 -10
- package/config.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/screenUtils.js +1 -1
- package/form/types.d.ts +1 -1
- package/geohash/GeohashCell.js +1 -1
- package/geohash/GeohashTree.js +1 -1
- package/interfaces.d.ts +14 -14
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/ParquetLayer.d.ts +10 -10
- package/layers/ParquetLayer.js +1 -1
- package/layers/StreamLayer.js +1 -1
- package/layers/graphics/sources/connections/FabricKustoConnection.js +2 -0
- package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/connections/createConnection.js +1 -1
- package/layers/graphics/sources/connections/websocketUils.js +2 -0
- package/layers/scene/ModelFileInfo.js +1 -1
- package/layers/scene/modelQuerySupport.js +1 -1
- package/layers/support/ClientSideConnection.js +1 -1
- package/layers/support/FabricKustoSource.js +2 -0
- package/layers/support/{ParquetGeometryEncodingLocation.d.ts → GeometryEncodingLocation.d.ts} +9 -9
- package/layers/support/{ParquetGeometryEncodingLocation.js → GeometryEncodingLocation.js} +1 -1
- package/layers/support/{ParquetGeometryEncodingWkb.d.ts → GeometryEncodingWkb.d.ts} +8 -9
- package/layers/support/GeometryEncodingWkb.js +2 -0
- package/layers/support/kustoUtils.js +2 -0
- package/layers/support/parquetEncodingUtils.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/layers/support/types.d.ts +3 -3
- package/package.json +2 -2
- package/popup/Features.d.ts +10 -0
- package/popup/Features.js +1 -1
- package/rest/knowledgeGraph/GraphQueryStreamingResult.d.ts +4 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/FrameTask.js +1 -1
- package/views/2d/LabelManager.js +1 -1
- package/views/2d/ViewState.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/flow/FlowContainer.js +1 -1
- package/views/2d/engine/flow/FlowView2D.js +1 -1
- package/views/2d/engine/flow/styles/AFlowResources.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Stack.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/transitions/FadeTransition.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/webgl/AFeatureTile.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/ResizableUint32Array.js +2 -0
- package/views/2d/engine/webgl/TileCpuState.js +2 -0
- package/views/2d/engine/webgl/TileGpuState.js +2 -0
- package/views/2d/engine/webgl/cpuMapped/CpuBuffer.js +2 -0
- package/views/2d/engine/webgl/cpuMapped/CpuMeshData.js +2 -0
- package/views/2d/engine/webgl/cpuMapped/GpuMeshState.js +2 -0
- package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugContainer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestDisplayObject.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/FeatureTilePresentStrategy.js +2 -0
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/aggregation/AAggregateSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridCell.js +1 -1
- package/views/2d/layers/features/aggregation/GridIndexCell.js +2 -0
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceMessage.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
- package/views/2d/layers/features/support/Hashed.js +2 -0
- package/views/2d/layers/graphics/AGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
- package/views/2d/tiling/TileCombinedCoverage.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +2 -0
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool2.js +2 -0
- package/views/3d/analysis/Viewshed/viewshedSubToolUtils.js +2 -0
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/environment/CloudyWeather.js +1 -1
- package/views/3d/environment/FoggyWeather.js +1 -1
- package/views/3d/environment/RainyWeather.js +1 -1
- package/views/3d/environment/SnowyWeather.js +1 -1
- package/views/3d/environment/SunnyWeather.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl/ManagedColorAttachment.js +1 -1
- package/views/3d/webgl/ManagedDepthAttachment.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +11 -11
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +2 -0
- package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/raymarching/{RayDistanceFalloff.glsl.js → DistanceFalloff.glsl.js} +2 -2
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/StencilUtils.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js +1 -7
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/support/rasterHitTestUtils.js +1 -1
- package/views/support/waitForResources.js +1 -1
- package/views/video/VideoOperationalDataView.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.d.ts +61 -0
- package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +9 -4
- package/widgets/BatchAttributeForm/templates/UtilityNetworkAssociationsElementTemplate.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.d.ts +17 -2
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GroupColumn.d.ts +7 -1
- package/widgets/FeatureTable/Grid/GroupColumn.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +9 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/FeatureTable/support/types.d.ts +8 -0
- package/widgets/FeatureTable.js +1 -1
- package/assets/esri/core/workers/chunks/2171aaa147aa4d9fc5b5.js +0 -1
- package/assets/esri/core/workers/chunks/38f1a86b8dd9ee684ee5.js +0 -596
- package/assets/esri/core/workers/chunks/54d07eadf113f0e4e506.js +0 -1
- package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +0 -2
- package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +0 -2
- package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +0 -1
- package/assets/esri/core/workers/chunks/6d2abdb48e17b2b56599.js +0 -1
- package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +0 -2
- package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +0 -1
- package/assets/esri/core/workers/chunks/8f4cd30ce23e41c1a42c.js +0 -1
- package/assets/esri/core/workers/chunks/936f2b1332ece14d7c28.js +0 -2
- package/assets/esri/core/workers/chunks/983f6c8727fd9484718e.js +0 -1
- package/assets/esri/core/workers/chunks/bd8cb64b6e08839398f3.js +0 -1
- package/assets/esri/core/workers/chunks/cbf1a03f54bd8d2a2b47.js +0 -1
- package/layers/support/ParquetGeometryEncodingWkb.js +0 -2
- package/views/2d/engine/webgl/PooledUint32Array.js +0 -2
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +0 -2
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +0 -2
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +0 -2
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DistanceFalloff.glsl.js +0 -4
- /package/assets/esri/core/workers/chunks/{5ec66e39e53c11e75179.js.LICENSE.txt → 577cbc131b21c351fae5.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ff713926985a284f5d81.js.LICENSE.txt → a844547bf33a8527ee9f.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{5818f1f526577068d6ca.js.LICENSE.txt → bb5f909a2f26fc6a21b0.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{7cdd0492b2191df95102.js.LICENSE.txt → ded2f19a1685db2137f4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{936f2b1332ece14d7c28.js.LICENSE.txt → ee057c85cdf6beb5b012.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as f,DepthAttachment as u}from"./enums.js";import{Renderbuffer as l}from"./Renderbuffer.js";import d from"./Texture.js";const _=()=>e.getLogger("esri.views.webgl.FramebufferObject");class m{constructor(e,t,r){if(this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=F(e,t);null!=r&&(this._colorAttachments.set(n,r),T(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(b(r))this._depthStencilTexture=T(r)?r:new d(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=x(r)?r:new l(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return T(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&T(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=T(t);return this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._initialized){const t=this._context.gl;this._context.temporaryBindFramebufferObject(this,()=>{e.forEach(e=>{T(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,0,r):this._framebufferTexture2D(i.glName,t,e,36160,0))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,R(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{this._framebufferTexture2D(null,R(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){const{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebufferObject(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,d.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(d.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,d.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o){const{gl:c}=this._context,a=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(a);const f=this._context.boundFramebuffer;this._context.bindFramebuffer(this),c.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(f),await a.getSubDataAsync(o),a.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(A(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._initialized&&(A(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=t.createFramebuffer();if(t.bindFramebuffer(e,r),this._colorAttachments.forEach((t,r)=>{if(T(t)){const i=D(t);35866===i?this._framebufferTextureLayer(t.glName,r,e,0,0):this._framebufferTexture2D(t.glName,r,i,e)}else if(x(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=R(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,D(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=r,this._initialized=!0}_framebufferTexture2D(e,t=n,r=3553,i=36160,s=0){this._context.gl.framebufferTexture2D(i,t,r,e,s)}_framebufferTextureLayer(e,t=n,r=36160,i=0,s=0){this._context.gl.framebufferTextureLayer(r,t,e,i,s)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,R(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),A(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){A(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case f.DEPTH_COMPONENT16:case f.DEPTH_COMPONENT24:case f.DEPTH_COMPONENT32F:return u;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===m._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;m._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>m._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${m._MAX_COLOR_ATTACHMENTS} color attachments`)}}class p extends m{constructor(e,t,r){super(e,t,r)}dispose(){const{_colorAttachments:e,_glName:t,_context:r}=this;if(r.instanceCounter.decrement(s.FramebufferObject,this),0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const i=r.boundFramebuffer,n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(t),this._glName=null,r.bindFramebuffer(i===this?null:i)}}function T(e){return 1===E(e)}function x(e){return 2===E(e)}function b(e){return T(e)||g(e)}function g(e){return 0===E(e)}function S(e){return 3===E(e)||null!=e&&"samples"in e}function E(e){return null!=e&&"type"in e?e.type:null}function F(e,t){return T(t)||x(t)?t:g(t)?new d(e,t):S(t)?new l(e,t):null}function A(e,t){const r=Math.max(e.width,e.height);if(r>t){_().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function D(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function R(e){return 6402===e?u:a}export{p as DisposableFramebufferObject,m as FramebufferObject,A as ensureAttachmentMaxSize};
|
|
2
|
+
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as l,DepthAttachment as f}from"./enums.js";import{Renderbuffer as u}from"./Renderbuffer.js";import _ from"./Texture.js";const m=()=>e.getLogger("esri.views.webgl.FramebufferObject");class d{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=N(e,t);null!=r&&(this._colorAttachments.set(n,r),T(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=T(r)?r:new _(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=g(r)?r:new u(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return T(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebufferObject(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&T(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=T(t);return this._glName&&this._context.temporaryBindFramebufferObject(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){const t=this._context.gl;this._context.temporaryBindFramebufferObject(this,()=>{e.forEach(e=>{T(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,D(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebufferObject(this,()=>{this._framebufferTexture2D(null,D(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._glName){const{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebufferObject(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,_.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(_.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,_.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o){const{gl:c}=this._context,a=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(a);const l=this._context.boundFramebuffer;this._context.bindFramebuffer(this),c.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(l),await a.getSubDataAsync(o),a.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){const{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(T(t)){const i=A(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(g(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=D(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,A(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}_framebufferTexture2D(e,t=n,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=n,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,D(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===d._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;d._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>d._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${d._MAX_COLOR_ATTACHMENTS} color attachments`)}}class p extends d{constructor(e,t,r){super(e,t,r)}dispose(){const{_colorAttachments:e,_glName:t,_context:r}=this;if(r.instanceCounter.decrement(s.FramebufferObject,this),0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const i=r.boundFramebuffer,n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(this._glName),this._glName=null,r.bindFramebuffer(i===this?null:i)}}function T(e){return 1===E(e)}function g(e){return 2===E(e)}function x(e){return T(e)||b(e)}function b(e){return 0===E(e)}function S(e){return 3===E(e)||null!=e&&"samples"in e}function E(e){return null!=e&&"type"in e?e.type:null}function N(e,t){return T(t)||g(t)?t:b(t)?new _(e,t):S(t)?new u(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){m().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function A(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function D(e){return 6402===e?f:a}export{p as DisposableFramebufferObject,d as FramebufferObject,F as ensureAttachmentMaxSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{Milliseconds as i}from"../../core/time.js";import{webglDebugEnabled as a,checkWebGLError as r,getErrorMessage as n,webglValidateShadersEnabled as l}from"./checkWebGLError.js";import{ContextState as h}from"./ContextState.js";import{DrawBufferNone as f,DrawBufferBack as o,baseTextureUnit as u,ResourceType as c,ColorAttachment0 as d,PrimitiveType as _}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as p}from"./ProgramCache.js";import{StateTracker as m}from"./renderState.js";import B from"./Texture.js";import{WebGLDriverTest as F}from"./WebGLDriverTest.js";import{Capabilities as T}from"./capabilities/Capabilities.js";const x=()=>t.getLogger("esri.views.webgl.RenderingContext");let S=class{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._programCache=new p(this),this._transformFeedbackRequestInfo=null,this._state=new h,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(t){this._options=t,this._capabilities=new T(this.gl,t),this._parameters=new g(this.gl,this._capabilities,t),B.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new h,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new m({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const{ref:e,readMask:s,stencilFront:i,stencilBack:a}=t;i.compare===a.compare?this.setStencilFunction(i.compare,e,s):(this.setStencilFunctionSeparate(1028,i.compare,e,s),this.setStencilFunctionSeparate(1029,a.compare,e,s)),i.fail===a.fail&&i.zFail===a.zFail&&i.zPass===a.zPass?this.setStencilOp(i.fail,i.zFail,i.zPass):(this.setStencilOpSeparate(1028,i.fail,i.zFail,i.zPass),this.setStencilOpSeparate(1029,a.fail,a.zFail,a.zPass))}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),e(this._driverTest),this._driverTest=new F(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=e(this._driverTest),this._programCache=e(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state.textureUnitSamplerMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null;const t=this.instanceCounter.resourceInformation;a()&&t&&console.log(t)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s){const e=t[s];this._state.textureUnitMap[e]=null,this._state.textureUnitSamplerMap[e]=null}e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){1032===this._state.stencilFunction.face&&this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(u+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e)??[];if(i?.length===t.length&&i.every((e,s)=>e===t[s]))return i;if(t.length>this.parameters.maxDrawBuffers)return x().error(`Setting more active draw buffers (${t.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),i;if(s){if(t.length>1)return x().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${t.length}.`),i;if(t[0]!==o&&t[0]!==f)return x().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${t[0]}`),i}else if(t.includes(o))return x().error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers."),i;return this.gl.drawBuffers(t),r(this.gl),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),i}clear(t,e=255){t&&(16384&t&&this.setColorMask(!0,!0,!0,!0),256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t))}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=w(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),r(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),r(this.gl)}drawElements(t,e,s,i){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=w(t,e)),this.gl.drawElements(t,e,s,i),a()){const a=n(this.gl);if(a){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:i},o=n?.size??0,u=i+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";x().error(`drawElements: ${a}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,a){this.gl.drawElementsInstanced(t,e,s,i,a),r(this.gl)}logInfo(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){if(this._state.program!==t){if(t&&null==t.glName&&l())throw new Error("Attempting to use disposed or invalid Program");this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null)}}bindTexture(t,e,s=!1,i=null){(e>=this.parameters.maxTextureImageUnits||e<0)&&x().error(`Input texture unit (${e}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})\n `);const a=this._state.textureUnitMap[e],r=this._state.textureUnitSamplerMap[e],{gl:n}=this;return null==t?.glName?(null!=a&&(this.setActiveTexture(e,s),n.bindTexture(a.descriptor.target,null)),this._state.textureUnitMap[e]=null,null!=r&&(this._state.textureUnitSamplerMap[e]=null,n.bindSampler(e,null)),a):(r!==i&&(n.bindSampler(e,i?.glName??null),this._state.textureUnitSamplerMap[e]=i),s||a!==t?(this.setActiveTexture(e,s),n.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,a):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),a))}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){const s=E(t);if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(null==t)return this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,void this.setDrawBuffers(s);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t,this.setDrawBuffers(s)}else this.setDrawBuffers(s)}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._state.drawFramebuffer=t??null,this.setDrawBuffers(E(t))))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=k(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=k(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=k(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=k(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=k(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=k(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=k(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=k(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return x().error(`Uniform buffer binding point (${e}) is out of range (0...${this.parameters.maxUniformBufferBindings})\n `),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):x().error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,i){null!=e?(a()&&(i??e.byteLength)>this._parameters.maxUniformBlockSize&&x().error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==i?this.bindBufferRange(35345,t,e.buffer,s,i):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=k(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=k(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=k(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=k(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=k(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=k(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=k(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=i(10)){const{gl:e}=this,a=e.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(c.Sync,a),e.flush();do{await s(t),r=e.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(c.Sync,a),e.deleteSync(a),37149===r)throw new Error("Client wait failed")}get boundFramebuffer(){return this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.boundFramebuffer;try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(d)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[o])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[d])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(u+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null),t.bindSampler(s,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName);const i=this._state.textureUnitSamplerMap[s];null!=i&&t.bindSampler(s,i?.glName)}t.activeTexture(u+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function k(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function w(t,e){switch(t){case _.POINTS:return 2*e;case _.TRIANGLES:return e/3;case _.TRIANGLE_STRIP:case _.TRIANGLE_FAN:return e-2;default:return 0}}function E(t){return t?t.colorAttachments.length>0?t.colorAttachments:[f]:[o]}export{S as RenderingContext,E as getFramebufferDrawBuffers};
|
|
2
|
+
import has from"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{Milliseconds as i}from"../../core/time.js";import{webglDebugEnabled as a,checkWebGLError as r,getErrorMessage as n,webglValidateShadersEnabled as l}from"./checkWebGLError.js";import{ContextState as h}from"./ContextState.js";import{DrawBufferNone as f,DrawBufferBack as o,baseTextureUnit as u,ResourceType as c,ColorAttachment0 as d,PrimitiveType as _}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as p}from"./ProgramCache.js";import{StateTracker as m}from"./renderState.js";import B from"./Texture.js";import{WebGLDriverTest as F}from"./WebGLDriverTest.js";import{Capabilities as T}from"./capabilities/Capabilities.js";const x=()=>t.getLogger("esri.views.webgl.RenderingContext");let S=class{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._programCache=new p(this),this._transformFeedbackRequestInfo=null,this._state=new h,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(t){this._options=t,this._capabilities=new T(this.gl,t),this._parameters=new g(this.gl,this._capabilities,t),B.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new h,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new m({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const{ref:e,readMask:s,stencilFront:i,stencilBack:a}=t;i.compare===a.compare?this.setStencilFunction(i.compare,e,s):(this.setStencilFunctionSeparate(1028,i.compare,e,s),this.setStencilFunctionSeparate(1029,a.compare,e,s)),i.fail===a.fail&&i.zFail===a.zFail&&i.zPass===a.zPass?this.setStencilOp(i.fail,i.zFail,i.zPass):(this.setStencilOpSeparate(1028,i.fail,i.zFail,i.zPass),this.setStencilOpSeparate(1029,a.fail,a.zFail,a.zPass))}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),e(this._driverTest),this._driverTest=new F(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=e(this._driverTest),this._programCache=e(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state.textureUnitSamplerMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null;const t=a()&&this.instanceCounter.resourceInformation;t&&console.log(t)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s){const e=t[s];this._state.textureUnitMap[e]=null,this._state.textureUnitSamplerMap[e]=null}e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){1032===this._state.stencilFunction.face&&this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(u+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e)??[];if(i?.length===t.length&&i.every((e,s)=>e===t[s]))return i;if(t.length>this.parameters.maxDrawBuffers)return x().error(`Setting more active draw buffers (${t.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),i;if(s){if(t.length>1)return x().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${t.length}.`),i;if(t[0]!==o&&t[0]!==f)return x().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${t[0]}`),i}else if(t.includes(o))return x().error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers."),i;return this.gl.drawBuffers(t),r(this.gl),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),i}clear(t,e=255){t&&(16384&t&&this.setColorMask(!0,!0,!0,!0),256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t))}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=w(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),r(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),r(this.gl)}drawElements(t,e,s,i){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=w(t,e)),this.gl.drawElements(t,e,s,i),a()){const a=n(this.gl);if(a){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:i},o=n?.size??0,u=i+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";x().error(`drawElements: ${a}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,a){this.gl.drawElementsInstanced(t,e,s,i,a),r(this.gl)}logInfo(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){if(this._state.program!==t){if(t&&null==t.glName&&l())throw new Error("Attempting to use disposed or invalid Program");this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null)}}bindTexture(t,e,s=!1,i=null){(e>=this.parameters.maxTextureImageUnits||e<0)&&x().error(`Input texture unit (${e}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})\n `);const a=this._state.textureUnitMap[e],r=this._state.textureUnitSamplerMap[e],{gl:n}=this;return null==t?.glName?(null!=a&&(this.setActiveTexture(e,s),n.bindTexture(a.descriptor.target,null)),this._state.textureUnitMap[e]=null,null!=r&&(this._state.textureUnitSamplerMap[e]=null,n.bindSampler(e,null)),a):(r!==i&&(n.bindSampler(e,i?.glName??null),this._state.textureUnitSamplerMap[e]=i),s||a!==t?(this.setActiveTexture(e,s),n.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,a):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),a))}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){const s=E(t);if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(null==t)return this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,void this.setDrawBuffers(s);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t,this.setDrawBuffers(s)}else this.setDrawBuffers(s)}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._state.drawFramebuffer=t??null,this.setDrawBuffers(E(t))))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=k(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=k(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=k(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=k(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=k(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=k(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=k(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=k(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return x().error(`Uniform buffer binding point (${e}) is out of range (0...${this.parameters.maxUniformBufferBindings})\n `),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):x().error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,i){null!=e?(a()&&(i??e.byteLength)>this._parameters.maxUniformBlockSize&&x().error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==i?this.bindBufferRange(35345,t,e.buffer,s,i):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=k(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=k(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=k(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=k(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=k(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=k(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=k(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=i(10)){const{gl:e}=this,a=e.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(c.Sync,a),e.flush();do{await s(t),r=e.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(c.Sync,a),e.deleteSync(a),37149===r)throw new Error("Client wait failed")}get boundFramebuffer(){return this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.boundFramebuffer;try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(d)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[o])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[d])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(u+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null),t.bindSampler(s,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName);const i=this._state.textureUnitSamplerMap[s];null!=i&&t.bindSampler(s,i?.glName)}t.activeTexture(u+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function k(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function w(t,e){switch(t){case _.POINTS:return 2*e;case _.TRIANGLES:return e/3;case _.TRIANGLE_STRIP:case _.TRIANGLE_FAN:return e-2;default:return 0}}function E(t){return t?t.colorAttachments.length>0?t.colorAttachments:[f]:[o]}export{S as RenderingContext,E as getFramebufferDrawBuffers};
|
package/views/webgl/Texture.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../core/Error.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{abortMaybe as i}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as s,isAbortError as o}from"../../core/promiseUtils.js";import{checkWebGLError as a}from"./checkWebGLError.js";import{ResourceType as n,CompressedTextureFormat as p}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as m,deriveInternalFormat as h,isTexImageSource as d,is3DTarget as c,validateTexture as _,isCompressedFormat as u,getDimensions as g,isSizedPixelFormat as x,isSizedDepthFormat as T,isSizedDepthStencilFormat as M,calcMipmapLevels as b}from"./textureUtils.js";import{ValidatedTextureDescriptor as f}from"./ValidatedTextureDescriptor.js";const w=!!has("esri-tests-disable-gpu-memory-measurements"),D=()=>e.getLogger("esri/views/webgl/Texture");class E{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,i=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const r=f.validate(e,i);if(!r)throw new t("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return w?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=i,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.compress=t}disableCompression(){this._descriptor.compress=void 0}setData(t){this.abortCompression(),!m(t)&&this._descriptor.internalFormat&&r(p,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(t),!m(t)&&this._descriptor.compress&&this._compressOnWorker(t)}updateData(e,i,r,s,o,a,n=0){a||D().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||D().error("An attempt to update uninitialized texture!");const p=this._descriptor;p.internalFormat=h(p);const{context:l,pixelFormat:c,dataType:_,target:u,isImmutable:g}=p;if(g&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");const x=l.bindTexture(this,E.TEXTURE_UNIT_FOR_UPDATES,!0);(i<0||r<0||i+s>p.width||r+o>p.height)&&D().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:T}=l;n&&(s&&o||D().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),T.pixelStorei(T.UNPACK_SKIP_ROWS,n)),d(a)?T.texSubImage2D(u,e,i,r,s,o,c,_,a):m(a)?T.compressedTexSubImage2D(u,e,i,r,s,o,p.internalFormat,a.levels[e]):T.texSubImage2D(u,e,i,r,s,o,c,_,a),n&&T.pixelStorei(T.UNPACK_SKIP_ROWS,0),l.bindTexture(x,E.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,s,o,a,n,p){p||D().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||D().error("An attempt to update an uninitialized texture!");const l=this._descriptor;l.internalFormat=h(l);const{context:d,pixelFormat:_,dataType:u,isImmutable:g,target:x}=l;if(g&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");c(x)||D().warn("Attempting to set 3D texture data on a non-3D texture");const T=d.bindTexture(this,E.TEXTURE_UNIT_FOR_UPDATES);d.setActiveTexture(E.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||s<0||i+o>l.width||r+a>l.height||s+n>l.depth)&&D().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=d;if(m(p))p=p.levels[e],M.compressedTexSubImage3D(x,e,i,r,s,o,a,n,l.internalFormat,p);else{const t=p;M.texSubImage3D(x,e,i,r,s,o,a,n,_,u,t)}d.bindTexture(T,E.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(0===e.width||0===e.height)return;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,_(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);const i=this._descriptor.context.bindTexture(this,E.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(E.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,E.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,_(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,_(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(t){t!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=t,this.setSamplingMode(t?9729:9728),_(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=i(this._compressionAbortController)}_setData(e,i){const r=this._descriptor,s=r.context?.gl;if(!s)return;a(s),this.hasWebGLTextureObject||(this._glName=s.createTexture(),r.context.instanceCounter.increment(n.Texture,this)),_(r);const o=r.context.bindTexture(this,E.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(E.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),a(s);const p=i??r.target,l=c(p);if(d(e))this._setDataFromTexImageSource(e,p);else{const{width:i,height:o,depth:n}=r;if(null==i||null==o)throw new t("texture:missing-size","Width and height must be specified!");if(l&&null==n)throw new t("texture:missing-depth","Depth must be specified!");if(r.internalFormat=h(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(p,r.internalFormat,r.hasMipmap,i,o,n),m(e)){if(!u(r.internalFormat))throw new t("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,p)}else this._texImage(p,0,r.internalFormat,i,o,n,e),a(s),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),a(s),r.context.bindTexture(o,E.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=34069;e<=34074;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,r=this._descriptor;r.internalFormat=h(r);const s=c(e),{width:o,height:n,depth:p}=g(t);r.width&&r.height,r.width||(r.width=o),r.height||(r.height=n),s&&r.depth,s&&(r.depth=p),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,r.internalFormat,r.hasMipmap,o,n,p),this._texImage(e,0,r.internalFormat,o,n,p,t),a(i),r.hasMipmap&&(this.generateMipmap(),a(i))}_setDataFromCompressedSource(t,e,i){const r=this._descriptor,{width:s,height:o,depth:a}=r,n=t.levels,p=b(i,s,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((t,r,s,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,r,s,o,a)},l)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!x(i)&&!T(i)&&!M(i))throw new t("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const p=r?b(e,s,o,a):1;if(c(e)){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,s,o,a)}else n.texStorage2D(e,p,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e),{isImmutable:m,pixelFormat:h,dataType:d}=this._descriptor;if(m){if(null!=n){const r=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,s,o,a,h,d,r)}else p.texSubImage2D(e,i,0,0,s,o,h,d,r)}}else{const m=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texImage3D(e,i,r,s,o,a,0,h,d,m)}else p.texImage2D(e,i,r,s,o,0,h,d,m)}}_compressedTexImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else p.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,s,o,a,0,n)}else p.compressedTexImage2D(e,i,r,s,o,0,n)}async _compressOnWorker(t){const{width:e,height:i,context:r,flipped:a,preMultiplyAlpha:n,hasMipmap:p}=this._descriptor,l=this._descriptor.compress?.compressionTracker,m=this._descriptor.compress?.compressionCallback,{compressedTextureETC:h,compressedTextureS3TC:d}=r.capabilities;if(!E.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!h&&!d)return;this.abortCompression();const c=new AbortController;let _;this._compressionAbortController=c,l?.increment();let u=!1,g=!1;try{t instanceof ImageBitmap?_=t:t instanceof Uint8Array?(_=t.buffer,u=this.descriptor.flipped):(_=await createImageBitmap(t,{imageOrientation:a?"flipY":"none"}),s(c),g=!0);const r={data:_,width:e,height:i,needsFlip:u,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:n,hasMipmap:p,hasETC:!!h,hasS3TC:!!d},o=await E.compressionWorkerHandle.invoke(r,c.signal,1);if(s(c),o.compressedTexture&&this.hasWebGLTextureObject){const t=this.usedMemory;this._descriptor.internalFormat=o.internalFormat,this._setData(o.compressedTexture),m?.(t-this.usedMemory)}}catch(x){o(x)||D().error("Texture compression failed!")}finally{l?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),g&&_ instanceof ImageBitmap&&_.close()}}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:o,hasMipmap:a,target:n}=this._descriptor;const p=32879===n;if(null==r||null==s||p&&null==o)throw new t("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,o),a&&(1!==r||1!==s||p&&1!==o)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,r=t.samplingMode;9985===i||9987===i?(i=9729,t.hasMipmap||(r=9729)):9984!==i&&9986!==i||(i=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyShadowMode(){const t=this._descriptor,e=t.context?.gl,i=t.compareEnabled?e.COMPARE_REF_TO_TEXTURE:e.NONE;e.texParameteri(t.target,e.TEXTURE_COMPARE_MODE,i),t.compareEnabled&&e.texParameteri(t.target,e.TEXTURE_COMPARE_FUNC,e.GREATER),a(e)}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}}export{E as default};
|
|
2
|
+
import t from"../../core/Error.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{abortMaybe as i}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as s,isAbortError as o}from"../../core/promiseUtils.js";import{checkWebGLError as a}from"./checkWebGLError.js";import{ResourceType as n,CompressedTextureFormat as p}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as m,deriveInternalFormat as h,isTexImageSource as d,is3DTarget as c,validateTexture as _,isCompressedFormat as u,getDimensions as g,isSizedPixelFormat as x,calcMipmapLevels as T}from"./textureUtils.js";import{ValidatedTextureDescriptor as M}from"./ValidatedTextureDescriptor.js";const b=!!has("esri-tests-disable-gpu-memory-measurements"),f=()=>e.getLogger("esri/views/webgl/Texture");class w{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,i=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const r=M.validate(e,i);if(!r)throw new t("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=i,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.compress=t}disableCompression(){this._descriptor.compress=void 0}setData(t){this.abortCompression(),!m(t)&&this._descriptor.internalFormat&&r(p,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(t),!m(t)&&this._descriptor.compress&&this._compressOnWorker(t)}updateData(e,i,r,s,o,a,n=0){a||f().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||f().error("An attempt to update uninitialized texture!");const p=this._descriptor;p.internalFormat=h(p);const{context:l,pixelFormat:c,dataType:_,target:u,isImmutable:g}=p;if(g&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");const x=l.bindTexture(this,w.TEXTURE_UNIT_FOR_UPDATES,!0);(i<0||r<0||i+s>p.width||r+o>p.height)&&f().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:T}=l;n&&(s&&o||f().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),T.pixelStorei(T.UNPACK_SKIP_ROWS,n)),d(a)?T.texSubImage2D(u,e,i,r,s,o,c,_,a):m(a)?T.compressedTexSubImage2D(u,e,i,r,s,o,p.internalFormat,a.levels[e]):T.texSubImage2D(u,e,i,r,s,o,c,_,a),n&&T.pixelStorei(T.UNPACK_SKIP_ROWS,0),l.bindTexture(x,w.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,s,o,a,n,p){p||f().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||f().error("An attempt to update an uninitialized texture!");const l=this._descriptor;l.internalFormat=h(l);const{context:d,pixelFormat:_,dataType:u,isImmutable:g,target:x}=l;if(g&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");c(x)||f().warn("Attempting to set 3D texture data on a non-3D texture");const T=d.bindTexture(this,w.TEXTURE_UNIT_FOR_UPDATES);d.setActiveTexture(w.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||s<0||i+o>l.width||r+a>l.height||s+n>l.depth)&&f().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=d;if(m(p))p=p.levels[e],M.compressedTexSubImage3D(x,e,i,r,s,o,a,n,l.internalFormat,p);else{const t=p;M.texSubImage3D(x,e,i,r,s,o,a,n,_,u,t)}d.bindTexture(T,w.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(0===e.width||0===e.height)return;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,_(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);const i=this._descriptor.context.bindTexture(this,w.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(w.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,w.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,_(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,_(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(t){t!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=t,this.setSamplingMode(t?9729:9728),_(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=i(this._compressionAbortController)}_setData(e,i){const r=this._descriptor,s=r.context?.gl;if(!s)return;a(s),this.hasWebGLTextureObject||(this._glName=s.createTexture(),r.context.instanceCounter.increment(n.Texture,this)),_(r);const o=r.context.bindTexture(this,w.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(w.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),a(s);const p=i??r.target,l=c(p);if(d(e))this._setDataFromTexImageSource(e,p);else{const{width:i,height:o,depth:n}=r;if(null==i||null==o)throw new t("texture:missing-size","Width and height must be specified!");if(l&&null==n)throw new t("texture:missing-depth","Depth must be specified!");if(r.internalFormat=h(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(p,r.internalFormat,r.hasMipmap,i,o,n),m(e)){if(!u(r.internalFormat))throw new t("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,p)}else this._texImage(p,0,r.internalFormat,i,o,n,e),a(s),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),a(s),r.context.bindTexture(o,w.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=34069;e<=34074;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,r=this._descriptor;r.internalFormat=h(r);const s=c(e),{width:o,height:n,depth:p}=g(t);r.width&&r.height,r.width||(r.width=o),r.height||(r.height=n),s&&r.depth,s&&(r.depth=p),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,r.internalFormat,r.hasMipmap,o,n,p),this._texImage(e,0,r.internalFormat,o,n,p,t),a(i),r.hasMipmap&&(this.generateMipmap(),a(i))}_setDataFromCompressedSource(t,e,i){const r=this._descriptor,{width:s,height:o,depth:a}=r,n=t.levels,p=T(i,s,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((t,r,s,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,r,s,o,a)},l)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!x(i)&&!u(i))throw new t("texture:missing-format","Immutable textures must have a sized or compressed internal format");if(!this._descriptor.isImmutable)return;const p=r?T(e,s,o,a):1;if(c(e)){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,s,o,a)}else n.texStorage2D(e,p,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e),{isImmutable:m,pixelFormat:h,dataType:d}=this._descriptor;if(m){if(null!=n){const r=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,s,o,a,h,d,r)}else p.texSubImage2D(e,i,0,0,s,o,h,d,r)}}else{const m=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texImage3D(e,i,r,s,o,a,0,h,d,m)}else p.texImage2D(e,i,r,s,o,0,h,d,m)}}_compressedTexImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else p.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,s,o,a,0,n)}else p.compressedTexImage2D(e,i,r,s,o,0,n)}async _compressOnWorker(t){const{width:e,height:i,context:r,flipped:a,preMultiplyAlpha:n,hasMipmap:p}=this._descriptor,l=this._descriptor.compress?.compressionTracker,m=this._descriptor.compress?.compressionCallback,{compressedTextureETC:h,compressedTextureS3TC:d}=r.capabilities;if(!w.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!h&&!d)return;this.abortCompression();const c=new AbortController;let _;this._compressionAbortController=c,l?.increment();let u=!1,g=!1;try{t instanceof ImageBitmap?_=t:t instanceof Uint8Array?(_=t.buffer,u=this.descriptor.flipped):(_=await createImageBitmap(t,{imageOrientation:a?"flipY":"none"}),s(c),g=!0);const r={data:_,width:e,height:i,needsFlip:u,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:n,hasMipmap:p,hasETC:!!h,hasS3TC:!!d},o=await w.compressionWorkerHandle.invoke(r,c.signal,1);if(s(c),o.compressedTexture&&this.hasWebGLTextureObject){const t=this.usedMemory;this._descriptor.internalFormat=o.internalFormat,this._setData(o.compressedTexture),m?.(t-this.usedMemory)}}catch(x){o(x)||f().error("Texture compression failed!")}finally{l?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),g&&_ instanceof ImageBitmap&&_.close()}}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:o,hasMipmap:a,target:n}=this._descriptor;const p=32879===n;if(null==r||null==s||p&&null==o)throw new t("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,o),a&&(1!==r||1!==s||p&&1!==o)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,r=t.samplingMode;9985===i||9987===i?(i=9729,t.hasMipmap||(r=9729)):9984!==i&&9986!==i||(i=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyShadowMode(){const t=this._descriptor,e=t.context?.gl,i=t.compareEnabled?e.COMPARE_REF_TO_TEXTURE:e.NONE;e.texParameteri(t.target,e.TEXTURE_COMPARE_MODE,i),t.compareEnabled&&e.texParameteri(t.target,e.TEXTURE_COMPARE_FUNC,e.GREATER),a(e)}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}}export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../core/Error.js";import e from"../../core/Logger.js";import{hasValue as r}from"../../core/object.js";import{PixelType as n,SizedPixelFormat as o,SizedDepthStencilFormat as i,SizedDepthFormat as u,CompressedTextureFormat as a,sizedPixelFormatValues as l}from"./enums.js";const c=()=>e.getLogger("esri/views/webgl/textureUtils");function s(t){const{width:e,height:r,depth:n}=t;(null!=e&&e<0||null!=r&&r<0||null!=n&&n<0)&&c().error("Negative dimension parameters are not allowed!");const{internalFormat:o}=t;if(o&&(
|
|
2
|
+
import t from"../../core/Error.js";import e from"../../core/Logger.js";import{hasValue as r}from"../../core/object.js";import{PixelType as n,SizedPixelFormat as o,SizedDepthStencilFormat as i,SizedDepthFormat as u,CompressedTextureFormat as a,sizedPixelFormatValues as l}from"./enums.js";const c=()=>e.getLogger("esri/views/webgl/textureUtils");function s(t){const{width:e,height:r,depth:n}=t;(null!=e&&e<0||null!=r&&r<0||null!=n&&n<0)&&c().error("Negative dimension parameters are not allowed!");const{internalFormat:o}=t;if(o&&(p(o)||f(o))){const{linearFilterDepth:e,compareEnabled:r,samplingMode:n,hasMipmap:o}=t;o&&c().error("Depth textures cannot have mipmaps"),e?9729!==n&&9728!==n&&c().error("Depth textures cannot sample mipmaps"):(9728!==n&&c().error("Depth textures without filtering must use NEAREST filtering"),r&&c().error("Depth textures without filtering cannot use compare function"))}}function h(t){return m(t)||p(t)||f(t)}function m(t){return l.includes(t)}function p(t){return r(u,t)}function f(t){return r(i,t)}function d(t){return null!=t&&r(a,t)}function g(t){return null!=t&&"type"in t&&"compressed"===t.type}function w(t){return null!=t&&"byteLength"in t}function x(t){return null!=t&&!g(t)&&!w(t)}function F(t){return 32879===t||35866===t}function E(t,e,r,n=1){let o=Math.max(e,r);return 32879===t&&(o=Math.max(o,n)),Math.floor(Math.log2(o))+1}function T(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case n.FLOAT:switch(e.pixelFormat){case 6408:return o.RGBA32F;case 6407:return o.RGB32F;default:throw new t("texture:unknown-format","Unable to derive format")}case n.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return o.RGBA8;case 6407:return o.RGB8}}const{pixelFormat:r}=e;return e.internalFormat=34041===r?i.DEPTH24_STENCIL8:6402===r?u.DEPTH_COMPONENT24:r,e.internalFormat}function D(t){let e="width"in t?t.width:t.codedWidth,r="height"in t?t.height:t.codedHeight;const n=1;return t instanceof HTMLVideoElement&&(e=t.videoWidth,r=t.videoHeight),{width:e,height:r,depth:n}}export{E as calcMipmapLevels,T as deriveInternalFormat,D as getDimensions,F as is3DTarget,w as isArrayBufferView,g as isCompressedData,d as isCompressedFormat,m as isSizedColorFormat,p as isSizedDepthFormat,f as isSizedDepthStencilFormat,h as isSizedPixelFormat,x as isTexImageSource,s as validateTexture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const e="esri-batch-attribute-form",t=`${e}__group`,i=`${e}__input`,n={base:e,form:`${e}__form`,formHeader:`${e}__form-header`,noticeError:`${e}__notice-error`,label:`${e}__label`,labelTextContent:`${e}__label-text-content`,fieldInput:`${i}`,textElementInput:`${e}__text-element-input`,relationshipElementInput:`${e}__relationship-element-input`,inputRadio:`${i}--radio`,placeholderRadio:`${i}--radio-placeholder`,inputRadioGroup:`${i}--radio-group`,inputRadioLabel:`${i}--radio-label`,inputDisabled:`${i}--disabled`,inputSwitch:`${i}--switch`,centeredButton:`${e}__centered-button`,description:`${e}__description-text`,dateInputContainer:`${`${e}__date`}-input-container`,block:`${e}__block`,group:t,groupSequential:`${t}--sequential`,individualElement:`${t}__individual-element`};export{n as css};
|
|
2
|
+
const e="esri-batch-attribute-form",t=`${e}__group`,i=`${e}__input`,n={base:e,form:`${e}__form`,formHeader:`${e}__form-header`,noticeError:`${e}__notice-error`,label:`${e}__label`,labelTextContent:`${e}__label-text-content`,fieldInput:`${i}`,textElementInput:`${e}__text-element-input`,relationshipElementInput:`${e}__relationship-element-input`,utilityNetworkAssociationsElementInput:`${e}__utility-network-associations-element-input`,inputRadio:`${i}--radio`,placeholderRadio:`${i}--radio-placeholder`,inputRadioGroup:`${i}--radio-group`,inputRadioLabel:`${i}--radio-label`,inputDisabled:`${i}--disabled`,inputSwitch:`${i}--switch`,centeredButton:`${e}__centered-button`,description:`${e}__description-text`,dateInputContainer:`${`${e}__date`}-input-container`,block:`${e}__block`,group:t,groupSequential:`${t}--sequential`,individualElement:`${t}__individual-element`};export{n as css};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type Graphic from "../../../Graphic.js";
|
|
2
|
+
import type UtilityNetworkAssociationType from "../../../popup/support/UtilityNetworkAssociationType.js";
|
|
3
|
+
import type EditableInput from "./EditableInput.js";
|
|
4
|
+
import type GroupInput from "./GroupInput.js";
|
|
5
|
+
import type { AttributeFormSupportedLayerUnion } from "../types.js";
|
|
6
|
+
import type { EditableInputProperties } from "./EditableInput.js";
|
|
7
|
+
|
|
8
|
+
/** @since 5.1 */
|
|
9
|
+
export interface UtilityNetworkAssociationsElementInputProperties extends EditableInputProperties {}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This is a read-only support class that represents a utility network [associations element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/UtilityNetworkAssociationsElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
|
|
13
|
+
*
|
|
14
|
+
* @since 5.1
|
|
15
|
+
* @see [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/)
|
|
16
|
+
* @see [BatchAttributeFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/)
|
|
17
|
+
* @see [BatchFormInputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/BatchFormInputs/)
|
|
18
|
+
*/
|
|
19
|
+
export default class UtilityNetworkAssociationsElementInput extends EditableInput<any> {
|
|
20
|
+
constructor(properties: UtilityNetworkAssociationsElementInputProperties);
|
|
21
|
+
/**
|
|
22
|
+
* Association types represented by this input.
|
|
23
|
+
*
|
|
24
|
+
* @since 5.1
|
|
25
|
+
*/
|
|
26
|
+
get associationTypes(): UtilityNetworkAssociationType[];
|
|
27
|
+
/**
|
|
28
|
+
* The single feature associated with this utility network associations element.
|
|
29
|
+
*
|
|
30
|
+
* @since 5.1
|
|
31
|
+
* @see [BatchAttributeFormViewModel.features](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#features)
|
|
32
|
+
*/
|
|
33
|
+
get feature(): Graphic | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The group containing this input.
|
|
36
|
+
*
|
|
37
|
+
* @since 5.1
|
|
38
|
+
*/
|
|
39
|
+
get group(): GroupInput | null;
|
|
40
|
+
/**
|
|
41
|
+
* Identifies the single feature layer associated with this utility network associations element. The layer must support feature editing and field access.
|
|
42
|
+
*
|
|
43
|
+
* The following layer types are supported:
|
|
44
|
+
* - [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
|
|
45
|
+
* - [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/)
|
|
46
|
+
* - [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) (with `featureLayer` property)
|
|
47
|
+
* - [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/)
|
|
48
|
+
* - [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/)
|
|
49
|
+
* - [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/)
|
|
50
|
+
*
|
|
51
|
+
* @since 5.1
|
|
52
|
+
* @see [BatchAttributeFormViewModel.layers](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#layers)
|
|
53
|
+
*/
|
|
54
|
+
get layer(): AttributeFormSupportedLayerUnion | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The type of input.
|
|
57
|
+
*
|
|
58
|
+
* @since 5.1
|
|
59
|
+
*/
|
|
60
|
+
get type(): "utilityNetworkAssociations";
|
|
61
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../../core/accessorSupport/decorators.js";import r from"./EditableInput.js";import s from"./SingleFeatureInputAdapter.js";let i=class extends r{constructor(t){super(t),this.group=null,this.single=new s({input:this}),this.type="utilityNetworkAssociations"}get associationTypes(){return this.template.associationTypes}get feature(){return this.single.feature}get layer(){return this.single.layer}};t([e()],i.prototype,"associationTypes",null),t([e()],i.prototype,"feature",null),t([e()],i.prototype,"group",void 0),t([e()],i.prototype,"layer",null),t([e({readOnly:!0})],i.prototype,"single",void 0),t([e({readOnly:!0})],i.prototype,"type",void 0),i=t([o("esri.widgets.BatchAttributeForm.inputs.UtilityNetworkAssociationsElementInput")],i);const p=i;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import t from"../BatchFormInputs.js";import r from"../FieldInput.js";import s from"../GroupInput.js";import n from"../RelationshipElementInput.js";import
|
|
2
|
+
import e from"../../../../core/Error.js";import t from"../BatchFormInputs.js";import r from"../FieldInput.js";import s from"../GroupInput.js";import n from"../RelationshipElementInput.js";import o from"../TextElementInput.js";import p from"../UtilityNetworkAssociationsElementInput.js";import{isAttachmentElementTemplate as a,isFieldElementTemplate as i,isGroupElementTemplate as m,isRelationshipElementTemplate as l,isTextElementTemplate as u,isUtilityNetworkAssociationsElementTemplate as f}from"../../templates/support/templateUtils.js";function x(e,r,s){const n=e.elements.filter(e=>!a(e)).map(e=>I(e,r,s));return new t({inputs:n,template:e})}function I(t,a,x){const w=new Set(t.layers),c=a.filter(e=>w.has(e.layer)),y=c.length===a.length;if(i(t))return new r({existsInAllLayers:y,features:c,template:t,expressionsManager:x});if(m(t)){const e=t.elements.map(e=>I(e,a,x));return new s({existsInAllLayers:y,features:c,inputs:e,template:t,expressionsManager:x})}if(l(t))return new n({existsInAllLayers:y,features:c,template:t,expressionsManager:x});if(u(t))return new o({existsInAllLayers:y,features:c,template:t,expressionsManager:x});if(f(t))return new p({existsInAllLayers:y,features:c,template:t,expressionsManager:x});throw new e("batch-attribute-form:unsupported-element-template","The type of form element template provided is not supported")}export{x as createBatchFormInputsFromBatchFormTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const t="esri_BatchAttributeForm_different_values";function
|
|
2
|
+
const t="esri_BatchAttributeForm_different_values";function n(t){return"visible"===t}function e(t){return"field"===t.type}function r(t){return"group"===t.type}function o(t){return"relationship"===t.type}function u(t){return"text"===t.type}function i(t){return"utilityNetworkAssociations"===t.type}function s(t){const n=`${t.elementId}:${t.executorPurpose}`;return null!=t.textExpressionIndex?`${n}:${t.textExpressionIndex}`:n}const c=t=>null!=t&&(p(t,"combo-box")||p(t,"radio-buttons"));function p(t,n){return t?.type===n}export{t as differentValuesString,e as isFieldInput,c as isFieldInputWithShowNoValueOptionInput,r as isGroupInput,p as isInputWithInputType,o as isRelationshipElementInput,u as isTextElementInput,i as isUtilityNetworkAssociationsElementInput,s as makeUseId,n as visibilityCodeToBoolean};
|
|
@@ -2,17 +2,22 @@ import type FieldInput from "./FieldInput.js";
|
|
|
2
2
|
import type GroupInput from "./GroupInput.js";
|
|
3
3
|
import type RelationshipElementInput from "./RelationshipElementInput.js";
|
|
4
4
|
import type TextElementInput from "./TextElementInput.js";
|
|
5
|
+
import type UtilityNetworkAssociationsElementInput from "./UtilityNetworkAssociationsElementInput.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Input types that can be nested within a [group input](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/GroupInput/). This includes
|
|
9
|
+
* [field inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/FieldInput/),
|
|
10
|
+
* [relationship element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/RelationshipElementInput/),
|
|
11
|
+
* [utility network associations element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput/), and
|
|
12
|
+
* [text element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/TextElementInput/). Group inputs may not be nested within other group inputs.
|
|
8
13
|
*
|
|
9
14
|
* @since 5.0
|
|
10
15
|
*/
|
|
11
|
-
export type GroupableInput = FieldInput | RelationshipElementInput | TextElementInput;
|
|
16
|
+
export type GroupableInput = FieldInput | RelationshipElementInput | TextElementInput | UtilityNetworkAssociationsElementInput;
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
19
|
+
* Input types that are supported by [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
|
|
15
20
|
*
|
|
16
21
|
* @since 5.0
|
|
17
22
|
*/
|
|
18
|
-
export type FormInput = GroupInput | FieldInput | RelationshipElementInput | TextElementInput;
|
|
23
|
+
export type FormInput = GroupInput | FieldInput | RelationshipElementInput | TextElementInput | UtilityNetworkAssociationsElementInput;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../core/accessorSupport/decorators.js";import{ElementTemplateBase as s}from"./ElementTemplateBase.js";let r=class extends s{constructor(t){super(t),this.associationTypes=null,this.group=null,this.type="utilityNetworkAssociations"}};t([o()],r.prototype,"associationTypes",void 0),t([o({clonable:!1})],r.prototype,"group",void 0),t([o({readOnly:!0})],r.prototype,"type",void 0),r=t([e("esri.widgets.BatchAttributeForm.templates.UtilityNetworkAssociationsElementTemplate")],r);export{r as UtilityNetworkAssociationsElementTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isAttachmentElement as s,isFieldElement as a,isGroupElement as l,isRelationshipElement as m,isTextElement as p}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isAttachmentElement as s,isFieldElement as a,isGroupElement as l,isRelationshipElement as m,isTextElement as d,isUtilityNetworkAssociationsElement as p}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as c,isFieldVisibleByDefault as f}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as u,isSubtypeGroupLayer as x}from"../../../../layers/support/layerUtils.js";import{unknown as y}from"../../../../time/constants.js";import{makeExpressionInfosMap as w,makeExecutorSetForFormElement as E}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as b}from"../AttachmentElementTemplate.js";import h from"../BatchFormTemplate.js";import{FieldElementTemplate as T}from"../FieldElementTemplate.js";import{GroupElementTemplate as v}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as I}from"../RelationshipElementTemplate.js";import{TextElementTemplate as g}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as j}from"../UtilityNetworkAssociationsElementTemplate.js";import{compileTextElementMarkdownToHTML as F}from"./textElementTemplateUtils.js";const P="expression/dea57012-47ca4b55a000-8df62742ed0c",L=e("form-attachment-filename-calculation"),A=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function U(e,t,r=e.formTemplate){return r?.elements&&r.elements.length>0?k(r,e,t):Z(e,t)}async function Z(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(c(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)K(a,e,n)&&i.push(B(a,o));const s=await Promise.all(i);return new h({elements:s,preserveFieldValuesWhenHidden:!0})}function C(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(u(t)||x(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(C(r.elements??[],t))return!0;return!1}async function k(e,t,r){let n=null;C(e.elements??[],t)&&(n=new i({title:"",name:P,expression:"false"}));const o=w(n?[...e.expressionInfos??[],n]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new h(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const i of a){const e=await N(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements,new h(s)}async function H(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){const i=n.get(e.filenameExpression),s=i?await t(i.expression,L):null,a=new b({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:s,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),l=await E({element:e,expressionInfos:n,provider:r});return a.addLayer(o,l),a}async function N(e,t){return s(e)?H(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):a(e)?R(e,t):l(e)?S(e,t):m(e)?V(e,t):d(e)?W(e,t):p(e)?z(e,t):null}async function R(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:m,hint:d,input:p,label:c}=e;if(null==m||!s.has(m))return A().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${c}' does not refer to a valid field`)),null;!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=P),o.subtypeField&&(u(o)||x(o))&&e.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((e=e.clone()).editableExpression=P);const f=new T({description:a,domain:l,field:s.get(m),hint:d,input:p,formTimeZone:i,layerTimeZone:O(o),label:c}),y=await E({element:e,expressionInfos:n,provider:t});return f.addLayer(o,y),f}async function S(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await N(p,t);e&&l.push(e)}const m=new v({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await E({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function V(e,t){const{description:r,label:n}=e,{arcadeExecutorProvider:o,expressionInfos:i,layer:s}=t,a=new I({description:r,label:n}),l=await E({element:e,expressionInfos:i,provider:o});return a.addLayer(s,l),a}async function W(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await F(s):s,d=new g({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await E({element:e,expressionInfos:r,provider:t}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function z(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,layer:a}=t,l=new j({associationTypes:r,description:n,label:o}),m=await E({element:e,expressionInfos:s,provider:i});return l.addLayer(a,m),l}async function B(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new T({field:e,label:i,formTimeZone:n,layerTimeZone:O(r)}),a={},l=(x(r)||u(r))&&r.subtypeField&&r.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(r,a),s}function K(e,t,r){return!r.has(e.name.toLowerCase())&&f(e,t)}function O(e){return u(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?y:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{U as createBatchFormTemplate,Z as createBatchFormTemplateFromFields};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as
|
|
2
|
+
import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as o,isDateTimePickerInput as r,isDateTimeOffsetPickerInput as $,isSwitchInput as u,isTextAreaInput as c,isTextBoxInput as l,isTimePickerInput as a,isMultipleChoiceInput as s}from"../../../../form/elements/inputs/inputUtils.js";import{isFieldElementTemplate as m,isGroupElementTemplate as f,isRelationshipElementTemplate as p,isTextElementTemplate as g,isAttachmentElementTemplate as S,isUtilityNetworkAssociationsElementTemplate as d,isExcludedFromSharedForm as h}from"./templateUtils.js";const y="",O="num:";function x(n){return m(n)?t(N(n)).toString():f(n)?t(b(n)).toString():p(n)?t(C(n)).toString():g(n)?t(V(n)).toString():S(n)?t(J(n)).toString():d(n)?t(T(n)).toString():t(JSON.stringify(n)).toString()}function N(t){return`${j(t)}.${U(t.field)}.${F(t.domain)}.${t.hint??y}.${v(t.input)}.${t.layerTimeZone??""}`}function b(t){const n=j(t)+`.${t.initialState}`;let e=y;for(const i of t.elements)h(i)||(e+="."+x(i).toString());return`${n}${e}`}function C(t){return`${j(t)}`}function V(t){const n=j(t),{compiledText:e}=t;return`${n}.${e??y}`}function J(t){return`${j(t)}.${t.allowUserRename}.${t.attachmentKeyword??y}.${t.displayFilename}.${w(t.input)}.${t.maxAttachmentCount??y}.${t.minAttachmentCount??y}.${t.useOriginalFilename}`}function T(t){return`${j(t)}.${A(t.associationTypes)}`}function j(t){return`${t.label??y}.${t.description??y}`}function v(t){if(!t)return y;const{type:m}=t;if(n(t))return m??y;if(e(t)||i(t)){const{showNoValueOption:n}=t;return`${m}.${n}.${t.noValueOptionLabel??y}`}if(o(t))return`${m}.${L(t)}`;if(r(t)){const n=t.min?.getTime(),e=t.max?.getTime(),{includeTime:i}=t;return`${m}.${n}.${e}.${i}`}if($(t)){const n=L(t),{includeTimeOffset:e,timeResolution:i}=t;return`${m}.${n}.${e}.${i}`}if(u(t)){const{offValue:n,onValue:e}=t;return`${m}.${K(n)}.${K(e)}`}if(c(t)||l(t)){return`${m}.${t.minLength?.toString()??y}.${t.maxLength?.toString()??y}`}if(a(t)){const n=L(t),{timeResolution:e}=t;return`${m}.${n}.${e}`}if(s(t)){return`${m}.${L({min:t.minSelectedChoices?.toString(),max:t.maxSelectedChoices?.toString()})}.${t.choiceDelimiter??y}.${t.includeSelectAllChoices}.${t.otherChoice?.fieldName??y}.${t.otherChoice?.label??y}.${t.otherChoice?.hint??y}.${R(t)}`}return JSON.stringify(t)}function w(t){return t?JSON.stringify(t.toJSON()):y}function A(t){return t.map(t=>JSON.stringify(t.toJSON())).sort().join(".")}function L(t){return`${t.min??y}.${t.max??y}`}function R(t){return(t.choices??[]).map(({label:t,value:n})=>`${t}.${n}`).sort().join(".")}function U(t){const n=t.name,e=t.alias??y;return`${n}.${e===n?y:e}.${t.nullable}.${t.type}.${t.length??y}.${t.defaultValue??y}.${t.description??y}.${t.editable}.${t.visible}`}function F(t){return t?"coded-value"===t.type?D(t):"range"===t.type?Z(t):JSON.stringify(t):y}function D(t){const{type:n}=t;return`${n}.${t.codedValues.map(({code:t,name:n})=>`${K(t)}.${n}`).sort().join(".")}`}function K(t){return"number"==typeof t?`${O}${t}`:t}function Z(t){const{maxValue:n,minValue:e,type:i}=t;return`${i}.${e}.${n}`}export{x as hashElementTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
function t(t){return"attachment"===t.type}function n(t){return"field"===t.type}function e(t){return"group"===t.type}function r(t){return"relationship"===t.type}function u(t){return"text"===t.type}function i(n){return u(n)||t(n)||r(n)}export{t as isAttachmentElementTemplate,
|
|
2
|
+
function t(t){return"attachment"===t.type}function n(t){return"field"===t.type}function e(t){return"group"===t.type}function r(t){return"relationship"===t.type}function u(t){return"text"===t.type}function i(t){return"utilityNetworkAssociations"===t.type}function o(n){return u(n)||t(n)||r(n)||i(n)}export{t as isAttachmentElementTemplate,o as isExcludedFromSharedForm,n as isFieldElementTemplate,e as isGroupElementTemplate,r as isRelationshipElementTemplate,u as isTextElementTemplate,i as isUtilityNetworkAssociationsElementTemplate};
|