rhodonite 0.25.0 → 0.26.0
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/README.md +93 -19
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.js +1 -1
- package/dist/esm/foundation/components/Camera/CameraComponent.d.ts +34 -0
- package/dist/esm/foundation/components/Camera/CameraComponent.js +1 -1
- package/dist/esm/foundation/components/Light/LightComponent.d.ts +3 -1
- package/dist/esm/foundation/components/Light/LightComponent.js +1 -1
- package/dist/esm/foundation/components/Mesh/MeshComponent.js +1 -1
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.js +1 -1
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.js +1 -1
- package/dist/esm/foundation/components/Shape/ShapeComponent.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +1 -1
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.js +1 -1
- package/dist/esm/foundation/components/Transform/TransformComponent.js +1 -1
- package/dist/esm/foundation/components/Trigger/TriggerComponent.js +1 -1
- package/dist/esm/foundation/components/Vrm/VrmComponent.js +1 -1
- package/dist/esm/foundation/constraints/VrmAimConstraint.js +1 -1
- package/dist/esm/foundation/constraints/VrmRollConstraint.js +1 -1
- package/dist/esm/foundation/constraints/VrmRotationConstraint.js +1 -1
- package/dist/esm/foundation/core/Component.js +1 -1
- package/dist/esm/foundation/core/ComponentRepository.js +1 -1
- package/dist/esm/foundation/core/Entity.js +1 -1
- package/dist/esm/foundation/core/EntityRepository.js +1 -1
- package/dist/esm/foundation/geometry/ComplexVertexAttribute.js +1 -1
- package/dist/esm/foundation/geometry/Mesh.js +1 -1
- package/dist/esm/foundation/geometry/Primitive.js +1 -1
- package/dist/esm/foundation/gizmos/AABBGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/CapsuleColliderGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/Gizmo.d.ts +13 -0
- package/dist/esm/foundation/gizmos/Gizmo.js +1 -1
- package/dist/esm/foundation/gizmos/JointGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/LightGizmo.d.ts +0 -1
- package/dist/esm/foundation/gizmos/LightGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/LocatorGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/RotationGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/ScaleGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/ShapeGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/SphereColliderGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/TranslationGizmo.js +1 -1
- package/dist/esm/foundation/helpers/BloomHelper.js +1 -1
- package/dist/esm/foundation/helpers/GaussianBlurHelper.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/PointShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
- package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
- package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.js +1 -0
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.js +1 -0
- package/dist/esm/foundation/importer/AnimationAssigner.js +1 -1
- package/dist/esm/foundation/importer/DrcPointCloudImporter.js +1 -1
- package/dist/esm/foundation/importer/Gltf2Importer.js +1 -1
- package/dist/esm/foundation/importer/GltfImporter.js +1 -1
- package/dist/esm/foundation/importer/ModelConverter.js +1 -1
- package/dist/esm/foundation/importer/RhodoniteImportExtension.js +1 -1
- package/dist/esm/foundation/importer/Vrm0xImporter.js +1 -1
- package/dist/esm/foundation/importer/VrmImporter.js +1 -1
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/MToon0xMaterialContent.js +18 -18
- package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +6 -6
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/core/ShaderityUtilityWebGL.js +2 -2
- package/dist/esm/foundation/materials/core/ShaderityUtilityWebGPU.js +2 -2
- package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/MergeVectorShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_HashPRNGShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_SinHashShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.js +1 -1
- package/dist/esm/foundation/math/MathClassUtil.js +1 -1
- package/dist/esm/foundation/math/Quaternion.js +1 -1
- package/dist/esm/foundation/math/Transform3D.js +1 -1
- package/dist/esm/foundation/math/shapes/MathSphere.js +1 -1
- package/dist/esm/foundation/memory/Accessor.js +6 -6
- package/dist/esm/foundation/memory/BufferView.js +1 -1
- package/dist/esm/foundation/misc/cache/Cache.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/CapsuleCollider.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/SphereCollider.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/VRMSpringBone.js +1 -1
- package/dist/esm/foundation/renderer/Frame.js +1 -1
- package/dist/esm/foundation/renderer/RenderPass.js +1 -1
- package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
- package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +1 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.js +1 -0
- package/dist/esm/foundation/renderer/pipelines/DeferredRenderPipeline.js +1 -1
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +62 -16
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
- package/dist/esm/foundation/system/Engine.d.ts +37 -3
- package/dist/esm/foundation/system/Engine.js +1 -1
- package/dist/esm/foundation/textures/AbstractTexture.js +1 -1
- package/dist/esm/foundation/textures/CubeTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
- package/dist/esm/foundation/textures/Texture.js +1 -1
- package/dist/esm/foundation/textures/TextureDataFloat.js +1 -1
- package/dist/esm/foundation/textures/VideoTexture.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/webgl/MultiDraw.js +1 -1
- package/dist/esm/webgl/MultiDrawRepository.js +1 -1
- package/dist/esm/webgl/WebGLStereoUtil.js +1 -1
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +8 -0
- package/dist/esm/webgl/WebGLStrategyWebGL2.js +47 -28
- package/dist/esm/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +0 -3
- package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +35 -0
- package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +140 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +175 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +18 -0
- package/dist/esm/webgl/shaders/StandardShaderPart.js +3 -3
- package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +5 -5
- package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +9 -9
- package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
- package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
- package/dist/esm/webgpu/WebGpuGpuCulling.js +1 -1
- package/dist/esm/webgpu/WebGpuGpuTimer.js +1 -1
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -1
- package/dist/esm/webgpu/WebGpuResourceRepository.js +3 -3
- package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esm/webgpu/WebGpuStrategyBasic.js +78 -59
- package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -1
- package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +30 -0
- package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +133 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +169 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +19 -0
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.js +107 -1
- package/dist/esmdev/foundation/components/Camera/CameraComponent.d.ts +34 -0
- package/dist/esmdev/foundation/components/Camera/CameraComponent.js +118 -46
- package/dist/esmdev/foundation/components/CameraController/CameraControllerComponent.js +8 -8
- package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.js +74 -74
- package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.js +39 -39
- package/dist/esmdev/foundation/components/Constraint/ConstraintComponent.js +4 -4
- package/dist/esmdev/foundation/components/Light/LightComponent.d.ts +3 -1
- package/dist/esmdev/foundation/components/Light/LightComponent.js +126 -121
- package/dist/esmdev/foundation/components/Mesh/MeshComponent.js +50 -50
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.js +96 -92
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.js +73 -73
- package/dist/esmdev/foundation/components/Raymarching/RaymarchingComponent.js +54 -54
- package/dist/esmdev/foundation/components/Raymarching/RaymarchingSdfEvaluator.js +251 -251
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.js +375 -343
- package/dist/esmdev/foundation/components/Shape/ShapeComponent.js +31 -31
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +5 -5
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +5 -5
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +9 -9
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.js +337 -205
- package/dist/esmdev/foundation/components/Transform/TransformComponent.js +93 -93
- package/dist/esmdev/foundation/components/Trigger/TriggerComponent.js +61 -61
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.js +44 -44
- package/dist/esmdev/foundation/constraints/VrmAimConstraint.js +11 -11
- package/dist/esmdev/foundation/constraints/VrmRollConstraint.js +16 -16
- package/dist/esmdev/foundation/constraints/VrmRotationConstraint.js +10 -10
- package/dist/esmdev/foundation/core/Component.js +32 -32
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.js +42 -42
- package/dist/esmdev/foundation/core/ComponentRepository.js +37 -37
- package/dist/esmdev/foundation/core/Config.js +9 -9
- package/dist/esmdev/foundation/core/Entity.js +9 -9
- package/dist/esmdev/foundation/core/EntityRepository.js +19 -19
- package/dist/esmdev/foundation/core/GlobalDataRepository.js +17 -17
- package/dist/esmdev/foundation/core/MemoryManager.js +25 -25
- package/dist/esmdev/foundation/core/RnObject.js +37 -37
- package/dist/esmdev/foundation/definitions/Blend.js +3 -3
- package/dist/esmdev/foundation/definitions/ComponentType.js +7 -7
- package/dist/esmdev/foundation/definitions/CompositionType.js +50 -50
- package/dist/esmdev/foundation/definitions/CompressionTextureType.js +6 -6
- package/dist/esmdev/foundation/definitions/ShaderSemantics.js +6 -6
- package/dist/esmdev/foundation/definitions/TextureFormat.js +3 -3
- package/dist/esmdev/foundation/definitions/TextureParameter.js +3 -3
- package/dist/esmdev/foundation/definitions/VertexAttribute.js +30 -30
- package/dist/esmdev/foundation/enhanced_js_objects/Array.js +2 -2
- package/dist/esmdev/foundation/exporter/Gltf2Exporter.js +112 -112
- package/dist/esmdev/foundation/geometry/ComplexVertexAttribute.js +24 -24
- package/dist/esmdev/foundation/geometry/Frustum.js +41 -41
- package/dist/esmdev/foundation/geometry/Mesh.js +218 -218
- package/dist/esmdev/foundation/geometry/Primitive.js +133 -133
- package/dist/esmdev/foundation/geometry/SimpleVertexAttribute.js +7 -7
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.js +3 -3
- package/dist/esmdev/foundation/geometry/shapes/Joint.js +33 -33
- package/dist/esmdev/foundation/gizmos/AABBGizmo.js +17 -20
- package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +24 -26
- package/dist/esmdev/foundation/gizmos/Gizmo.d.ts +13 -0
- package/dist/esmdev/foundation/gizmos/Gizmo.js +43 -21
- package/dist/esmdev/foundation/gizmos/JointGizmo.js +38 -40
- package/dist/esmdev/foundation/gizmos/LightGizmo.d.ts +0 -1
- package/dist/esmdev/foundation/gizmos/LightGizmo.js +26 -30
- package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +26 -29
- package/dist/esmdev/foundation/gizmos/RotationGizmo.js +217 -219
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +135 -137
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +44 -47
- package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +25 -27
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +132 -134
- package/dist/esmdev/foundation/helpers/BloomHelper.js +34 -34
- package/dist/esmdev/foundation/helpers/GaussianBlurHelper.js +18 -18
- package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.js +12 -12
- package/dist/esmdev/foundation/helpers/Shadow/ShadowMap.js +5 -5
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +119 -119
- package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
- package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.js +61 -0
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.js +127 -0
- package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
- package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +33 -33
- package/dist/esmdev/foundation/importer/Gltf2Importer.js +14 -14
- package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
- package/dist/esmdev/foundation/importer/ModelConverter.js +131 -131
- package/dist/esmdev/foundation/importer/RhodoniteImportExtension.js +6 -6
- package/dist/esmdev/foundation/importer/Vrm0xImporter.js +48 -48
- package/dist/esmdev/foundation/importer/VrmImporter.js +10 -10
- package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.js +27 -27
- package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
- package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +138 -138
- package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +19 -19
- package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +68 -53
- package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +26 -26
- package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
- package/dist/esmdev/foundation/materials/core/Material.js +115 -115
- package/dist/esmdev/foundation/materials/core/MaterialRepository.js +65 -65
- package/dist/esmdev/foundation/materials/core/ShaderGraphResolver.js +38 -38
- package/dist/esmdev/foundation/materials/core/ShaderHandler.js +4 -4
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGL.js +16 -17
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +17 -18
- package/dist/esmdev/foundation/materials/nodes/AbsShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/AcosShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/AddShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/AlphaTestShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/AndShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/Atan2ShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/AttributeColorShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeInstanceIdsShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeJointShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeNormalShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributePositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/AttributeTangentShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeTexcoordShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/AttributeWeightShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/BlockBeginShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/BlockEndShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/BranchShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/CalcBitangentShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/ClassicShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/ConstantScalarVariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVariableShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/ConstantVector2VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVector3VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVector4VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/CosShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/DiscardShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/FlatShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/GreaterShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/MergeVectorShaderNode.js +19 -19
- package/dist/esmdev/foundation/materials/nodes/MinShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/NormalMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.js +9 -9
- package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/OrShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/OutColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/OutPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyPropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyRotationShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/PbrBaseColorPropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrClearcoatPropsShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/PbrDiffuseTransmissionPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrEmissivePropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrIridescencePropsShaderNode.js +8 -8
- package/dist/esmdev/foundation/materials/nodes/PbrMetallicRoughnessPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrNormalPropsShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/PbrOcclusionPropsShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/PbrShaderShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/PbrSheenPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrSpecularPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrTransmissionPropsShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/PbrVolumePropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/ProcessGeometryShaderNode.js +22 -22
- package/dist/esmdev/foundation/materials/nodes/ProjectionMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/Random_HashPRNGShaderNode.js +12 -12
- package/dist/esmdev/foundation/materials/nodes/Random_SinHashShaderNode.js +12 -12
- package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/SinShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/StepShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/TanShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/Texture2DShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/TimeShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/UniformDataShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/ViewMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/WireframeMaterialNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/WorldMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendXYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendXZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendYXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendYZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendZXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendZYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/InitialPositionShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothIntersectionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothSubtractionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothUnionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSubtractionShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpUnionShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutDistanceShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutShadingColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutUnionShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchCameraPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitDistanceShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitNormalShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdUniformShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchRayDirectionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchTBNShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchViewDirectionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyTransformShaderNode.js +9 -9
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyWorldMatrixShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarXShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarYShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarZShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBoxShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdCapsuleShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRoundBoxShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdSphereShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTorusShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeXShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeYShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeZShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistZShaderNode.js +4 -4
- package/dist/esmdev/foundation/math/AABB.js +132 -132
- package/dist/esmdev/foundation/math/AnimatedQuaternion.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedScalar.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.js +20 -20
- package/dist/esmdev/foundation/math/AnimatedVector2.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVector3.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVector4.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVectorN.js +55 -55
- package/dist/esmdev/foundation/math/IdentityMatrix33.js +2 -2
- package/dist/esmdev/foundation/math/IdentityMatrix44.js +2 -2
- package/dist/esmdev/foundation/math/MathClassUtil.js +4 -4
- package/dist/esmdev/foundation/math/Quaternion.js +20 -20
- package/dist/esmdev/foundation/math/Transform3D.js +83 -83
- package/dist/esmdev/foundation/math/shapes/MathSphere.js +9 -9
- package/dist/esmdev/foundation/memory/Accessor.js +370 -370
- package/dist/esmdev/foundation/memory/Buffer.js +40 -40
- package/dist/esmdev/foundation/memory/BufferView.js +33 -33
- package/dist/esmdev/foundation/misc/DataUtil.js +2 -2
- package/dist/esmdev/foundation/misc/EnumIO.js +10 -10
- package/dist/esmdev/foundation/misc/Logger.js +14 -14
- package/dist/esmdev/foundation/misc/RnPromise.js +14 -14
- package/dist/esmdev/foundation/misc/Time.js +27 -27
- package/dist/esmdev/foundation/misc/WeakOption.js +14 -14
- package/dist/esmdev/foundation/misc/cache/Cache.js +2 -2
- package/dist/esmdev/foundation/misc/cache/SymbolWeakMap.js +8 -8
- package/dist/esmdev/foundation/physics/PhysicsWorldQuery.js +13 -13
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +203 -203
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +241 -241
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
- package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +42 -42
- package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +27 -27
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +10 -10
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +51 -51
- package/dist/esmdev/foundation/renderer/Expression.js +6 -6
- package/dist/esmdev/foundation/renderer/Frame.js +12 -12
- package/dist/esmdev/foundation/renderer/FrameBuffer.js +25 -25
- package/dist/esmdev/foundation/renderer/RenderPass.js +102 -99
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +66 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +275 -0
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +153 -153
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
- package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +6 -6
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +62 -16
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +535 -428
- package/dist/esmdev/foundation/system/Engine.d.ts +37 -3
- package/dist/esmdev/foundation/system/Engine.js +266 -224
- package/dist/esmdev/foundation/system/EventPubSub.js +8 -8
- package/dist/esmdev/foundation/system/InputManager.js +56 -56
- package/dist/esmdev/foundation/system/ModuleManager.js +6 -6
- package/dist/esmdev/foundation/textures/AbstractTexture.js +50 -50
- package/dist/esmdev/foundation/textures/CubeTexture.js +32 -32
- package/dist/esmdev/foundation/textures/RenderBuffer.js +11 -11
- package/dist/esmdev/foundation/textures/RenderTargetTexture.js +25 -25
- package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +37 -37
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +19 -19
- package/dist/esmdev/foundation/textures/Sampler.js +24 -24
- package/dist/esmdev/foundation/textures/Texture.js +83 -83
- package/dist/esmdev/foundation/textures/TextureArray.js +8 -8
- package/dist/esmdev/foundation/textures/TextureDataFloat.js +26 -26
- package/dist/esmdev/foundation/textures/VideoTexture.js +24 -24
- package/dist/esmdev/version.js +2 -2
- package/dist/esmdev/webgl/InstanceSidTable.js +62 -62
- package/dist/esmdev/webgl/MultiDraw.js +2 -2
- package/dist/esmdev/webgl/MultiDrawRepository.js +30 -30
- package/dist/esmdev/webgl/WebGLContextWrapper.js +164 -164
- package/dist/esmdev/webgl/WebGLGpuTimer.js +32 -32
- package/dist/esmdev/webgl/WebGLResourceRepository.js +306 -306
- package/dist/esmdev/webgl/WebGLStereoUtil.js +42 -42
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +8 -0
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +296 -261
- package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +4 -4
- package/dist/esmdev/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +12 -0
- package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.js +4 -4
- package/dist/esmdev/webgl/shaders/RaymarchingShadowShaderPart.js +14 -14
- package/dist/esmdev/webgl/shaders/StandardShaderPart.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/BlockBeginShader.js +10 -10
- package/dist/esmdev/webgl/shaders/nodes/BlockEndShader.js +10 -10
- package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.js +21 -21
- package/dist/esmdev/webgl/shaders/nodes/DiscardShader.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/EndShader.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/OutDistance.js +12 -12
- package/dist/esmdev/webgl/shaders/nodes/OutUnion.js +9 -9
- package/dist/esmdev/webgl/shaders/nodes/RaymarchObjectIdUniform.js +8 -8
- package/dist/esmdev/webgl/shaders/nodes/SdApplyTransform.js +9 -9
- package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.js +8 -8
- package/dist/esmdev/webgl/shaders/nodes/Texture2DShader.js +23 -23
- package/dist/esmdev/webgl/shaders/nodes/UniformDataShader.js +23 -23
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.js +27 -27
- package/dist/esmdev/webgpu/GpuCullingRegistry.js +94 -94
- package/dist/esmdev/webgpu/GpuDeformRegistry.js +53 -53
- package/dist/esmdev/webgpu/RangeAllocator.js +16 -16
- package/dist/esmdev/webgpu/WebGpuBufferArena.js +21 -21
- package/dist/esmdev/webgpu/WebGpuDeviceWrapper.js +7 -7
- package/dist/esmdev/webgpu/WebGpuGpuCulling.js +198 -198
- package/dist/esmdev/webgpu/WebGpuGpuTimer.js +52 -52
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +37 -37
- package/dist/esmdev/webgpu/WebGpuResourceRepository.js +597 -597
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +170 -133
- package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +128 -128
- package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +12 -0
- package/dist/esmdev/xr/WebARSystem.js +69 -69
- package/dist/esmdev/xr/WebXRSystem.js +153 -153
- package/package.json +1 -1
|
@@ -38,36 +38,36 @@ var RENDER_PASS_TARGET_KIND_CANVAS = 3;
|
|
|
38
38
|
var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIResourceRepository {
|
|
39
39
|
constructor() {
|
|
40
40
|
super();
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
41
|
+
this.TH = /* @__PURE__ */ new Map();
|
|
42
|
+
this.WD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
43
|
+
this.eJ = "";
|
|
44
44
|
/** The buffers bound by `__bindGroupStorageBuffer`, used to detect when it must be recreated. */
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
45
|
+
this.DI = [];
|
|
46
|
+
this.EI = /* @__PURE__ */ new Map();
|
|
47
|
+
this.FI = /* @__PURE__ */ new Map();
|
|
48
|
+
this.tI = /* @__PURE__ */ new Map();
|
|
49
|
+
this.hJ = /* @__PURE__ */ new Map();
|
|
50
50
|
/** Group 1 (textures), keyed by layout and bound texture views. */
|
|
51
|
-
this.
|
|
51
|
+
this.GI = /* @__PURE__ */ new Map();
|
|
52
52
|
/** Group 2 (samplers), keyed by layout and bound samplers. */
|
|
53
|
-
this.
|
|
53
|
+
this.HI = /* @__PURE__ */ new Map();
|
|
54
54
|
/** Group 3 (draw parameters), keyed by the parameter values. The uniform buffers are immutable. */
|
|
55
|
-
this.
|
|
55
|
+
this.iJ = /* @__PURE__ */ new Map();
|
|
56
56
|
/**
|
|
57
57
|
* Uniform buffers holding the draw parameters. Each buffer holds many entries at the uniform offset
|
|
58
58
|
* alignment: the browser's GPU process and the driver track every distinct buffer referenced by a
|
|
59
59
|
* frame, so one small buffer per entry costs much more than offsets into a few large buffers.
|
|
60
60
|
*/
|
|
61
|
-
this
|
|
62
|
-
this.
|
|
61
|
+
this.II = [];
|
|
62
|
+
this.JI = 0;
|
|
63
63
|
/** The arguments of the last setDrawParameters() call (without the deformed vertex offset). */
|
|
64
|
-
this.
|
|
64
|
+
this.jJ = [0, 0, 0, 0];
|
|
65
65
|
/** Views created for dummy textures when a texture has no view yet, by texture and dimension. */
|
|
66
|
-
this.
|
|
66
|
+
this.lJ = /* @__PURE__ */ new WeakMap();
|
|
67
67
|
/** Identifiers of GPU objects used to build cache keys. */
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
68
|
+
this.mJ = /* @__PURE__ */ new WeakMap();
|
|
69
|
+
this.OJ = 0;
|
|
70
|
+
this.lI = {
|
|
71
71
|
count: 0,
|
|
72
72
|
slots: [],
|
|
73
73
|
dimensions: [],
|
|
@@ -75,24 +75,24 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
75
75
|
views: [],
|
|
76
76
|
samplers: []
|
|
77
77
|
};
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
78
|
+
this.oJ = [];
|
|
79
|
+
this.pJ = [];
|
|
80
|
+
this.cI = /* @__PURE__ */ new Map();
|
|
81
|
+
this.uI = /* @__PURE__ */ new Map();
|
|
82
82
|
/** Set when the GPU culling recreated its buffers: the render bundles binding them were dropped. */
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
83
|
+
this.PI = false;
|
|
84
|
+
this.oI = -1;
|
|
85
|
+
this.SI = RENDER_PASS_TARGET_KIND_NONE;
|
|
86
|
+
this.TI = [];
|
|
87
87
|
/** Scratch array swapped with `__renderPassEncoderTargetViews` to avoid per-pass allocations. */
|
|
88
|
-
this.
|
|
88
|
+
this.vI = [];
|
|
89
89
|
/** Render bundles waiting to be executed in the open render pass. See __executeRenderBundle(). */
|
|
90
|
-
this.
|
|
90
|
+
this.uJ = [];
|
|
91
91
|
/**
|
|
92
92
|
* The clear of a render pass that draws nothing, not encoded yet. See clearFrameBuffer().
|
|
93
93
|
* The object is reused to keep the per-frame path free of allocations.
|
|
94
94
|
*/
|
|
95
|
-
this.
|
|
95
|
+
this.dI = {
|
|
96
96
|
active: false,
|
|
97
97
|
engine: void 0,
|
|
98
98
|
renderPass: void 0,
|
|
@@ -104,17 +104,17 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
104
104
|
isDepthClear: false,
|
|
105
105
|
clearDepth: 1
|
|
106
106
|
};
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
116
|
-
}
|
|
117
|
-
static
|
|
107
|
+
this.VI = -1;
|
|
108
|
+
this.wJ = -1;
|
|
109
|
+
this.xJ = -1;
|
|
110
|
+
this.yJ = -1;
|
|
111
|
+
this.zJ = -1;
|
|
112
|
+
this.AJ = -1;
|
|
113
|
+
this.qI = /* @__PURE__ */ new Map();
|
|
114
|
+
this.eI = /* @__PURE__ */ new Map();
|
|
115
|
+
this.fI = /* @__PURE__ */ new Map();
|
|
116
|
+
}
|
|
117
|
+
static $H(array) {
|
|
118
118
|
if (!(array.buffer instanceof ArrayBuffer)) {
|
|
119
119
|
throw new Error("SharedArrayBuffer is not supported in this code path.");
|
|
120
120
|
}
|
|
@@ -124,13 +124,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
124
124
|
* This method should be called when resources need to be recreated or when the rendering context changes.
|
|
125
125
|
*/
|
|
126
126
|
clearCache() {
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
129
|
-
this.
|
|
130
|
-
this.
|
|
131
|
-
this.
|
|
132
|
-
this.
|
|
133
|
-
this.
|
|
127
|
+
this.EI.clear();
|
|
128
|
+
this.FI.clear();
|
|
129
|
+
this.GI.clear();
|
|
130
|
+
this.HI.clear();
|
|
131
|
+
this.PH = void 0;
|
|
132
|
+
this.DI.length = 0;
|
|
133
|
+
this.XH();
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Adds a WebGPU device wrapper to the repository and initializes the command encoder.
|
|
@@ -139,9 +139,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
139
139
|
* @param webGpuDeviceWrapper - The WebGPU device wrapper containing the device and context
|
|
140
140
|
*/
|
|
141
141
|
addWebGpuDeviceWrapper(webGpuDeviceWrapper) {
|
|
142
|
-
this.
|
|
143
|
-
this.
|
|
144
|
-
this.
|
|
142
|
+
this.SH = webGpuDeviceWrapper;
|
|
143
|
+
this.qJ = webGpuDeviceWrapper.gpuDevice.queue;
|
|
144
|
+
this.YH = this.SH.gpuDevice.createCommandEncoder();
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* Returns the WebGPU device wrapper instance.
|
|
@@ -150,7 +150,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
150
150
|
* @throws Error if the device wrapper has not been initialized
|
|
151
151
|
*/
|
|
152
152
|
getWebGpuDeviceWrapper() {
|
|
153
|
-
return this.
|
|
153
|
+
return this.SH;
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Returns the singleton instance of WebGpuResourceRepository.
|
|
@@ -167,7 +167,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
167
167
|
* @returns A unique resource handle number
|
|
168
168
|
*/
|
|
169
169
|
getResourceNumber() {
|
|
170
|
-
return ++this.
|
|
170
|
+
return ++this.WD;
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Registers a WebGPU resource and assigns it a unique handle.
|
|
@@ -175,10 +175,10 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
175
175
|
* @param obj - The WebGPU resource to register
|
|
176
176
|
* @returns The unique handle for the registered resource
|
|
177
177
|
*/
|
|
178
|
-
|
|
178
|
+
DD(obj) {
|
|
179
179
|
const handle = this.getResourceNumber();
|
|
180
180
|
obj._resourceUid = handle;
|
|
181
|
-
this.
|
|
181
|
+
this.TH.set(handle, obj);
|
|
182
182
|
return handle;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
@@ -187,7 +187,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
187
187
|
* @returns A tuple containing [width, height] of the canvas
|
|
188
188
|
*/
|
|
189
189
|
getCanvasSize() {
|
|
190
|
-
const canvas = this.
|
|
190
|
+
const canvas = this.SH.canvas;
|
|
191
191
|
return [canvas.width, canvas.height];
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
@@ -212,7 +212,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
212
212
|
height,
|
|
213
213
|
generateMipmap
|
|
214
214
|
}) {
|
|
215
|
-
const textureHandle = await this.
|
|
215
|
+
const textureHandle = await this.BJ(width, height, internalFormat, generateMipmap, imageData);
|
|
216
216
|
return textureHandle;
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
@@ -257,7 +257,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
257
257
|
* @param height - Height of the base texture level
|
|
258
258
|
*/
|
|
259
259
|
generateMipmaps2d(textureHandle, width, height) {
|
|
260
|
-
const gpuTexture = this.
|
|
260
|
+
const gpuTexture = this.TH.get(textureHandle);
|
|
261
261
|
const textureDescriptor = {
|
|
262
262
|
size: [width, height, 1],
|
|
263
263
|
format: gpuTexture.format,
|
|
@@ -275,7 +275,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
275
275
|
* @param height - Height of the base texture level
|
|
276
276
|
*/
|
|
277
277
|
generateMipmapsCube(textureHandle, width, height) {
|
|
278
|
-
const gpuTexture = this.
|
|
278
|
+
const gpuTexture = this.TH.get(textureHandle);
|
|
279
279
|
const textureDescriptor = {
|
|
280
280
|
size: [width, height, 6],
|
|
281
281
|
format: gpuTexture.format,
|
|
@@ -296,9 +296,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
296
296
|
* @returns Promise that resolves to the pixel data as Uint8Array
|
|
297
297
|
*/
|
|
298
298
|
async getTexturePixelData(textureHandle, width, height, _frameBufferUid, _colorAttachmentIndex) {
|
|
299
|
-
const gpuTexture = this.
|
|
299
|
+
const gpuTexture = this.TH.get(textureHandle);
|
|
300
300
|
const textureData = new Uint8Array(width * height * 4);
|
|
301
|
-
const gpuDevice = this.
|
|
301
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
302
302
|
const commandEncoder = gpuDevice.createCommandEncoder();
|
|
303
303
|
const buffer = gpuDevice.createBuffer({
|
|
304
304
|
size: width * height * 4,
|
|
@@ -337,11 +337,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
337
337
|
* @returns Promise resolving to the pixel data as a Uint8Array in RGBA format
|
|
338
338
|
*/
|
|
339
339
|
async getPixelDataFromTextureAsync(textureHandle, _x, _y, width, height) {
|
|
340
|
-
const gpuTexture = this.
|
|
340
|
+
const gpuTexture = this.TH.get(textureHandle);
|
|
341
341
|
if (!gpuTexture) {
|
|
342
342
|
return new Uint8Array(0);
|
|
343
343
|
}
|
|
344
|
-
const gpuDevice = this.
|
|
344
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
345
345
|
const shaderModule = gpuDevice.createShaderModule({
|
|
346
346
|
code: (
|
|
347
347
|
/* wgsl */
|
|
@@ -457,8 +457,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
457
457
|
* @returns Promise resolving to the pixel data as a Uint8Array (RGBA format)
|
|
458
458
|
*/
|
|
459
459
|
async getCubeTexturePixelData(textureHandle, width, height, faceIndex) {
|
|
460
|
-
const gpuTexture = this.
|
|
461
|
-
const gpuDevice = this.
|
|
460
|
+
const gpuTexture = this.TH.get(textureHandle);
|
|
461
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
462
462
|
const textureFormat = gpuTexture.format;
|
|
463
463
|
const isHdrFormat = textureFormat.includes("float") || textureFormat === "rgb10a2unorm";
|
|
464
464
|
const shaderModule = gpuDevice.createShaderModule({
|
|
@@ -615,9 +615,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
615
615
|
* @param textureDescriptor - Descriptor containing texture format and dimensions
|
|
616
616
|
*/
|
|
617
617
|
generateMipmaps(texture, textureDescriptor) {
|
|
618
|
-
const gpuDevice = this.
|
|
619
|
-
if (this.
|
|
620
|
-
this.
|
|
618
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
619
|
+
if (this.xI == null) {
|
|
620
|
+
this.xI = gpuDevice.createShaderModule({
|
|
621
621
|
code: (
|
|
622
622
|
/* wgsl */
|
|
623
623
|
`
|
|
@@ -649,11 +649,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
649
649
|
)
|
|
650
650
|
});
|
|
651
651
|
}
|
|
652
|
-
if (this.
|
|
653
|
-
this.
|
|
652
|
+
if (this.pI != null && textureDescriptor.format !== this.vJ) {
|
|
653
|
+
this.pI = void 0;
|
|
654
654
|
}
|
|
655
|
-
if (this.
|
|
656
|
-
this.
|
|
655
|
+
if (this.pI == null) {
|
|
656
|
+
this.XI = gpuDevice.createBindGroupLayout({
|
|
657
657
|
entries: [
|
|
658
658
|
{
|
|
659
659
|
binding: 0,
|
|
@@ -672,16 +672,16 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
672
672
|
]
|
|
673
673
|
});
|
|
674
674
|
const pipelineLayout = gpuDevice.createPipelineLayout({
|
|
675
|
-
bindGroupLayouts: [this.
|
|
675
|
+
bindGroupLayouts: [this.XI]
|
|
676
676
|
});
|
|
677
|
-
this.
|
|
677
|
+
this.pI = gpuDevice.createRenderPipeline({
|
|
678
678
|
layout: pipelineLayout,
|
|
679
679
|
vertex: {
|
|
680
|
-
module: this.
|
|
680
|
+
module: this.xI,
|
|
681
681
|
entryPoint: "vertexMain"
|
|
682
682
|
},
|
|
683
683
|
fragment: {
|
|
684
|
-
module: this.
|
|
684
|
+
module: this.xI,
|
|
685
685
|
entryPoint: "fragmentMain",
|
|
686
686
|
targets: [
|
|
687
687
|
{
|
|
@@ -694,16 +694,16 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
694
694
|
stripIndexFormat: "uint32"
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
|
-
this.
|
|
697
|
+
this.vJ = textureDescriptor.format;
|
|
698
698
|
}
|
|
699
|
-
if (this.
|
|
700
|
-
this.
|
|
699
|
+
if (this.WI == null) {
|
|
700
|
+
this.WI = gpuDevice.createSampler({ minFilter: "linear" });
|
|
701
701
|
}
|
|
702
|
-
this.
|
|
702
|
+
this.jI();
|
|
703
703
|
const isCubemap = texture.dimension === "2d" && texture.depthOrArrayLayers === 6;
|
|
704
704
|
const layerCount = isCubemap ? 6 : 1;
|
|
705
705
|
for (let layer = 0; layer < layerCount; ++layer) {
|
|
706
|
-
const srcTextureViewsMap = this.
|
|
706
|
+
const srcTextureViewsMap = this.qI.get(texture);
|
|
707
707
|
if (srcTextureViewsMap == null || srcTextureViewsMap[layer] == null) {
|
|
708
708
|
const srcView2 = texture.createView({
|
|
709
709
|
dimension: "2d",
|
|
@@ -713,13 +713,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
713
713
|
arrayLayerCount: 1
|
|
714
714
|
});
|
|
715
715
|
if (srcTextureViewsMap == null) {
|
|
716
|
-
this.
|
|
716
|
+
this.qI.set(texture, []);
|
|
717
717
|
}
|
|
718
|
-
this.
|
|
718
|
+
this.qI.get(texture)[layer] = srcView2;
|
|
719
719
|
}
|
|
720
|
-
let srcView = this.
|
|
720
|
+
let srcView = this.qI.get(texture)[layer];
|
|
721
721
|
for (let i = 1; i < textureDescriptor.mipLevelCount; ++i) {
|
|
722
|
-
const dstTextureViewsMap = this.
|
|
722
|
+
const dstTextureViewsMap = this.eI.get(texture);
|
|
723
723
|
if (dstTextureViewsMap == null || dstTextureViewsMap[layer] == null || dstTextureViewsMap[layer][i] == null) {
|
|
724
724
|
const dstView2 = texture.createView({
|
|
725
725
|
dimension: "2d",
|
|
@@ -729,15 +729,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
729
729
|
arrayLayerCount: 1
|
|
730
730
|
});
|
|
731
731
|
if (dstTextureViewsMap == null) {
|
|
732
|
-
this.
|
|
732
|
+
this.eI.set(texture, []);
|
|
733
733
|
}
|
|
734
|
-
if (this.
|
|
735
|
-
this.
|
|
734
|
+
if (this.eI.get(texture)[layer] == null) {
|
|
735
|
+
this.eI.get(texture)[layer] = [];
|
|
736
736
|
}
|
|
737
|
-
this.
|
|
737
|
+
this.eI.get(texture)[layer][i] = dstView2;
|
|
738
738
|
}
|
|
739
|
-
const dstView = this.
|
|
740
|
-
const passEncoder = this.
|
|
739
|
+
const dstView = this.eI.get(texture)[layer][i];
|
|
740
|
+
const passEncoder = this.YH.beginRenderPass({
|
|
741
741
|
colorAttachments: [
|
|
742
742
|
{
|
|
743
743
|
view: dstView,
|
|
@@ -746,14 +746,14 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
746
746
|
}
|
|
747
747
|
]
|
|
748
748
|
});
|
|
749
|
-
const bindGroupsMap = this.
|
|
749
|
+
const bindGroupsMap = this.fI.get(texture);
|
|
750
750
|
if (bindGroupsMap == null || bindGroupsMap[layer] == null || bindGroupsMap[layer][i] == null) {
|
|
751
751
|
const bindGroup2 = gpuDevice.createBindGroup({
|
|
752
|
-
layout: this.
|
|
752
|
+
layout: this.XI,
|
|
753
753
|
entries: [
|
|
754
754
|
{
|
|
755
755
|
binding: 0,
|
|
756
|
-
resource: this.
|
|
756
|
+
resource: this.WI
|
|
757
757
|
},
|
|
758
758
|
{
|
|
759
759
|
binding: 1,
|
|
@@ -762,15 +762,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
762
762
|
]
|
|
763
763
|
});
|
|
764
764
|
if (bindGroupsMap == null) {
|
|
765
|
-
this.
|
|
765
|
+
this.fI.set(texture, []);
|
|
766
766
|
}
|
|
767
|
-
if (this.
|
|
768
|
-
this.
|
|
767
|
+
if (this.fI.get(texture)[layer] == null) {
|
|
768
|
+
this.fI.get(texture)[layer] = [];
|
|
769
769
|
}
|
|
770
|
-
this.
|
|
770
|
+
this.fI.get(texture)[layer][i] = bindGroup2;
|
|
771
771
|
}
|
|
772
|
-
const bindGroup = this.
|
|
773
|
-
passEncoder.setPipeline(this.
|
|
772
|
+
const bindGroup = this.fI.get(texture)[layer][i];
|
|
773
|
+
passEncoder.setPipeline(this.pI);
|
|
774
774
|
passEncoder.setBindGroup(0, bindGroup);
|
|
775
775
|
passEncoder.draw(4);
|
|
776
776
|
passEncoder.end();
|
|
@@ -799,7 +799,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
799
799
|
wrapR,
|
|
800
800
|
anisotropy
|
|
801
801
|
}) {
|
|
802
|
-
const gpuDevice = this.
|
|
802
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
803
803
|
const maxAnisotropy = anisotropy ? 4 : 1;
|
|
804
804
|
const desc = {
|
|
805
805
|
magFilter: magFilter.webgpu,
|
|
@@ -816,7 +816,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
816
816
|
desc.maxAnisotropy = 1;
|
|
817
817
|
}
|
|
818
818
|
const sampler = gpuDevice.createSampler(desc);
|
|
819
|
-
const samplerHandle = this.
|
|
819
|
+
const samplerHandle = this.DD(sampler);
|
|
820
820
|
return samplerHandle;
|
|
821
821
|
}
|
|
822
822
|
/**
|
|
@@ -827,7 +827,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
827
827
|
* @returns Handle to the created vertex buffer
|
|
828
828
|
*/
|
|
829
829
|
createVertexBuffer(accessor) {
|
|
830
|
-
return this.
|
|
830
|
+
return this.YI(accessor.getUint8Array());
|
|
831
831
|
}
|
|
832
832
|
/**
|
|
833
833
|
* Creates a WebGPU vertex buffer from a typed array.
|
|
@@ -837,7 +837,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
837
837
|
* @returns Handle to the created vertex buffer resource
|
|
838
838
|
*/
|
|
839
839
|
createVertexBufferFromTypedArray(typedArray) {
|
|
840
|
-
return this.
|
|
840
|
+
return this.YI(
|
|
841
841
|
new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength)
|
|
842
842
|
);
|
|
843
843
|
}
|
|
@@ -849,7 +849,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
849
849
|
* @param accessor - Accessor of the vertex attribute
|
|
850
850
|
* @returns The vertex format to declare in the pipeline layout
|
|
851
851
|
*/
|
|
852
|
-
static
|
|
852
|
+
static CJ(accessor) {
|
|
853
853
|
const componentType = accessor.componentType;
|
|
854
854
|
const compositionType = accessor.compositionType;
|
|
855
855
|
if (accessor.normalized) {
|
|
@@ -864,7 +864,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
864
864
|
prefix = "snorm16";
|
|
865
865
|
}
|
|
866
866
|
const normalizedFormat = prefix + compositionType.webgpu;
|
|
867
|
-
if (prefix !== "" && _WebGpuResourceRepository.
|
|
867
|
+
if (prefix !== "" && _WebGpuResourceRepository.PJ.has(normalizedFormat)) {
|
|
868
868
|
return normalizedFormat;
|
|
869
869
|
}
|
|
870
870
|
}
|
|
@@ -879,13 +879,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
879
879
|
* @returns Handle to the created index buffer resource
|
|
880
880
|
*/
|
|
881
881
|
createIndexBuffer(accessor) {
|
|
882
|
-
return this.
|
|
882
|
+
return this.YI(_WebGpuResourceRepository.DJ(accessor));
|
|
883
883
|
}
|
|
884
884
|
/**
|
|
885
885
|
* Returns the index data of an accessor in a format WebGPU accepts.
|
|
886
886
|
* WebGPU does not support 8-bit indices, so they are widened to 16 bits.
|
|
887
887
|
*/
|
|
888
|
-
static
|
|
888
|
+
static DJ(accessor) {
|
|
889
889
|
if (accessor.componentType !== ComponentType.UnsignedByte) {
|
|
890
890
|
return accessor.getUint8Array();
|
|
891
891
|
}
|
|
@@ -896,22 +896,22 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
896
896
|
}
|
|
897
897
|
return new Uint8Array(uint16Array.buffer);
|
|
898
898
|
}
|
|
899
|
-
|
|
900
|
-
if (this.
|
|
901
|
-
this.
|
|
902
|
-
this.
|
|
899
|
+
QJ() {
|
|
900
|
+
if (this.hI == null) {
|
|
901
|
+
this.hI = new WebGpuBufferArena(
|
|
902
|
+
this.SH.gpuDevice,
|
|
903
903
|
GPUBufferUsage.VERTEX | GPUBufferUsage.INDEX
|
|
904
904
|
);
|
|
905
905
|
}
|
|
906
|
-
return this.
|
|
906
|
+
return this.hI;
|
|
907
907
|
}
|
|
908
908
|
/**
|
|
909
909
|
* Uploads vertex or index data into the shared vertex buffer arena and returns a handle to the range.
|
|
910
910
|
*/
|
|
911
|
-
|
|
912
|
-
const range = this.
|
|
911
|
+
YI(data) {
|
|
912
|
+
const range = this.QJ().allocate(data);
|
|
913
913
|
const handle = this.getResourceNumber();
|
|
914
|
-
this.
|
|
914
|
+
this.cI.set(handle, range);
|
|
915
915
|
return handle;
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -919,16 +919,16 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
919
919
|
* @internal
|
|
920
920
|
*/
|
|
921
921
|
_getVertexBufferRange(resourceHandle) {
|
|
922
|
-
return this.
|
|
922
|
+
return this.cI.get(resourceHandle);
|
|
923
923
|
}
|
|
924
|
-
|
|
925
|
-
const range = this.
|
|
924
|
+
ZI(resourceHandle) {
|
|
925
|
+
const range = this.cI.get(resourceHandle);
|
|
926
926
|
if (range == null) {
|
|
927
927
|
return false;
|
|
928
928
|
}
|
|
929
|
-
this.
|
|
930
|
-
this.
|
|
931
|
-
this.
|
|
929
|
+
this.hI.release(range);
|
|
930
|
+
this.cI.delete(resourceHandle);
|
|
931
|
+
this.XH();
|
|
932
932
|
return true;
|
|
933
933
|
}
|
|
934
934
|
/**
|
|
@@ -940,11 +940,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
940
940
|
* @throws Error if the vertex buffer is not found
|
|
941
941
|
*/
|
|
942
942
|
updateVertexBuffer(accessor, resourceHandle) {
|
|
943
|
-
const range = this.
|
|
943
|
+
const range = this.cI.get(resourceHandle);
|
|
944
944
|
if (Is.not.exist(range)) {
|
|
945
945
|
throw new Error("Not found VBO.");
|
|
946
946
|
}
|
|
947
|
-
this.
|
|
947
|
+
this.hI.write(range, accessor.getUint8Array());
|
|
948
948
|
}
|
|
949
949
|
/**
|
|
950
950
|
* Updates the data in an existing index buffer with new data from an accessor.
|
|
@@ -955,11 +955,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
955
955
|
* @throws Error if the index buffer is not found
|
|
956
956
|
*/
|
|
957
957
|
updateIndexBuffer(accessor, resourceHandle) {
|
|
958
|
-
const range = this.
|
|
958
|
+
const range = this.cI.get(resourceHandle);
|
|
959
959
|
if (Is.not.exist(range)) {
|
|
960
960
|
throw new Error("Not found IBO.");
|
|
961
961
|
}
|
|
962
|
-
this.
|
|
962
|
+
this.hI.write(range, _WebGpuResourceRepository.DJ(accessor));
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
965
965
|
* Deletes a vertex buffer and releases its range of the vertex buffer arena.
|
|
@@ -968,7 +968,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
968
968
|
* @throws Error if the vertex buffer is not found
|
|
969
969
|
*/
|
|
970
970
|
deleteVertexBuffer(resourceHandle) {
|
|
971
|
-
if (!this.
|
|
971
|
+
if (!this.ZI(resourceHandle)) {
|
|
972
972
|
throw new Error("Not found VBO.");
|
|
973
973
|
}
|
|
974
974
|
}
|
|
@@ -1028,10 +1028,10 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1028
1028
|
*/
|
|
1029
1029
|
deleteVertexDataResources(vertexHandles) {
|
|
1030
1030
|
if (Is.exist(vertexHandles.iboHandle)) {
|
|
1031
|
-
this.
|
|
1031
|
+
this.ZI(vertexHandles.iboHandle);
|
|
1032
1032
|
}
|
|
1033
1033
|
for (const vboHandle of vertexHandles.vboHandles) {
|
|
1034
|
-
this.
|
|
1034
|
+
this.ZI(vboHandle);
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
1037
|
/**
|
|
@@ -1049,7 +1049,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1049
1049
|
const attributes = [];
|
|
1050
1050
|
for (let i = 0; i < vboHandles.length; i++) {
|
|
1051
1051
|
const shaderLocation = VertexAttribute.toAttributeSlotFromJoinedString(primitive.attributeSemantics[i]);
|
|
1052
|
-
const gpuVertexFormat = _WebGpuResourceRepository.
|
|
1052
|
+
const gpuVertexFormat = _WebGpuResourceRepository.CJ(primitive.attributeAccessors[i]);
|
|
1053
1053
|
attributes.push({
|
|
1054
1054
|
shaderLocation,
|
|
1055
1055
|
offset: primitive.attributeAccessors[i].byteOffsetInBufferView,
|
|
@@ -1083,7 +1083,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1083
1083
|
* @param info - WebGPU compilation info containing messages and errors
|
|
1084
1084
|
* @returns True if compilation was successful, false otherwise
|
|
1085
1085
|
*/
|
|
1086
|
-
|
|
1086
|
+
TD(engine, materialTypeName, shaderText, info) {
|
|
1087
1087
|
engine.logger.info(`MaterialTypeName: ${materialTypeName}`);
|
|
1088
1088
|
const lineNumberedShaderText = MiscUtil.addLineNumberToCode(shaderText);
|
|
1089
1089
|
engine.logger.info(lineNumberedShaderText);
|
|
@@ -1112,7 +1112,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1112
1112
|
vertexShaderStr,
|
|
1113
1113
|
fragmentShaderStr
|
|
1114
1114
|
}) {
|
|
1115
|
-
const gpuDevice = this.
|
|
1115
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
1116
1116
|
const vsModule = gpuDevice.createShaderModule({
|
|
1117
1117
|
code: vertexShaderStr,
|
|
1118
1118
|
label: `${material.materialTypeName} vertex shader`
|
|
@@ -1120,7 +1120,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1120
1120
|
if (config.cgApiDebugConsoleOutput) {
|
|
1121
1121
|
vsModule.getCompilationInfo().then((info) => {
|
|
1122
1122
|
if (info.messages.length > 0) {
|
|
1123
|
-
this.
|
|
1123
|
+
this.TD(engine, material.materialTypeName, vertexShaderStr, info);
|
|
1124
1124
|
}
|
|
1125
1125
|
});
|
|
1126
1126
|
}
|
|
@@ -1131,7 +1131,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1131
1131
|
if (config.cgApiDebugConsoleOutput) {
|
|
1132
1132
|
fsModule.getCompilationInfo().then((info) => {
|
|
1133
1133
|
if (info.messages.length > 0) {
|
|
1134
|
-
this.
|
|
1134
|
+
this.TD(engine, material.materialTypeName, fragmentShaderStr, info);
|
|
1135
1135
|
}
|
|
1136
1136
|
});
|
|
1137
1137
|
}
|
|
@@ -1139,7 +1139,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1139
1139
|
vsModule,
|
|
1140
1140
|
fsModule
|
|
1141
1141
|
};
|
|
1142
|
-
const modulesHandle = this.
|
|
1142
|
+
const modulesHandle = this.DD(modules);
|
|
1143
1143
|
return modulesHandle;
|
|
1144
1144
|
}
|
|
1145
1145
|
/**
|
|
@@ -1159,12 +1159,12 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1159
1159
|
const webXRSystem = engine._webXRSystemIfEnabled;
|
|
1160
1160
|
const isXrTarget = renderPass.getFramebuffer() == null && (webXRSystem == null ? void 0 : webXRSystem.isWebXRMode) && renderPass.isOutputForVr;
|
|
1161
1161
|
if (renderPass.getResolveFramebuffer() == null && !isXrTarget) {
|
|
1162
|
-
const targetViews = this.
|
|
1163
|
-
const targetKind = this.
|
|
1164
|
-
const pendingClear = this.
|
|
1162
|
+
const targetViews = this.vI;
|
|
1163
|
+
const targetKind = this.EJ(engine, renderPass, targetViews);
|
|
1164
|
+
const pendingClear = this.dI;
|
|
1165
1165
|
if (pendingClear.active) {
|
|
1166
|
-
if (targetKind !== pendingClear.targetKind || !_WebGpuResourceRepository.
|
|
1167
|
-
this
|
|
1166
|
+
if (targetKind !== pendingClear.targetKind || !_WebGpuResourceRepository._I(targetViews, pendingClear.targetViews)) {
|
|
1167
|
+
this.$I();
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
1170
|
if (!pendingClear.active) {
|
|
@@ -1173,7 +1173,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1173
1173
|
pendingClear.renderPass = renderPass;
|
|
1174
1174
|
pendingClear.displayIdx = displayIdx;
|
|
1175
1175
|
pendingClear.targetKind = targetKind;
|
|
1176
|
-
this.
|
|
1176
|
+
this.vI = pendingClear.targetViews;
|
|
1177
1177
|
pendingClear.targetViews = targetViews;
|
|
1178
1178
|
}
|
|
1179
1179
|
if (renderPass.toClearColorBuffer) {
|
|
@@ -1190,7 +1190,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1190
1190
|
}
|
|
1191
1191
|
return;
|
|
1192
1192
|
}
|
|
1193
|
-
this.
|
|
1193
|
+
this.jI();
|
|
1194
1194
|
const colorAttachments = [];
|
|
1195
1195
|
let depthStencilAttachment;
|
|
1196
1196
|
const webxrSystem = engine._webXRSystemIfEnabled;
|
|
@@ -1198,7 +1198,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1198
1198
|
const framebuffer = renderPass.getFramebuffer();
|
|
1199
1199
|
if (framebuffer != null) {
|
|
1200
1200
|
for (let colorAttachment of framebuffer.colorAttachments) {
|
|
1201
|
-
const textureView = this.
|
|
1201
|
+
const textureView = this.TH.get(
|
|
1202
1202
|
colorAttachment._textureViewAsRenderTargetResourceUid
|
|
1203
1203
|
);
|
|
1204
1204
|
colorAttachments.push({
|
|
@@ -1232,7 +1232,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1232
1232
|
});
|
|
1233
1233
|
} else {
|
|
1234
1234
|
colorAttachments.push({
|
|
1235
|
-
view: this.
|
|
1235
|
+
view: this.zI(),
|
|
1236
1236
|
clearValue: {
|
|
1237
1237
|
r: renderPass.clearColor.x,
|
|
1238
1238
|
g: renderPass.clearColor.y,
|
|
@@ -1247,7 +1247,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1247
1247
|
if (renderPass.toClearDepthBuffer) {
|
|
1248
1248
|
const framebuffer = renderPass.getFramebuffer();
|
|
1249
1249
|
if (framebuffer != null && framebuffer.depthAttachment != null) {
|
|
1250
|
-
const depthTextureView = this.
|
|
1250
|
+
const depthTextureView = this.TH.get(
|
|
1251
1251
|
framebuffer.depthAttachment._textureViewAsRenderTargetResourceUid
|
|
1252
1252
|
);
|
|
1253
1253
|
depthStencilAttachment = {
|
|
@@ -1270,7 +1270,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1270
1270
|
};
|
|
1271
1271
|
} else {
|
|
1272
1272
|
depthStencilAttachment = {
|
|
1273
|
-
view: this.
|
|
1273
|
+
view: this.bI,
|
|
1274
1274
|
depthClearValue: renderPass.clearDepth,
|
|
1275
1275
|
depthLoadOp: "clear",
|
|
1276
1276
|
depthStoreOp: "store"
|
|
@@ -1282,7 +1282,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1282
1282
|
depthStencilAttachment,
|
|
1283
1283
|
label: renderPass.uniqueName
|
|
1284
1284
|
};
|
|
1285
|
-
const passEncoder = this.
|
|
1285
|
+
const passEncoder = this.rI(renderPassDescriptor);
|
|
1286
1286
|
passEncoder.end();
|
|
1287
1287
|
}
|
|
1288
1288
|
/**
|
|
@@ -1340,8 +1340,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1340
1340
|
sheenCubeMap = sheenEnvValue[1];
|
|
1341
1341
|
}
|
|
1342
1342
|
}
|
|
1343
|
-
const renderPipelineId = `${primitive._getFingerPrint()} ${material._getFingerPrint()} ${material.
|
|
1344
|
-
const bindGroups = this.
|
|
1343
|
+
const renderPipelineId = `${primitive._getFingerPrint()} ${material._getFingerPrint()} ${material.Rr} ${renderPass.renderPassUID} ${meshRendererComponentFingerPrint} ${zWrite} `;
|
|
1344
|
+
const bindGroups = this.RJ(engine, material, diffuseCubeMap, specularCubeMap, sheenCubeMap);
|
|
1345
1345
|
const [pipeline, _recreated] = this.getOrCreateRenderPipeline(
|
|
1346
1346
|
renderPipelineId,
|
|
1347
1347
|
bindGroups.pipelineLayoutKey,
|
|
@@ -1352,15 +1352,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1352
1352
|
zWrite,
|
|
1353
1353
|
options
|
|
1354
1354
|
);
|
|
1355
|
-
const renderBundleEncoder = this.
|
|
1356
|
-
const boundBindGroups = this.
|
|
1355
|
+
const renderBundleEncoder = this.WH;
|
|
1356
|
+
const boundBindGroups = this.oJ;
|
|
1357
1357
|
if (boundBindGroups[0] !== bindGroups.storage) {
|
|
1358
1358
|
renderBundleEncoder.setBindGroup(0, bindGroups.storage);
|
|
1359
1359
|
boundBindGroups[0] = bindGroups.storage;
|
|
1360
1360
|
}
|
|
1361
|
-
if (this.
|
|
1361
|
+
if (this.MI !== pipeline) {
|
|
1362
1362
|
renderBundleEncoder.setPipeline(pipeline);
|
|
1363
|
-
this.
|
|
1363
|
+
this.MI = pipeline;
|
|
1364
1364
|
}
|
|
1365
1365
|
if (boundBindGroups[1] !== bindGroups.texture) {
|
|
1366
1366
|
renderBundleEncoder.setBindGroup(1, bindGroups.texture);
|
|
@@ -1370,11 +1370,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1370
1370
|
renderBundleEncoder.setBindGroup(2, bindGroups.sampler);
|
|
1371
1371
|
boundBindGroups[2] = bindGroups.sampler;
|
|
1372
1372
|
}
|
|
1373
|
-
const culledDraw = isBufferLessRendering ? void 0 : this.
|
|
1373
|
+
const culledDraw = isBufferLessRendering ? void 0 : this.SJ(engine, primitive, primitive.mesh, renderPass, cameraId);
|
|
1374
1374
|
if ((culledDraw == null ? void 0 : culledDraw.deformedVertexOffset) !== void 0) {
|
|
1375
|
-
this.
|
|
1375
|
+
this.TJ(culledDraw.deformedVertexOffset);
|
|
1376
1376
|
}
|
|
1377
|
-
const drawParametersBindGroup = this.
|
|
1377
|
+
const drawParametersBindGroup = this.kJ;
|
|
1378
1378
|
if (boundBindGroups[3] !== drawParametersBindGroup) {
|
|
1379
1379
|
renderBundleEncoder.setBindGroup(3, drawParametersBindGroup);
|
|
1380
1380
|
boundBindGroups[3] = drawParametersBindGroup;
|
|
@@ -1383,8 +1383,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1383
1383
|
renderBundleEncoder.draw(renderPass._drawVertexNumberForBufferLessRendering);
|
|
1384
1384
|
} else {
|
|
1385
1385
|
const mesh = primitive.mesh;
|
|
1386
|
-
const vertexBufferRanges = this.
|
|
1387
|
-
const boundVertexBuffers = this.
|
|
1386
|
+
const vertexBufferRanges = this.cI;
|
|
1387
|
+
const boundVertexBuffers = this.pJ;
|
|
1388
1388
|
const instanceBuffer = (_a = culledDraw == null ? void 0 : culledDraw.instanceVertexBuffer) != null ? _a : vertexBufferRanges.get(mesh._variationVBOUid);
|
|
1389
1389
|
if (boundVertexBuffers[0] !== instanceBuffer) {
|
|
1390
1390
|
renderBundleEncoder.setVertexBuffer(0, instanceBuffer.buffer, instanceBuffer.offset, instanceBuffer.size);
|
|
@@ -1401,15 +1401,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1401
1401
|
if (primitive.hasIndices()) {
|
|
1402
1402
|
const indicesBuffer = vertexBufferRanges.get(VertexHandles.iboHandle);
|
|
1403
1403
|
const indexBitSize = primitive.getIndexBitSize();
|
|
1404
|
-
if (this.
|
|
1404
|
+
if (this.NI !== indicesBuffer || this.OI !== indexBitSize) {
|
|
1405
1405
|
renderBundleEncoder.setIndexBuffer(
|
|
1406
1406
|
indicesBuffer.buffer,
|
|
1407
1407
|
indexBitSize,
|
|
1408
1408
|
indicesBuffer.offset,
|
|
1409
1409
|
indicesBuffer.size
|
|
1410
1410
|
);
|
|
1411
|
-
this.
|
|
1412
|
-
this.
|
|
1411
|
+
this.NI = indicesBuffer;
|
|
1412
|
+
this.OI = indexBitSize;
|
|
1413
1413
|
}
|
|
1414
1414
|
if (culledDraw != null) {
|
|
1415
1415
|
renderBundleEncoder.drawIndexedIndirect(culledDraw.indirectBuffer, culledDraw.indirectOffset);
|
|
@@ -1433,8 +1433,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1433
1433
|
* @returns The indirect draw, or undefined to draw every instance directly (GPU culling disabled, not applicable,
|
|
1434
1434
|
* or its tables are full for this frame)
|
|
1435
1435
|
*/
|
|
1436
|
-
|
|
1437
|
-
const gpuCulling = this.
|
|
1436
|
+
SJ(engine, primitive, mesh, renderPass, cameraId) {
|
|
1437
|
+
const gpuCulling = this.VH;
|
|
1438
1438
|
if (gpuCulling == null || !gpuCulling.isRecording || !mesh._isGpuCullable || !MeshRendererComponent._isGpuCullingActive(engine, renderPass)) {
|
|
1439
1439
|
return void 0;
|
|
1440
1440
|
}
|
|
@@ -1448,26 +1448,26 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1448
1448
|
*/
|
|
1449
1449
|
_markGpuCullingInputsDirty() {
|
|
1450
1450
|
var _a;
|
|
1451
|
-
(_a = this.
|
|
1451
|
+
(_a = this.VH) == null ? void 0 : _a.markInputsDirty();
|
|
1452
1452
|
}
|
|
1453
1453
|
/**
|
|
1454
1454
|
* The GPU culling of the instances, if it was created (for tests and statistics).
|
|
1455
1455
|
* @internal
|
|
1456
1456
|
*/
|
|
1457
1457
|
_getGpuCulling() {
|
|
1458
|
-
return this.
|
|
1458
|
+
return this.VH;
|
|
1459
1459
|
}
|
|
1460
1460
|
/**
|
|
1461
1461
|
* Releases the GPU culling resources. The render bundles recording culled draws are dropped with them.
|
|
1462
1462
|
* @internal
|
|
1463
1463
|
*/
|
|
1464
1464
|
_destroyGpuCulling() {
|
|
1465
|
-
if (this.
|
|
1465
|
+
if (this.VH == null) {
|
|
1466
1466
|
return;
|
|
1467
1467
|
}
|
|
1468
|
-
this.
|
|
1469
|
-
this.
|
|
1470
|
-
this.
|
|
1468
|
+
this.XH();
|
|
1469
|
+
this.VH.destroy();
|
|
1470
|
+
this.VH = void 0;
|
|
1471
1471
|
}
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Creates a render bundle encoder for efficient rendering.
|
|
@@ -1475,7 +1475,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1475
1475
|
*
|
|
1476
1476
|
* @param renderPass - The render pass that will use this render bundle encoder
|
|
1477
1477
|
*/
|
|
1478
|
-
|
|
1478
|
+
UJ(engine, renderPass, displayIdx) {
|
|
1479
1479
|
const framebuffer = renderPass.getFramebuffer();
|
|
1480
1480
|
const resolveFramebuffer = renderPass.getResolveFramebuffer();
|
|
1481
1481
|
let colorFormats = [];
|
|
@@ -1491,7 +1491,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1491
1491
|
if (textureResourceUid == null || textureResourceUid < 0) {
|
|
1492
1492
|
continue;
|
|
1493
1493
|
}
|
|
1494
|
-
const texture = this.
|
|
1494
|
+
const texture = this.TH.get(textureResourceUid);
|
|
1495
1495
|
if (texture != null) {
|
|
1496
1496
|
colorFormats.push(texture.format);
|
|
1497
1497
|
}
|
|
@@ -1506,7 +1506,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1506
1506
|
if (framebuffer.depthAttachment != null) {
|
|
1507
1507
|
const depthTextureUid = framebuffer.depthAttachment._textureResourceUid;
|
|
1508
1508
|
if (depthTextureUid != null && depthTextureUid >= 0) {
|
|
1509
|
-
const depthTexture = this.
|
|
1509
|
+
const depthTexture = this.TH.get(depthTextureUid);
|
|
1510
1510
|
depthStencilFormat = depthTexture == null ? void 0 : depthTexture.format;
|
|
1511
1511
|
} else {
|
|
1512
1512
|
depthStencilFormat = void 0;
|
|
@@ -1524,7 +1524,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1524
1524
|
depthStencilFormat = subImage.depthStencilTexture.format;
|
|
1525
1525
|
} else {
|
|
1526
1526
|
colorFormats = [navigator.gpu.getPreferredCanvasFormat()];
|
|
1527
|
-
depthStencilFormat = this.
|
|
1527
|
+
depthStencilFormat = this.iI != null ? this.iI.format : DEFAULT_DEPTH_FORMAT;
|
|
1528
1528
|
}
|
|
1529
1529
|
if (colorFormats.length === 0) {
|
|
1530
1530
|
colorFormats = [navigator.gpu.getPreferredCanvasFormat()];
|
|
@@ -1550,11 +1550,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1550
1550
|
let colorFormat;
|
|
1551
1551
|
if (resolveFramebuffer != null && resolveFramebuffer.colorAttachments.length > 0) {
|
|
1552
1552
|
const textureResourceUid = resolveFramebuffer.colorAttachments[0]._textureResourceUid;
|
|
1553
|
-
const texture = textureResourceUid != null ? this.
|
|
1553
|
+
const texture = textureResourceUid != null ? this.TH.get(textureResourceUid) : void 0;
|
|
1554
1554
|
colorFormat = texture == null ? void 0 : texture.format;
|
|
1555
1555
|
} else if (framebuffer != null && framebuffer.colorAttachments.length > 0) {
|
|
1556
1556
|
const textureResourceUid = framebuffer.colorAttachments[0]._textureResourceUid;
|
|
1557
|
-
const texture = textureResourceUid != null ? this.
|
|
1557
|
+
const texture = textureResourceUid != null ? this.TH.get(textureResourceUid) : void 0;
|
|
1558
1558
|
colorFormat = texture == null ? void 0 : texture.format;
|
|
1559
1559
|
} else if (((_a = engine._webXRSystemIfEnabled) == null ? void 0 : _a.isWebXRMode) && renderPass.isOutputForVr) {
|
|
1560
1560
|
const view = engine.engineState.xrPoseWebGPU.views[displayIdx];
|
|
@@ -1573,9 +1573,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1573
1573
|
return options;
|
|
1574
1574
|
}
|
|
1575
1575
|
getOrCreateRenderPassEncoderForEffekseerExternalRendering(engine, renderPass, displayIdx) {
|
|
1576
|
-
this.
|
|
1577
|
-
if (this.
|
|
1578
|
-
this.
|
|
1576
|
+
this.jI();
|
|
1577
|
+
if (this.WH != null) {
|
|
1578
|
+
this.kI();
|
|
1579
1579
|
}
|
|
1580
1580
|
const framebuffer = renderPass.getFramebuffer();
|
|
1581
1581
|
const resolveFramebuffer = renderPass.getResolveFramebuffer();
|
|
@@ -1583,7 +1583,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1583
1583
|
const colorAttachments = [];
|
|
1584
1584
|
if (resolveFramebuffer != null) {
|
|
1585
1585
|
for (const colorAttachment of resolveFramebuffer.colorAttachments) {
|
|
1586
|
-
const textureView = this.
|
|
1586
|
+
const textureView = this.TH.get(
|
|
1587
1587
|
colorAttachment._textureViewAsRenderTargetResourceUid
|
|
1588
1588
|
);
|
|
1589
1589
|
colorAttachments.push({
|
|
@@ -1594,7 +1594,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1594
1594
|
}
|
|
1595
1595
|
} else if (framebuffer != null) {
|
|
1596
1596
|
for (const colorAttachment of framebuffer.colorAttachments) {
|
|
1597
|
-
const textureView = this.
|
|
1597
|
+
const textureView = this.TH.get(
|
|
1598
1598
|
colorAttachment._textureViewAsRenderTargetResourceUid
|
|
1599
1599
|
);
|
|
1600
1600
|
colorAttachments.push({
|
|
@@ -1616,7 +1616,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1616
1616
|
});
|
|
1617
1617
|
} else {
|
|
1618
1618
|
colorAttachments.push({
|
|
1619
|
-
view: this.
|
|
1619
|
+
view: this.zI(),
|
|
1620
1620
|
loadOp: "load",
|
|
1621
1621
|
storeOp: "store"
|
|
1622
1622
|
});
|
|
@@ -1628,42 +1628,42 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1628
1628
|
colorAttachments,
|
|
1629
1629
|
label: `${renderPass.uniqueName}_EffekseerExternal`
|
|
1630
1630
|
};
|
|
1631
|
-
this.
|
|
1632
|
-
this.
|
|
1633
|
-
return this.
|
|
1631
|
+
this.FJ(renderPassDescriptor);
|
|
1632
|
+
this.UH = this.YH.beginRenderPass(renderPassDescriptor);
|
|
1633
|
+
return this.UH;
|
|
1634
1634
|
}
|
|
1635
1635
|
createRenderBundleEncoder(engine, renderPass, displayIdx) {
|
|
1636
1636
|
var _a, _b, _c, _d;
|
|
1637
|
-
const gpuDevice = this.
|
|
1638
|
-
const renderBundleDescriptor = this.
|
|
1637
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
1638
|
+
const renderBundleDescriptor = this.UJ(engine, renderPass, displayIdx);
|
|
1639
1639
|
const descriptorKey = JSON.stringify({
|
|
1640
1640
|
colorFormats: renderBundleDescriptor.colorFormats,
|
|
1641
1641
|
depthStencilFormat: (_a = renderBundleDescriptor.depthStencilFormat) != null ? _a : null,
|
|
1642
1642
|
sampleCount: renderBundleDescriptor.sampleCount
|
|
1643
1643
|
});
|
|
1644
|
-
this.
|
|
1645
|
-
this.
|
|
1646
|
-
if (this.
|
|
1644
|
+
this.UI = renderPass;
|
|
1645
|
+
this.VI = displayIdx;
|
|
1646
|
+
if (this.WH != null && this.RI === descriptorKey) {
|
|
1647
1647
|
return;
|
|
1648
1648
|
}
|
|
1649
|
-
this.
|
|
1650
|
-
this.
|
|
1651
|
-
this.
|
|
1649
|
+
this.WH = gpuDevice.createRenderBundleEncoder(renderBundleDescriptor);
|
|
1650
|
+
this.RI = descriptorKey;
|
|
1651
|
+
this.GJ();
|
|
1652
1652
|
if (engine.config.isGpuCullingEnabled) {
|
|
1653
|
-
(_c = this[_b = "
|
|
1653
|
+
(_c = this[_b = "VH"]) != null ? _c : this[_b] = new WebGpuGpuCulling(gpuDevice);
|
|
1654
1654
|
}
|
|
1655
|
-
(_d = this.
|
|
1655
|
+
(_d = this.VH) == null ? void 0 : _d.beginRecording();
|
|
1656
1656
|
}
|
|
1657
1657
|
/**
|
|
1658
1658
|
* Forgets the state recorded into the render bundle encoder. A new encoder starts without any
|
|
1659
1659
|
* pipeline, bind group or buffer set.
|
|
1660
1660
|
*/
|
|
1661
|
-
|
|
1662
|
-
this.
|
|
1663
|
-
this.
|
|
1664
|
-
this.
|
|
1665
|
-
this.
|
|
1666
|
-
this.
|
|
1661
|
+
GJ() {
|
|
1662
|
+
this.MI = void 0;
|
|
1663
|
+
this.oJ.length = 0;
|
|
1664
|
+
this.pJ.length = 0;
|
|
1665
|
+
this.NI = void 0;
|
|
1666
|
+
this.OI = void 0;
|
|
1667
1667
|
}
|
|
1668
1668
|
/**
|
|
1669
1669
|
* Creates a render pass encoder for immediate rendering commands.
|
|
@@ -1674,38 +1674,38 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1674
1674
|
* @param displayIdx - The display index for stereo rendering (0 for left eye, 1 for right eye)
|
|
1675
1675
|
*/
|
|
1676
1676
|
createRenderPassEncoder(engine, renderPass, displayIdx) {
|
|
1677
|
-
if (this.
|
|
1677
|
+
if (this.UH != null && this.nI === renderPass && this.oI === displayIdx && !this.dI.active) {
|
|
1678
1678
|
return;
|
|
1679
1679
|
}
|
|
1680
|
-
const targetViews = this.
|
|
1681
|
-
const targetKind = this.
|
|
1680
|
+
const targetViews = this.vI;
|
|
1681
|
+
const targetKind = this.EJ(engine, renderPass, targetViews);
|
|
1682
1682
|
let mergePendingClear = false;
|
|
1683
|
-
const pendingClear = this.
|
|
1683
|
+
const pendingClear = this.dI;
|
|
1684
1684
|
if (pendingClear.active) {
|
|
1685
|
-
if (targetKind !== RENDER_PASS_TARGET_KIND_NONE && targetKind === pendingClear.targetKind && _WebGpuResourceRepository.
|
|
1685
|
+
if (targetKind !== RENDER_PASS_TARGET_KIND_NONE && targetKind === pendingClear.targetKind && _WebGpuResourceRepository._I(targetViews, pendingClear.targetViews)) {
|
|
1686
1686
|
mergePendingClear = true;
|
|
1687
1687
|
} else {
|
|
1688
|
-
this
|
|
1688
|
+
this.$I();
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
|
-
if (this.
|
|
1692
|
-
if (!mergePendingClear && targetKind !== RENDER_PASS_TARGET_KIND_NONE && targetKind === this.
|
|
1693
|
-
this.
|
|
1694
|
-
this.
|
|
1691
|
+
if (this.UH != null) {
|
|
1692
|
+
if (!mergePendingClear && targetKind !== RENDER_PASS_TARGET_KIND_NONE && targetKind === this.SI && !renderPass.toClearColorBuffer && !renderPass.toClearDepthBuffer && _WebGpuResourceRepository._I(targetViews, this.TI)) {
|
|
1693
|
+
this.nI = renderPass;
|
|
1694
|
+
this.oI = displayIdx;
|
|
1695
1695
|
return;
|
|
1696
1696
|
}
|
|
1697
|
-
this.
|
|
1697
|
+
this.AI();
|
|
1698
1698
|
}
|
|
1699
|
-
this.
|
|
1699
|
+
this.HJ(engine, renderPass, displayIdx, mergePendingClear);
|
|
1700
1700
|
if (mergePendingClear) {
|
|
1701
|
-
this.
|
|
1701
|
+
this.aJ();
|
|
1702
1702
|
}
|
|
1703
|
-
if (this.
|
|
1704
|
-
this.
|
|
1705
|
-
this.
|
|
1706
|
-
this.
|
|
1707
|
-
this.
|
|
1708
|
-
this.
|
|
1703
|
+
if (this.UH != null) {
|
|
1704
|
+
this.nI = renderPass;
|
|
1705
|
+
this.oI = displayIdx;
|
|
1706
|
+
this.SI = targetKind;
|
|
1707
|
+
this.vI = this.TI;
|
|
1708
|
+
this.TI = targetViews;
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
1711
|
/**
|
|
@@ -1714,12 +1714,12 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1714
1714
|
*
|
|
1715
1715
|
* @returns The kind of the target, or `RENDER_PASS_TARGET_KIND_NONE` if the render pass must not be merged.
|
|
1716
1716
|
*/
|
|
1717
|
-
|
|
1717
|
+
EJ(engine, renderPass, out) {
|
|
1718
1718
|
var _a;
|
|
1719
1719
|
out.length = 0;
|
|
1720
1720
|
const framebuffer = renderPass.getFramebuffer();
|
|
1721
1721
|
const resolveFramebuffer = renderPass.getResolveFramebuffer();
|
|
1722
|
-
const webGpuResources = this.
|
|
1722
|
+
const webGpuResources = this.TH;
|
|
1723
1723
|
if (resolveFramebuffer != null && framebuffer != null) {
|
|
1724
1724
|
for (let i = 0; i < resolveFramebuffer.colorAttachments.length; i++) {
|
|
1725
1725
|
const colorAttachment = framebuffer.colorAttachments[i];
|
|
@@ -1727,7 +1727,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1727
1727
|
out.push(webGpuResources.get(colorAttachment._textureViewAsRenderTargetResourceUid));
|
|
1728
1728
|
out.push(webGpuResources.get(resolveColorAttachment._textureViewAsRenderTargetResourceUid));
|
|
1729
1729
|
}
|
|
1730
|
-
let depthTextureView = this.
|
|
1730
|
+
let depthTextureView = this.bI;
|
|
1731
1731
|
const depthAttachment = framebuffer.depthAttachment;
|
|
1732
1732
|
if (depthAttachment != null && webGpuResources.get(depthAttachment._textureResourceUid) != null) {
|
|
1733
1733
|
depthTextureView = webGpuResources.get(depthAttachment._textureViewResourceUid);
|
|
@@ -1750,8 +1750,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1750
1750
|
if (((_a = engine._webXRSystemIfEnabled) == null ? void 0 : _a.isWebXRMode) && renderPass.isOutputForVr) {
|
|
1751
1751
|
return RENDER_PASS_TARGET_KIND_NONE;
|
|
1752
1752
|
}
|
|
1753
|
-
out.push(this.
|
|
1754
|
-
out.push(this.
|
|
1753
|
+
out.push(this.zI());
|
|
1754
|
+
out.push(this.bI);
|
|
1755
1755
|
return RENDER_PASS_TARGET_KIND_CANVAS;
|
|
1756
1756
|
}
|
|
1757
1757
|
/**
|
|
@@ -1760,12 +1760,12 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1760
1760
|
* When the browser accepts a GPUTexture where a GPUTextureView is expected (the texture's default
|
|
1761
1761
|
* view is used), the texture itself is returned. This saves a `createView()` call per frame.
|
|
1762
1762
|
*/
|
|
1763
|
-
|
|
1764
|
-
let view = this.
|
|
1763
|
+
zI() {
|
|
1764
|
+
let view = this.yI;
|
|
1765
1765
|
if (view == null) {
|
|
1766
|
-
const texture = this.
|
|
1767
|
-
view = _WebGpuResourceRepository.
|
|
1768
|
-
this.
|
|
1766
|
+
const texture = this.SH.context.getCurrentTexture();
|
|
1767
|
+
view = _WebGpuResourceRepository.VJ(this.SH.gpuDevice) ? texture : texture.createView();
|
|
1768
|
+
this.yI = view;
|
|
1769
1769
|
}
|
|
1770
1770
|
return view;
|
|
1771
1771
|
}
|
|
@@ -1773,8 +1773,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1773
1773
|
* Detects once whether a GPUTexture can be passed as a render pass attachment view.
|
|
1774
1774
|
* Browsers that do not support it throw a TypeError while converting the descriptor.
|
|
1775
1775
|
*/
|
|
1776
|
-
static
|
|
1777
|
-
let supported = _WebGpuResourceRepository
|
|
1776
|
+
static VJ(gpuDevice) {
|
|
1777
|
+
let supported = _WebGpuResourceRepository.IJ;
|
|
1778
1778
|
if (supported !== void 0) {
|
|
1779
1779
|
return supported;
|
|
1780
1780
|
}
|
|
@@ -1795,32 +1795,32 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1795
1795
|
} finally {
|
|
1796
1796
|
texture == null ? void 0 : texture.destroy();
|
|
1797
1797
|
}
|
|
1798
|
-
_WebGpuResourceRepository
|
|
1798
|
+
_WebGpuResourceRepository.IJ = supported;
|
|
1799
1799
|
return supported;
|
|
1800
1800
|
}
|
|
1801
1801
|
/**
|
|
1802
1802
|
* Begins a render pass on the frame's command encoder. A deferred clear of the system depth
|
|
1803
1803
|
* texture (see flush()) is applied here to the first render pass that attaches it.
|
|
1804
1804
|
*/
|
|
1805
|
-
|
|
1806
|
-
const deferredDepthClearValue = this.
|
|
1805
|
+
rI(renderPassDescriptor) {
|
|
1806
|
+
const deferredDepthClearValue = this.wI;
|
|
1807
1807
|
if (deferredDepthClearValue !== void 0) {
|
|
1808
1808
|
const depthStencilAttachment = renderPassDescriptor.depthStencilAttachment;
|
|
1809
|
-
if (depthStencilAttachment != null && depthStencilAttachment.view === this.
|
|
1809
|
+
if (depthStencilAttachment != null && depthStencilAttachment.view === this.bI) {
|
|
1810
1810
|
if (depthStencilAttachment.depthLoadOp === "load") {
|
|
1811
1811
|
depthStencilAttachment.depthLoadOp = "clear";
|
|
1812
1812
|
depthStencilAttachment.depthClearValue = deferredDepthClearValue;
|
|
1813
1813
|
}
|
|
1814
|
-
this.
|
|
1814
|
+
this.wI = void 0;
|
|
1815
1815
|
}
|
|
1816
1816
|
}
|
|
1817
|
-
this.
|
|
1818
|
-
return this.
|
|
1817
|
+
this.FJ(renderPassDescriptor);
|
|
1818
|
+
return this.YH.beginRenderPass(renderPassDescriptor);
|
|
1819
1819
|
}
|
|
1820
1820
|
/** Lets the GPU timer measure the render pass while a frame is being measured. */
|
|
1821
|
-
|
|
1821
|
+
FJ(renderPassDescriptor) {
|
|
1822
1822
|
var _a;
|
|
1823
|
-
const gpuTimer = this.
|
|
1823
|
+
const gpuTimer = this.mI;
|
|
1824
1824
|
if (gpuTimer == null || renderPassDescriptor.timestampWrites != null) {
|
|
1825
1825
|
return;
|
|
1826
1826
|
}
|
|
@@ -1834,29 +1834,29 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1834
1834
|
* @internal Use Engine.gpuTimerEnabled and Engine.gpuTimeMilliseconds instead.
|
|
1835
1835
|
*/
|
|
1836
1836
|
_getGpuTimer() {
|
|
1837
|
-
if (this.
|
|
1838
|
-
this.
|
|
1837
|
+
if (this.mI == null) {
|
|
1838
|
+
this.mI = new WebGpuGpuTimer(this.SH.gpuDevice);
|
|
1839
1839
|
}
|
|
1840
|
-
return this.
|
|
1840
|
+
return this.mI;
|
|
1841
1841
|
}
|
|
1842
1842
|
/**
|
|
1843
1843
|
* Encodes the pending clear (see clearFrameBuffer) as a render pass of its own.
|
|
1844
1844
|
* Anything recorded in the open render pass happened before the clear, so it is ended first.
|
|
1845
1845
|
*/
|
|
1846
|
-
|
|
1846
|
+
$I() {
|
|
1847
1847
|
var _a;
|
|
1848
|
-
const pendingClear = this.
|
|
1848
|
+
const pendingClear = this.dI;
|
|
1849
1849
|
if (!pendingClear.active) {
|
|
1850
1850
|
return;
|
|
1851
1851
|
}
|
|
1852
|
-
this.
|
|
1853
|
-
this.
|
|
1854
|
-
this.
|
|
1855
|
-
(_a = this.
|
|
1856
|
-
this.
|
|
1852
|
+
this.AI();
|
|
1853
|
+
this.HJ(pendingClear.engine, pendingClear.renderPass, pendingClear.displayIdx, true, false);
|
|
1854
|
+
this.aJ();
|
|
1855
|
+
(_a = this.UH) == null ? void 0 : _a.end();
|
|
1856
|
+
this.UH = void 0;
|
|
1857
1857
|
}
|
|
1858
|
-
|
|
1859
|
-
const pendingClear = this.
|
|
1858
|
+
aJ() {
|
|
1859
|
+
const pendingClear = this.dI;
|
|
1860
1860
|
pendingClear.active = false;
|
|
1861
1861
|
pendingClear.engine = void 0;
|
|
1862
1862
|
pendingClear.renderPass = void 0;
|
|
@@ -1868,26 +1868,26 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1868
1868
|
* Ends the open render pass (if any) and encodes a pending clear, so that commands can be recorded
|
|
1869
1869
|
* directly on the command encoder (copies, mipmap generation, external rendering, submission).
|
|
1870
1870
|
*/
|
|
1871
|
-
|
|
1872
|
-
this
|
|
1873
|
-
this.
|
|
1871
|
+
jI() {
|
|
1872
|
+
this.$I();
|
|
1873
|
+
this.AI();
|
|
1874
1874
|
}
|
|
1875
1875
|
/**
|
|
1876
1876
|
* Executes a render bundle in the open render pass. Bundles are batched and executed with a
|
|
1877
1877
|
* single executeBundles() call when the pass is ended or handed out for direct drawing.
|
|
1878
1878
|
*/
|
|
1879
|
-
|
|
1880
|
-
this.
|
|
1879
|
+
BI(renderBundle) {
|
|
1880
|
+
this.uJ.push(renderBundle);
|
|
1881
1881
|
}
|
|
1882
|
-
|
|
1883
|
-
const pendingRenderBundles = this.
|
|
1884
|
-
if (pendingRenderBundles.length === 0 || this.
|
|
1882
|
+
sI() {
|
|
1883
|
+
const pendingRenderBundles = this.uJ;
|
|
1884
|
+
if (pendingRenderBundles.length === 0 || this.UH == null) {
|
|
1885
1885
|
return;
|
|
1886
1886
|
}
|
|
1887
|
-
this.
|
|
1887
|
+
this.UH.executeBundles(pendingRenderBundles);
|
|
1888
1888
|
pendingRenderBundles.length = 0;
|
|
1889
1889
|
}
|
|
1890
|
-
static
|
|
1890
|
+
static _I(a, b) {
|
|
1891
1891
|
if (a.length !== b.length) {
|
|
1892
1892
|
return false;
|
|
1893
1893
|
}
|
|
@@ -1905,38 +1905,38 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1905
1905
|
* same render pass. Otherwise it belongs to a render pass that is still being recorded (the open
|
|
1906
1906
|
* encoder is just being kept for merging) and must stay pending.
|
|
1907
1907
|
*/
|
|
1908
|
-
|
|
1909
|
-
const renderPassEncoder = this.
|
|
1908
|
+
AI() {
|
|
1909
|
+
const renderPassEncoder = this.UH;
|
|
1910
1910
|
if (renderPassEncoder == null) {
|
|
1911
1911
|
return;
|
|
1912
1912
|
}
|
|
1913
|
-
this.
|
|
1914
|
-
if (this.
|
|
1915
|
-
renderPassEncoder.executeBundles([this.
|
|
1916
|
-
this.
|
|
1913
|
+
this.sI();
|
|
1914
|
+
if (this.WH != null && this.UI === this.nI && this.VI === this.oI) {
|
|
1915
|
+
renderPassEncoder.executeBundles([this.WH.finish()]);
|
|
1916
|
+
this.kI();
|
|
1917
1917
|
}
|
|
1918
1918
|
renderPassEncoder.end();
|
|
1919
|
-
this.
|
|
1920
|
-
this.
|
|
1921
|
-
this.
|
|
1922
|
-
this.
|
|
1919
|
+
this.UH = void 0;
|
|
1920
|
+
this.nI = void 0;
|
|
1921
|
+
this.oI = -1;
|
|
1922
|
+
this.SI = RENDER_PASS_TARGET_KIND_NONE;
|
|
1923
1923
|
}
|
|
1924
|
-
|
|
1924
|
+
kI() {
|
|
1925
1925
|
var _a;
|
|
1926
|
-
(_a = this.
|
|
1927
|
-
this.
|
|
1928
|
-
this.
|
|
1929
|
-
this.
|
|
1930
|
-
this.
|
|
1931
|
-
this.
|
|
1926
|
+
(_a = this.VH) == null ? void 0 : _a.abortRecording();
|
|
1927
|
+
this.WH = void 0;
|
|
1928
|
+
this.GJ();
|
|
1929
|
+
this.RI = void 0;
|
|
1930
|
+
this.UI = void 0;
|
|
1931
|
+
this.VI = -1;
|
|
1932
1932
|
}
|
|
1933
1933
|
/**
|
|
1934
1934
|
* Begins a new render pass encoder for the render pass. The caller must have ended any open encoder.
|
|
1935
1935
|
*/
|
|
1936
|
-
|
|
1936
|
+
HJ(engine, renderPass, displayIdx, mergePendingClear, useOwnClears = true) {
|
|
1937
1937
|
const framebuffer = renderPass.getFramebuffer();
|
|
1938
1938
|
const resolveFramebuffer = renderPass.getResolveFramebuffer();
|
|
1939
|
-
const pendingClear = mergePendingClear ? this.
|
|
1939
|
+
const pendingClear = mergePendingClear ? this.dI : void 0;
|
|
1940
1940
|
let clearValue;
|
|
1941
1941
|
if (useOwnClears && renderPass.toClearColorBuffer) {
|
|
1942
1942
|
clearValue = {
|
|
@@ -1959,11 +1959,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1959
1959
|
const depthLoadOp = depthClearValue != null ? "clear" : "load";
|
|
1960
1960
|
const webxrSystem = engine._webXRSystemIfEnabled;
|
|
1961
1961
|
if (resolveFramebuffer != null && framebuffer != null) {
|
|
1962
|
-
let depthTextureView = this.
|
|
1962
|
+
let depthTextureView = this.bI;
|
|
1963
1963
|
if (framebuffer.depthAttachment != null) {
|
|
1964
|
-
const depthTexture = this.
|
|
1964
|
+
const depthTexture = this.TH.get(framebuffer.depthAttachment._textureResourceUid);
|
|
1965
1965
|
if (depthTexture != null) {
|
|
1966
|
-
depthTextureView = this.
|
|
1966
|
+
depthTextureView = this.TH.get(
|
|
1967
1967
|
framebuffer.depthAttachment._textureViewResourceUid
|
|
1968
1968
|
);
|
|
1969
1969
|
}
|
|
@@ -1982,10 +1982,10 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1982
1982
|
for (let i = 0; i < resolveFramebuffer.colorAttachments.length; i++) {
|
|
1983
1983
|
const colorAttachment = framebuffer.colorAttachments[i];
|
|
1984
1984
|
const resolveColorAttachment = resolveFramebuffer.colorAttachments[i];
|
|
1985
|
-
const textureView = this.
|
|
1985
|
+
const textureView = this.TH.get(
|
|
1986
1986
|
colorAttachment._textureViewAsRenderTargetResourceUid
|
|
1987
1987
|
);
|
|
1988
|
-
let resolveTextureView = this.
|
|
1988
|
+
let resolveTextureView = this.TH.get(
|
|
1989
1989
|
resolveColorAttachment._textureViewAsRenderTargetResourceUid
|
|
1990
1990
|
);
|
|
1991
1991
|
colorAttachments.push({
|
|
@@ -1997,13 +1997,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
1997
1997
|
});
|
|
1998
1998
|
}
|
|
1999
1999
|
renderPassDescriptor.colorAttachments = colorAttachments;
|
|
2000
|
-
this.
|
|
2000
|
+
this.UH = this.rI(renderPassDescriptor);
|
|
2001
2001
|
} else if (framebuffer != null) {
|
|
2002
2002
|
let depthTextureView;
|
|
2003
2003
|
if (framebuffer.depthAttachment != null) {
|
|
2004
|
-
const depthTexture = this.
|
|
2004
|
+
const depthTexture = this.TH.get(framebuffer.depthAttachment._textureResourceUid);
|
|
2005
2005
|
if (depthTexture != null) {
|
|
2006
|
-
depthTextureView = this.
|
|
2006
|
+
depthTextureView = this.TH.get(
|
|
2007
2007
|
framebuffer.depthAttachment._textureViewAsRenderTargetResourceUid
|
|
2008
2008
|
);
|
|
2009
2009
|
}
|
|
@@ -2024,7 +2024,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2024
2024
|
};
|
|
2025
2025
|
const colorAttachments = [];
|
|
2026
2026
|
for (let colorAttachment of framebuffer.colorAttachments) {
|
|
2027
|
-
const textureView = this.
|
|
2027
|
+
const textureView = this.TH.get(
|
|
2028
2028
|
colorAttachment._textureViewAsRenderTargetResourceUid
|
|
2029
2029
|
);
|
|
2030
2030
|
colorAttachments.push({
|
|
@@ -2035,7 +2035,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2035
2035
|
});
|
|
2036
2036
|
}
|
|
2037
2037
|
renderPassDescriptor.colorAttachments = colorAttachments;
|
|
2038
|
-
this.
|
|
2038
|
+
this.UH = this.rI(renderPassDescriptor);
|
|
2039
2039
|
} else if ((webxrSystem == null ? void 0 : webxrSystem.isWebXRMode) && renderPass.isOutputForVr) {
|
|
2040
2040
|
const colorAttachments = [];
|
|
2041
2041
|
const view = engine.engineState.xrPoseWebGPU.views[displayIdx];
|
|
@@ -2059,167 +2059,167 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2059
2059
|
colorAttachments,
|
|
2060
2060
|
depthStencilAttachment
|
|
2061
2061
|
};
|
|
2062
|
-
this.
|
|
2062
|
+
this.UH = this.rI(renderPassDescriptor);
|
|
2063
2063
|
} else {
|
|
2064
2064
|
const renderPassDescriptor = {
|
|
2065
2065
|
colorAttachments: [
|
|
2066
2066
|
{
|
|
2067
|
-
view: this.
|
|
2067
|
+
view: this.zI(),
|
|
2068
2068
|
clearValue,
|
|
2069
2069
|
loadOp: colorLoadOp,
|
|
2070
2070
|
storeOp: "store"
|
|
2071
2071
|
}
|
|
2072
2072
|
],
|
|
2073
2073
|
depthStencilAttachment: {
|
|
2074
|
-
view: this.
|
|
2074
|
+
view: this.bI,
|
|
2075
2075
|
depthClearValue,
|
|
2076
2076
|
depthLoadOp,
|
|
2077
2077
|
depthStoreOp: "store"
|
|
2078
2078
|
},
|
|
2079
2079
|
label: renderPass.uniqueName
|
|
2080
2080
|
};
|
|
2081
|
-
this.
|
|
2081
|
+
this.UH = this.rI(renderPassDescriptor);
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
/**
|
|
2085
2085
|
* Drops every cached render bundle. The GPU culling allocations of the dropped bundles are released after the
|
|
2086
2086
|
* frame (a dropped bundle may already have been executed in it).
|
|
2087
2087
|
*/
|
|
2088
|
-
|
|
2088
|
+
XH() {
|
|
2089
2089
|
var _a;
|
|
2090
|
-
this.
|
|
2091
|
-
(_a = this.
|
|
2090
|
+
this.uI.clear();
|
|
2091
|
+
(_a = this.VH) == null ? void 0 : _a.retireAllBundles();
|
|
2092
2092
|
}
|
|
2093
2093
|
/**
|
|
2094
2094
|
* Caches a recorded render bundle, or drops the cache when caching is disabled.
|
|
2095
2095
|
*/
|
|
2096
|
-
|
|
2096
|
+
JJ(engine, renderBundleKey, renderBundle) {
|
|
2097
2097
|
var _a, _b;
|
|
2098
2098
|
if (engine.config.cacheWebGpuRenderBundles) {
|
|
2099
|
-
(_a = this.
|
|
2100
|
-
this.
|
|
2099
|
+
(_a = this.VH) == null ? void 0 : _a.finishRecording(renderBundleKey);
|
|
2100
|
+
this.uI.set(renderBundleKey, renderBundle);
|
|
2101
2101
|
} else {
|
|
2102
|
-
(_b = this.
|
|
2103
|
-
this.
|
|
2102
|
+
(_b = this.VH) == null ? void 0 : _b.finishRecording(void 0);
|
|
2103
|
+
this.XH();
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
-
|
|
2107
|
-
if (this.
|
|
2108
|
-
this.
|
|
2106
|
+
KJ(engine) {
|
|
2107
|
+
if (this.PI || engine.config.isGpuCullingEnabled !== this.rJ || engine.config.isComputeSkinningEnabled !== this.sJ || MeshRendererComponent._isFrustumCullingEnabled !== this.tJ) {
|
|
2108
|
+
this.XH();
|
|
2109
2109
|
engine.engineState.webgpuRenderBundleMode = false;
|
|
2110
|
-
this.
|
|
2111
|
-
this.
|
|
2112
|
-
this.
|
|
2113
|
-
this.
|
|
2114
|
-
}
|
|
2115
|
-
const storageBindGroupBuffers = this.
|
|
2116
|
-
if (this.
|
|
2117
|
-
this.
|
|
2110
|
+
this.PI = false;
|
|
2111
|
+
this.rJ = engine.config.isGpuCullingEnabled;
|
|
2112
|
+
this.sJ = engine.config.isComputeSkinningEnabled;
|
|
2113
|
+
this.tJ = MeshRendererComponent._isFrustumCullingEnabled;
|
|
2114
|
+
}
|
|
2115
|
+
const storageBindGroupBuffers = this.DI;
|
|
2116
|
+
if (this.PH != null && (storageBindGroupBuffers[0] !== this.aI || storageBindGroupBuffers[1] !== this.gI || storageBindGroupBuffers[2] !== this.ZH || storageBindGroupBuffers[3] !== this._H || storageBindGroupBuffers[4] !== this.bJ())) {
|
|
2117
|
+
this.XH();
|
|
2118
2118
|
engine.engineState.webgpuRenderBundleMode = false;
|
|
2119
2119
|
}
|
|
2120
|
-
if (engine.materialRepository.bindingStateVersion !== this.
|
|
2121
|
-
this.
|
|
2120
|
+
if (engine.materialRepository.bindingStateVersion !== this.wJ || CameraComponent.getCurrent(engine) !== this.xJ || EntityRepository.updateCount !== this.yJ || Primitive.variantUpdateCount !== this.zJ || MeshRendererComponent.updateCount !== this.AJ) {
|
|
2121
|
+
this.XH();
|
|
2122
2122
|
engine.engineState.webgpuRenderBundleMode = false;
|
|
2123
|
-
this.
|
|
2124
|
-
this.
|
|
2125
|
-
this.
|
|
2126
|
-
this.
|
|
2127
|
-
this.
|
|
2123
|
+
this.xJ = CameraComponent.getCurrent(engine);
|
|
2124
|
+
this.wJ = engine.materialRepository.bindingStateVersion;
|
|
2125
|
+
this.yJ = EntityRepository.updateCount;
|
|
2126
|
+
this.zJ = Primitive.variantUpdateCount;
|
|
2127
|
+
this.AJ = MeshRendererComponent.updateCount;
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
2130
|
renderWithRenderBundle(engine, renderPass, displayIdx) {
|
|
2131
|
-
this.
|
|
2131
|
+
this.KJ(engine);
|
|
2132
2132
|
if (renderPass._isChangedSortRenderResult || !engine.config.cacheWebGpuRenderBundles) {
|
|
2133
|
-
this.
|
|
2133
|
+
this.XH();
|
|
2134
2134
|
}
|
|
2135
2135
|
const renderBundleKey = `${renderPass.renderPassUID}-${displayIdx}`;
|
|
2136
|
-
let renderBundle = this.
|
|
2136
|
+
let renderBundle = this.uI.get(renderBundleKey);
|
|
2137
2137
|
if (renderBundle != null) {
|
|
2138
2138
|
this.createRenderPassEncoder(engine, renderPass, displayIdx);
|
|
2139
|
-
if (this.
|
|
2140
|
-
this.
|
|
2139
|
+
if (this.UH != null) {
|
|
2140
|
+
this.BI(renderBundle);
|
|
2141
2141
|
return true;
|
|
2142
2142
|
}
|
|
2143
2143
|
}
|
|
2144
2144
|
return false;
|
|
2145
2145
|
}
|
|
2146
2146
|
renderWithRenderBundleAndKeepRenderPass(engine, renderPass, displayIdx) {
|
|
2147
|
-
this.
|
|
2147
|
+
this.KJ(engine);
|
|
2148
2148
|
if (renderPass._isChangedSortRenderResult || !engine.config.cacheWebGpuRenderBundles) {
|
|
2149
|
-
this.
|
|
2149
|
+
this.XH();
|
|
2150
2150
|
}
|
|
2151
2151
|
const renderBundleKey = `${renderPass.renderPassUID}-${displayIdx}`;
|
|
2152
|
-
const renderBundle = this.
|
|
2152
|
+
const renderBundle = this.uI.get(renderBundleKey);
|
|
2153
2153
|
if (renderBundle != null) {
|
|
2154
2154
|
this.createRenderPassEncoder(engine, renderPass, displayIdx);
|
|
2155
|
-
if (this.
|
|
2156
|
-
this.
|
|
2157
|
-
this.
|
|
2158
|
-
this.
|
|
2159
|
-
return this.
|
|
2155
|
+
if (this.UH != null) {
|
|
2156
|
+
this.BI(renderBundle);
|
|
2157
|
+
this.sI();
|
|
2158
|
+
this.kI();
|
|
2159
|
+
return this.UH;
|
|
2160
2160
|
}
|
|
2161
2161
|
}
|
|
2162
2162
|
return void 0;
|
|
2163
2163
|
}
|
|
2164
2164
|
finishRenderBundleEncoder(engine, renderPass, displayIdx) {
|
|
2165
2165
|
this.createRenderPassEncoder(engine, renderPass, displayIdx);
|
|
2166
|
-
if (this.
|
|
2167
|
-
const renderBundle = this.
|
|
2168
|
-
this.
|
|
2169
|
-
this.
|
|
2170
|
-
this.
|
|
2166
|
+
if (this.UH != null && this.WH != null) {
|
|
2167
|
+
const renderBundle = this.WH.finish();
|
|
2168
|
+
this.JJ(engine, `${renderPass.renderPassUID}-${displayIdx}`, renderBundle);
|
|
2169
|
+
this.BI(renderBundle);
|
|
2170
|
+
this.kI();
|
|
2171
2171
|
} else {
|
|
2172
2172
|
console.log("renderPassEncoder is null");
|
|
2173
2173
|
}
|
|
2174
2174
|
}
|
|
2175
2175
|
finishRenderBundleEncoderAndKeepRenderPass(engine, renderPass, displayIdx) {
|
|
2176
2176
|
this.createRenderPassEncoder(engine, renderPass, displayIdx);
|
|
2177
|
-
if (this.
|
|
2178
|
-
const renderBundle = this.
|
|
2179
|
-
this.
|
|
2180
|
-
this.
|
|
2181
|
-
this.
|
|
2177
|
+
if (this.UH != null && this.WH != null) {
|
|
2178
|
+
const renderBundle = this.WH.finish();
|
|
2179
|
+
this.JJ(engine, `${renderPass.renderPassUID}-${displayIdx}`, renderBundle);
|
|
2180
|
+
this.BI(renderBundle);
|
|
2181
|
+
this.kI();
|
|
2182
2182
|
}
|
|
2183
|
-
this.
|
|
2184
|
-
return this.
|
|
2183
|
+
this.sI();
|
|
2184
|
+
return this.UH;
|
|
2185
2185
|
}
|
|
2186
2186
|
getOrCreateRenderPassEncoderForExternalRendering(engine, renderPass, displayIdx) {
|
|
2187
2187
|
this.createRenderPassEncoder(engine, renderPass, displayIdx);
|
|
2188
|
-
this.
|
|
2189
|
-
return this.
|
|
2188
|
+
this.sI();
|
|
2189
|
+
return this.UH;
|
|
2190
2190
|
}
|
|
2191
2191
|
endRenderPassEncoderForExternalRendering() {
|
|
2192
|
-
if (this.
|
|
2192
|
+
if (this.UH == null) {
|
|
2193
2193
|
return;
|
|
2194
2194
|
}
|
|
2195
|
-
this.
|
|
2196
|
-
if (this.
|
|
2197
|
-
this.
|
|
2198
|
-
this.
|
|
2195
|
+
this.sI();
|
|
2196
|
+
if (this.WH != null) {
|
|
2197
|
+
this.UH.executeBundles([this.WH.finish()]);
|
|
2198
|
+
this.kI();
|
|
2199
2199
|
}
|
|
2200
|
-
this.
|
|
2200
|
+
this.AI();
|
|
2201
2201
|
}
|
|
2202
|
-
|
|
2203
|
-
if (this.
|
|
2204
|
-
this.
|
|
2202
|
+
WJ() {
|
|
2203
|
+
if (this.QI == null) {
|
|
2204
|
+
this.QI = this.SH.gpuDevice.createShaderModule({
|
|
2205
2205
|
label: "DepthPrepass",
|
|
2206
2206
|
code: "@fragment\nfn main() {}\n"
|
|
2207
2207
|
});
|
|
2208
2208
|
}
|
|
2209
|
-
return this.
|
|
2209
|
+
return this.QI;
|
|
2210
2210
|
}
|
|
2211
2211
|
getOrCreateRenderPipeline(renderPipelineId, pipelineLayoutKey, pipelineLayout, primitive, material, renderPass, zWrite, options = {}) {
|
|
2212
2212
|
var _a, _b;
|
|
2213
2213
|
const depthOnly = (_a = options.depthOnly) != null ? _a : false;
|
|
2214
2214
|
const allowEqualDepth = (_b = options.allowEqualDepth) != null ? _b : false;
|
|
2215
2215
|
const pipelineKey = `${renderPipelineId}|${pipelineLayoutKey}|${depthOnly ? "depthOnly" : "color"}|${allowEqualDepth ? "equal" : "less"}`;
|
|
2216
|
-
const cachedPipeline = this.
|
|
2217
|
-
if (cachedPipeline != null && this.
|
|
2216
|
+
const cachedPipeline = this.EI.get(pipelineKey);
|
|
2217
|
+
if (cachedPipeline != null && this.FI.get(pipelineKey) === material.pipelineStateVersion) {
|
|
2218
2218
|
return [cachedPipeline, false];
|
|
2219
2219
|
}
|
|
2220
|
-
const gpuDevice = this.
|
|
2220
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2221
2221
|
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
|
|
2222
|
-
const modules = this.
|
|
2222
|
+
const modules = this.TH.get(material.getShaderProgramUid(primitive));
|
|
2223
2223
|
if (modules != null) {
|
|
2224
2224
|
new Error("Shader Modules is not found");
|
|
2225
2225
|
}
|
|
@@ -2242,7 +2242,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2242
2242
|
const attribute = {
|
|
2243
2243
|
shaderLocation: slotIdx,
|
|
2244
2244
|
offset: 0,
|
|
2245
|
-
format: _WebGpuResourceRepository.
|
|
2245
|
+
format: _WebGpuResourceRepository.CJ(accessor)
|
|
2246
2246
|
};
|
|
2247
2247
|
gpuVertexBufferLayouts.push({
|
|
2248
2248
|
stepMode: "vertex",
|
|
@@ -2285,7 +2285,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2285
2285
|
if (framebuffer != null) {
|
|
2286
2286
|
targets = [];
|
|
2287
2287
|
for (let colorAttachment of framebuffer.colorAttachments) {
|
|
2288
|
-
const texture = this.
|
|
2288
|
+
const texture = this.TH.get(colorAttachment._textureResourceUid);
|
|
2289
2289
|
targets.push({
|
|
2290
2290
|
format: texture.format,
|
|
2291
2291
|
blend,
|
|
@@ -2293,7 +2293,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2293
2293
|
});
|
|
2294
2294
|
}
|
|
2295
2295
|
if (framebuffer.depthAttachment != null) {
|
|
2296
|
-
const depthTexture = this.
|
|
2296
|
+
const depthTexture = this.TH.get(framebuffer.depthAttachment._textureResourceUid);
|
|
2297
2297
|
depthStencilFormat = depthTexture.format;
|
|
2298
2298
|
} else {
|
|
2299
2299
|
depthStencilFormat = void 0;
|
|
@@ -2307,7 +2307,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2307
2307
|
buffers: gpuVertexBufferLayouts
|
|
2308
2308
|
},
|
|
2309
2309
|
fragment: {
|
|
2310
|
-
module: depthOnly ? this.
|
|
2310
|
+
module: depthOnly ? this.WJ() : modules.fsModule,
|
|
2311
2311
|
entryPoint: "main",
|
|
2312
2312
|
targets: depthOnly ? targets.map((target) => ({ format: target.format, writeMask: 0 })) : targets
|
|
2313
2313
|
},
|
|
@@ -2326,8 +2326,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2326
2326
|
count: renderPass.getResolveFramebuffer() != null ? renderPass.getFramebuffer().colorAttachments[0].sampleCount : 1
|
|
2327
2327
|
}
|
|
2328
2328
|
});
|
|
2329
|
-
this.
|
|
2330
|
-
this.
|
|
2329
|
+
this.EI.set(pipelineKey, pipeline);
|
|
2330
|
+
this.FI.set(pipelineKey, material.pipelineStateVersion);
|
|
2331
2331
|
return [pipeline, true];
|
|
2332
2332
|
}
|
|
2333
2333
|
/**
|
|
@@ -2335,31 +2335,31 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2335
2335
|
* This method must be called to execute any recorded rendering commands.
|
|
2336
2336
|
*/
|
|
2337
2337
|
flush() {
|
|
2338
|
-
const gpuDevice = this.
|
|
2339
|
-
const pendingClear = this.
|
|
2340
|
-
if (pendingClear.active && !pendingClear.isColorClear && pendingClear.targetKind === RENDER_PASS_TARGET_KIND_CANVAS && pendingClear.targetViews[pendingClear.targetViews.length - 1] === this.
|
|
2341
|
-
this.
|
|
2342
|
-
this.
|
|
2343
|
-
}
|
|
2344
|
-
this.
|
|
2345
|
-
const gpuTimer = this.
|
|
2346
|
-
const gpuCulling = this.
|
|
2347
|
-
const cullingCommands = gpuCulling == null ? void 0 : gpuCulling.encode(this.
|
|
2348
|
-
blendShapeData: this.
|
|
2349
|
-
morphOffsets: this.
|
|
2350
|
-
morphWeights: this.
|
|
2338
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2339
|
+
const pendingClear = this.dI;
|
|
2340
|
+
if (pendingClear.active && !pendingClear.isColorClear && pendingClear.targetKind === RENDER_PASS_TARGET_KIND_CANVAS && pendingClear.targetViews[pendingClear.targetViews.length - 1] === this.bI) {
|
|
2341
|
+
this.wI = pendingClear.clearDepth;
|
|
2342
|
+
this.aJ();
|
|
2343
|
+
}
|
|
2344
|
+
this.jI();
|
|
2345
|
+
const gpuTimer = this.mI;
|
|
2346
|
+
const gpuCulling = this.VH;
|
|
2347
|
+
const cullingCommands = gpuCulling == null ? void 0 : gpuCulling.encode(this.aI, gpuTimer, {
|
|
2348
|
+
blendShapeData: this.gI,
|
|
2349
|
+
morphOffsets: this.ZH,
|
|
2350
|
+
morphWeights: this._H
|
|
2351
2351
|
});
|
|
2352
|
-
gpuTimer == null ? void 0 : gpuTimer.encodeResolve(this.
|
|
2353
|
-
const commands = this.
|
|
2354
|
-
this.
|
|
2352
|
+
gpuTimer == null ? void 0 : gpuTimer.encodeResolve(this.YH);
|
|
2353
|
+
const commands = this.YH.finish();
|
|
2354
|
+
this.qJ.submit(cullingCommands != null ? [cullingCommands, commands] : [commands]);
|
|
2355
2355
|
gpuTimer == null ? void 0 : gpuTimer.afterSubmit();
|
|
2356
|
-
this.
|
|
2356
|
+
this.YH = gpuDevice.createCommandEncoder();
|
|
2357
2357
|
if (gpuCulling == null ? void 0 : gpuCulling.afterSubmit()) {
|
|
2358
|
-
this.
|
|
2359
|
-
this.
|
|
2358
|
+
this.XH();
|
|
2359
|
+
this.PI = true;
|
|
2360
2360
|
}
|
|
2361
|
-
if (this.
|
|
2362
|
-
this.
|
|
2361
|
+
if (this.yI != null) {
|
|
2362
|
+
this.yI = void 0;
|
|
2363
2363
|
}
|
|
2364
2364
|
}
|
|
2365
2365
|
setColorWriteMask(material) {
|
|
@@ -2526,7 +2526,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2526
2526
|
}
|
|
2527
2527
|
mipmaps.push(imageBitmaps);
|
|
2528
2528
|
}
|
|
2529
|
-
const gpuDevice = this.
|
|
2529
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2530
2530
|
const isHdrLinear = ((_a = mipmaps[0][0]) == null ? void 0 : _a.hdriFormat) === HdriFormat.HDR_LINEAR;
|
|
2531
2531
|
const cubemapFormat = isHdrLinear ? gpuDevice.features.has("float32-filterable") ? "rgba32float" : "rgba16float" : "rgba8unorm";
|
|
2532
2532
|
const cubemapTexture = gpuDevice.createTexture({
|
|
@@ -2583,7 +2583,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
const handle = this.
|
|
2586
|
+
const handle = this.DD(cubemapTexture);
|
|
2587
2587
|
const wrapS = TextureParameter.Repeat;
|
|
2588
2588
|
const wrapT = TextureParameter.Repeat;
|
|
2589
2589
|
const minFilter = mipLevelCount === 1 ? TextureParameter.Linear : TextureParameter.LinearMipmapLinear;
|
|
@@ -2604,7 +2604,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2604
2604
|
* @returns texture handle
|
|
2605
2605
|
*/
|
|
2606
2606
|
createTextureArray(width, height, arrayLength, mipLevelCount, internalFormat, _format, _type, imageData) {
|
|
2607
|
-
const gpuDevice = this.
|
|
2607
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2608
2608
|
const textureDescriptor = {
|
|
2609
2609
|
size: [width, height, arrayLength],
|
|
2610
2610
|
format: internalFormat.webgpu,
|
|
@@ -2639,7 +2639,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2639
2639
|
[width, height, 1]
|
|
2640
2640
|
);
|
|
2641
2641
|
}
|
|
2642
|
-
const textureHandle = this.
|
|
2642
|
+
const textureHandle = this.DD(gpuTexture);
|
|
2643
2643
|
return textureHandle;
|
|
2644
2644
|
}
|
|
2645
2645
|
/**
|
|
@@ -2650,7 +2650,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2650
2650
|
* @returns Handle to the created storage buffer resource
|
|
2651
2651
|
*/
|
|
2652
2652
|
createStorageBuffer(gpuInstanceDataBuffers) {
|
|
2653
|
-
const gpuDevice = this.
|
|
2653
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2654
2654
|
const storageBuffer = gpuDevice.createBuffer({
|
|
2655
2655
|
size: gpuInstanceDataBuffers.reduce((acc, buffer) => acc + buffer.byteLength, 0),
|
|
2656
2656
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
@@ -2659,13 +2659,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2659
2659
|
for (let i = 0; i < gpuInstanceDataBuffers.length; i++) {
|
|
2660
2660
|
const buffer = gpuInstanceDataBuffers[i];
|
|
2661
2661
|
const inputArray = new Float32Array(buffer.getArrayBuffer());
|
|
2662
|
-
_WebGpuResourceRepository
|
|
2662
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2663
2663
|
const copySize = i === gpuInstanceDataBuffers.length - 1 ? buffer.takenSizeInByte : buffer.byteLength;
|
|
2664
2664
|
gpuDevice.queue.writeBuffer(storageBuffer, offset, inputArray, 0, copySize / 4);
|
|
2665
2665
|
offset += copySize;
|
|
2666
2666
|
}
|
|
2667
|
-
this.
|
|
2668
|
-
const storageBufferHandle = this.
|
|
2667
|
+
this.aI = storageBuffer;
|
|
2668
|
+
const storageBufferHandle = this.DD(storageBuffer);
|
|
2669
2669
|
return storageBufferHandle;
|
|
2670
2670
|
}
|
|
2671
2671
|
/**
|
|
@@ -2676,13 +2676,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2676
2676
|
* @param gpuInstanceDataBuffers - New data to write to the buffer
|
|
2677
2677
|
*/
|
|
2678
2678
|
updateStorageBuffer(storageBufferHandle, gpuInstanceDataBuffers, excludedByteRanges = []) {
|
|
2679
|
-
const gpuDevice = this.
|
|
2680
|
-
const storageBuffer = this.
|
|
2679
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2680
|
+
const storageBuffer = this.TH.get(storageBufferHandle);
|
|
2681
2681
|
let offset = 0;
|
|
2682
2682
|
for (let i = 0; i < gpuInstanceDataBuffers.length; i++) {
|
|
2683
2683
|
const buffer = gpuInstanceDataBuffers[i];
|
|
2684
2684
|
const inputArray = new Float32Array(buffer.getArrayBuffer());
|
|
2685
|
-
_WebGpuResourceRepository
|
|
2685
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2686
2686
|
const copySize = i === gpuInstanceDataBuffers.length - 1 ? buffer.takenSizeInByte : buffer.byteLength;
|
|
2687
2687
|
for (const [start, end] of subtractByteRanges(offset, offset + copySize, excludedByteRanges)) {
|
|
2688
2688
|
gpuDevice.queue.writeBuffer(storageBuffer, start, inputArray, (start - offset) / 4, (end - start) / 4);
|
|
@@ -2698,8 +2698,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2698
2698
|
* @param byteRanges - The ranges `[start, end)` in the concatenated layers. A range must not span layers.
|
|
2699
2699
|
*/
|
|
2700
2700
|
updateStorageBufferRanges(storageBufferHandle, gpuInstanceDataBuffers, byteRanges) {
|
|
2701
|
-
const gpuDevice = this.
|
|
2702
|
-
const storageBuffer = this.
|
|
2701
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2702
|
+
const storageBuffer = this.TH.get(storageBufferHandle);
|
|
2703
2703
|
for (const [start, end] of byteRanges) {
|
|
2704
2704
|
let layerStart = 0;
|
|
2705
2705
|
for (const buffer of gpuInstanceDataBuffers) {
|
|
@@ -2719,15 +2719,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2719
2719
|
* @internal
|
|
2720
2720
|
*/
|
|
2721
2721
|
_getStorageBuffer() {
|
|
2722
|
-
return this.
|
|
2722
|
+
return this.aI;
|
|
2723
2723
|
}
|
|
2724
2724
|
destroyStorageBuffer(storageBufferHandle) {
|
|
2725
|
-
const storageBuffer = this.
|
|
2725
|
+
const storageBuffer = this.TH.get(storageBufferHandle);
|
|
2726
2726
|
if (storageBuffer == null) {
|
|
2727
2727
|
return;
|
|
2728
2728
|
}
|
|
2729
2729
|
storageBuffer.destroy();
|
|
2730
|
-
this.
|
|
2730
|
+
this.TH.delete(storageBufferHandle);
|
|
2731
2731
|
}
|
|
2732
2732
|
/**
|
|
2733
2733
|
* Updates a portion of a storage buffer with new data at a specific offset.
|
|
@@ -2740,9 +2740,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2740
2740
|
* @param updateComponentSize - Number of components to update
|
|
2741
2741
|
*/
|
|
2742
2742
|
updateStorageBufferPartially(storageBufferHandle, inputArray, offsetOfStorageBufferInByte, offsetOfInputArrayInElement, updateComponentSize) {
|
|
2743
|
-
const gpuDevice = this.
|
|
2744
|
-
const storageBuffer = this.
|
|
2745
|
-
_WebGpuResourceRepository
|
|
2743
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2744
|
+
const storageBuffer = this.TH.get(storageBufferHandle);
|
|
2745
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2746
2746
|
gpuDevice.queue.writeBuffer(
|
|
2747
2747
|
storageBuffer,
|
|
2748
2748
|
offsetOfStorageBufferInByte,
|
|
@@ -2752,33 +2752,33 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2752
2752
|
);
|
|
2753
2753
|
}
|
|
2754
2754
|
createStorageBlendShapeBuffer(inputArray) {
|
|
2755
|
-
const gpuDevice = this.
|
|
2755
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2756
2756
|
const storageBuffer = gpuDevice.createBuffer({
|
|
2757
2757
|
size: inputArray.byteLength,
|
|
2758
2758
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE
|
|
2759
2759
|
});
|
|
2760
|
-
_WebGpuResourceRepository
|
|
2760
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2761
2761
|
gpuDevice.queue.writeBuffer(storageBuffer, 0, inputArray);
|
|
2762
|
-
this.
|
|
2763
|
-
const storageBufferHandle = this.
|
|
2762
|
+
this.gI = storageBuffer;
|
|
2763
|
+
const storageBufferHandle = this.DD(storageBuffer);
|
|
2764
2764
|
return storageBufferHandle;
|
|
2765
2765
|
}
|
|
2766
2766
|
deleteStorageBlendShapeBuffer(storageBufferHandle) {
|
|
2767
|
-
const storageBuffer = this.
|
|
2767
|
+
const storageBuffer = this.TH.get(storageBufferHandle);
|
|
2768
2768
|
if (storageBuffer == null) {
|
|
2769
2769
|
return;
|
|
2770
2770
|
}
|
|
2771
2771
|
storageBuffer.destroy();
|
|
2772
|
-
this.
|
|
2772
|
+
this.TH.delete(storageBufferHandle);
|
|
2773
2773
|
}
|
|
2774
2774
|
updateStorageBlendShapeBuffer(storageBufferHandle, inputArray, updateComponentSize) {
|
|
2775
|
-
const gpuDevice = this.
|
|
2776
|
-
const storageBuffer = this.
|
|
2777
|
-
_WebGpuResourceRepository
|
|
2775
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2776
|
+
const storageBuffer = this.TH.get(storageBufferHandle);
|
|
2777
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2778
2778
|
gpuDevice.queue.writeBuffer(storageBuffer, 0, inputArray, 0, updateComponentSize);
|
|
2779
2779
|
}
|
|
2780
2780
|
createBindGroupLayoutForDrawParameters() {
|
|
2781
|
-
const gpuDevice = this.
|
|
2781
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2782
2782
|
{
|
|
2783
2783
|
const bindGroupLayoutDesc = {
|
|
2784
2784
|
entries: [
|
|
@@ -2792,7 +2792,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2792
2792
|
]
|
|
2793
2793
|
};
|
|
2794
2794
|
const bindGroupLayout = gpuDevice.createBindGroupLayout(bindGroupLayoutDesc);
|
|
2795
|
-
this.
|
|
2795
|
+
this.LI = bindGroupLayout;
|
|
2796
2796
|
}
|
|
2797
2797
|
}
|
|
2798
2798
|
/**
|
|
@@ -2809,31 +2809,31 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2809
2809
|
* processGeometry), for a draw of the vertices deformed by the GPU culling's compute shader
|
|
2810
2810
|
*/
|
|
2811
2811
|
setDrawParameters(materialSid, cameraSID, currentPrimitiveIdx, morphTargetNumber, deformedVertexOffset = 0) {
|
|
2812
|
-
const lastDrawParameters = this.
|
|
2812
|
+
const lastDrawParameters = this.jJ;
|
|
2813
2813
|
lastDrawParameters[0] = materialSid;
|
|
2814
2814
|
lastDrawParameters[1] = cameraSID;
|
|
2815
2815
|
lastDrawParameters[2] = currentPrimitiveIdx;
|
|
2816
2816
|
lastDrawParameters[3] = morphTargetNumber;
|
|
2817
2817
|
const key = `${materialSid},${cameraSID},${currentPrimitiveIdx},${morphTargetNumber},${deformedVertexOffset}`;
|
|
2818
|
-
let bindGroup = this.
|
|
2818
|
+
let bindGroup = this.iJ.get(key);
|
|
2819
2819
|
if (bindGroup == null) {
|
|
2820
|
-
const gpuDevice = this.
|
|
2821
|
-
const entriesPerBuffer = _WebGpuResourceRepository.
|
|
2820
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2821
|
+
const entriesPerBuffer = _WebGpuResourceRepository.MJ;
|
|
2822
2822
|
const stride = Math.max(
|
|
2823
2823
|
gpuDevice.limits.minUniformBufferOffsetAlignment,
|
|
2824
|
-
_WebGpuResourceRepository.
|
|
2824
|
+
_WebGpuResourceRepository.KI
|
|
2825
2825
|
);
|
|
2826
|
-
let uniformBuffer = this
|
|
2827
|
-
if (uniformBuffer == null || this.
|
|
2826
|
+
let uniformBuffer = this.II[this.II.length - 1];
|
|
2827
|
+
if (uniformBuffer == null || this.JI >= entriesPerBuffer) {
|
|
2828
2828
|
uniformBuffer = gpuDevice.createBuffer({
|
|
2829
2829
|
size: stride * entriesPerBuffer,
|
|
2830
2830
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM
|
|
2831
2831
|
});
|
|
2832
|
-
this
|
|
2833
|
-
this.
|
|
2832
|
+
this.II.push(uniformBuffer);
|
|
2833
|
+
this.JI = 0;
|
|
2834
2834
|
}
|
|
2835
|
-
const offset = stride * this.
|
|
2836
|
-
const values = _WebGpuResourceRepository.
|
|
2835
|
+
const offset = stride * this.JI++;
|
|
2836
|
+
const values = _WebGpuResourceRepository.NJ;
|
|
2837
2837
|
values[0] = materialSid;
|
|
2838
2838
|
values[1] = cameraSID;
|
|
2839
2839
|
values[2] = currentPrimitiveIdx;
|
|
@@ -2841,83 +2841,83 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2841
2841
|
values[4] = deformedVertexOffset;
|
|
2842
2842
|
gpuDevice.queue.writeBuffer(uniformBuffer, offset, values);
|
|
2843
2843
|
bindGroup = gpuDevice.createBindGroup({
|
|
2844
|
-
layout: this.
|
|
2844
|
+
layout: this.LI,
|
|
2845
2845
|
entries: [
|
|
2846
2846
|
{
|
|
2847
2847
|
binding: 0,
|
|
2848
2848
|
resource: {
|
|
2849
2849
|
buffer: uniformBuffer,
|
|
2850
2850
|
offset,
|
|
2851
|
-
size: _WebGpuResourceRepository.
|
|
2851
|
+
size: _WebGpuResourceRepository.KI
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
2854
2854
|
]
|
|
2855
2855
|
});
|
|
2856
|
-
this.
|
|
2856
|
+
this.iJ.set(key, bindGroup);
|
|
2857
2857
|
}
|
|
2858
|
-
this.
|
|
2858
|
+
this.kJ = bindGroup;
|
|
2859
2859
|
}
|
|
2860
2860
|
/**
|
|
2861
2861
|
* Selects the draw parameters of the last setDrawParameters() call with another deformed vertex offset.
|
|
2862
2862
|
*/
|
|
2863
|
-
|
|
2864
|
-
const p = this.
|
|
2863
|
+
TJ(deformedVertexOffset) {
|
|
2864
|
+
const p = this.jJ;
|
|
2865
2865
|
this.setDrawParameters(p[0], p[1], p[2], p[3], deformedVertexOffset);
|
|
2866
2866
|
}
|
|
2867
2867
|
createUniformMorphOffsetsBuffer(sizeInByte) {
|
|
2868
|
-
const gpuDevice = this.
|
|
2868
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2869
2869
|
const uniformBuffer = gpuDevice.createBuffer({
|
|
2870
2870
|
size: sizeInByte,
|
|
2871
2871
|
// STORAGE: also read by the vertex deformation compute shader (WebGpuVertexDeformer).
|
|
2872
2872
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM | GPUBufferUsage.STORAGE
|
|
2873
2873
|
});
|
|
2874
|
-
this.
|
|
2875
|
-
const uniformBufferHandle = this.
|
|
2874
|
+
this.ZH = uniformBuffer;
|
|
2875
|
+
const uniformBufferHandle = this.DD(uniformBuffer);
|
|
2876
2876
|
return uniformBufferHandle;
|
|
2877
2877
|
}
|
|
2878
2878
|
updateUniformMorphOffsetsBuffer(inputArray, elementNum) {
|
|
2879
|
-
const gpuDevice = this.
|
|
2880
|
-
if (this.
|
|
2879
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2880
|
+
if (this.ZH == null) {
|
|
2881
2881
|
throw new Error("Not found uniform morph buffer.");
|
|
2882
2882
|
}
|
|
2883
|
-
_WebGpuResourceRepository
|
|
2884
|
-
gpuDevice.queue.writeBuffer(this.
|
|
2883
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2884
|
+
gpuDevice.queue.writeBuffer(this.ZH, 0, inputArray, 0, elementNum);
|
|
2885
2885
|
}
|
|
2886
2886
|
createUniformMorphWeightsBuffer(sizeInByte) {
|
|
2887
|
-
const gpuDevice = this.
|
|
2887
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2888
2888
|
const uniformBuffer = gpuDevice.createBuffer({
|
|
2889
2889
|
size: sizeInByte,
|
|
2890
2890
|
// STORAGE: also read by the vertex deformation compute shader (WebGpuVertexDeformer).
|
|
2891
2891
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM | GPUBufferUsage.STORAGE
|
|
2892
2892
|
});
|
|
2893
|
-
this.
|
|
2894
|
-
const uniformBufferHandle = this.
|
|
2893
|
+
this._H = uniformBuffer;
|
|
2894
|
+
const uniformBufferHandle = this.DD(uniformBuffer);
|
|
2895
2895
|
return uniformBufferHandle;
|
|
2896
2896
|
}
|
|
2897
2897
|
updateUniformMorphWeightsBuffer(inputArray, elementNum) {
|
|
2898
|
-
const gpuDevice = this.
|
|
2899
|
-
if (this.
|
|
2898
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2899
|
+
if (this._H == null) {
|
|
2900
2900
|
throw new Error("Not found uniform morph buffer.");
|
|
2901
2901
|
}
|
|
2902
|
-
_WebGpuResourceRepository
|
|
2903
|
-
gpuDevice.queue.writeBuffer(this.
|
|
2902
|
+
_WebGpuResourceRepository.$H(inputArray);
|
|
2903
|
+
gpuDevice.queue.writeBuffer(this._H, 0, inputArray, 0, elementNum);
|
|
2904
2904
|
}
|
|
2905
2905
|
deleteUniformBuffer(uniformBufferHandle) {
|
|
2906
|
-
const uniformBuffer = this.
|
|
2906
|
+
const uniformBuffer = this.TH.get(uniformBufferHandle);
|
|
2907
2907
|
if (uniformBuffer == null) {
|
|
2908
2908
|
return;
|
|
2909
2909
|
}
|
|
2910
2910
|
uniformBuffer.destroy();
|
|
2911
|
-
this.
|
|
2911
|
+
this.TH.delete(uniformBufferHandle);
|
|
2912
2912
|
}
|
|
2913
2913
|
/**
|
|
2914
2914
|
* Returns a stable identifier of a GPU object for cache keys.
|
|
2915
2915
|
*/
|
|
2916
|
-
|
|
2917
|
-
let id = this.
|
|
2916
|
+
LJ(obj) {
|
|
2917
|
+
let id = this.mJ.get(obj);
|
|
2918
2918
|
if (id === void 0) {
|
|
2919
|
-
id = ++this.
|
|
2920
|
-
this.
|
|
2919
|
+
id = ++this.OJ;
|
|
2920
|
+
this.mJ.set(obj, id);
|
|
2921
2921
|
}
|
|
2922
2922
|
return id;
|
|
2923
2923
|
}
|
|
@@ -2925,22 +2925,22 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2925
2925
|
* Returns the bind group layout for the given descriptor, shared by every bind group and pipeline
|
|
2926
2926
|
* layout with the same descriptor.
|
|
2927
2927
|
*/
|
|
2928
|
-
|
|
2929
|
-
let layout = this.
|
|
2928
|
+
cJ(key, entries) {
|
|
2929
|
+
let layout = this.tI.get(key);
|
|
2930
2930
|
if (layout == null) {
|
|
2931
|
-
layout = this.
|
|
2932
|
-
this.
|
|
2931
|
+
layout = this.SH.gpuDevice.createBindGroupLayout({ entries });
|
|
2932
|
+
this.tI.set(key, layout);
|
|
2933
2933
|
}
|
|
2934
2934
|
return layout;
|
|
2935
2935
|
}
|
|
2936
2936
|
/**
|
|
2937
2937
|
* Returns the view of a dummy texture with the given dimension. The view is created once per texture.
|
|
2938
2938
|
*/
|
|
2939
|
-
|
|
2940
|
-
let views = this.
|
|
2939
|
+
XJ(gpuTexture, dimension) {
|
|
2940
|
+
let views = this.lJ.get(gpuTexture);
|
|
2941
2941
|
if (views == null) {
|
|
2942
2942
|
views = /* @__PURE__ */ new Map();
|
|
2943
|
-
this.
|
|
2943
|
+
this.lJ.set(gpuTexture, views);
|
|
2944
2944
|
}
|
|
2945
2945
|
let view = views.get(dimension);
|
|
2946
2946
|
if (view == null) {
|
|
@@ -2952,61 +2952,61 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
2952
2952
|
/**
|
|
2953
2953
|
* The buffer bound at group 0, binding 4: the vertices deformed by the GPU culling, or a dummy buffer without it.
|
|
2954
2954
|
*/
|
|
2955
|
-
|
|
2955
|
+
bJ() {
|
|
2956
2956
|
var _a, _b, _c;
|
|
2957
|
-
const deformedVerticesBuffer = (_a = this.
|
|
2957
|
+
const deformedVerticesBuffer = (_a = this.VH) == null ? void 0 : _a.deformedVerticesBuffer;
|
|
2958
2958
|
if (deformedVerticesBuffer != null) {
|
|
2959
2959
|
return deformedVerticesBuffer;
|
|
2960
2960
|
}
|
|
2961
|
-
(_c = this[_b = "
|
|
2961
|
+
(_c = this[_b = "gJ"]) != null ? _c : this[_b] = this.SH.gpuDevice.createBuffer({
|
|
2962
2962
|
size: 32,
|
|
2963
2963
|
usage: GPUBufferUsage.STORAGE
|
|
2964
2964
|
});
|
|
2965
|
-
return this.
|
|
2965
|
+
return this.gJ;
|
|
2966
2966
|
}
|
|
2967
2967
|
/**
|
|
2968
2968
|
* Returns the group 0 bind group (storage buffer, blend shape buffer, morph uniform buffers, deformed vertices).
|
|
2969
2969
|
* It is recreated only when one of those buffers is replaced.
|
|
2970
2970
|
*/
|
|
2971
|
-
|
|
2971
|
+
YJ() {
|
|
2972
2972
|
var _a, _b;
|
|
2973
|
-
const buffers = this.
|
|
2974
|
-
if (this.
|
|
2975
|
-
return this.
|
|
2976
|
-
}
|
|
2977
|
-
buffers[0] = this.
|
|
2978
|
-
buffers[1] = this.
|
|
2979
|
-
buffers[2] = this.
|
|
2980
|
-
buffers[3] = this.
|
|
2981
|
-
buffers[4] = this.
|
|
2982
|
-
const gpuDevice = this.
|
|
2973
|
+
const buffers = this.DI;
|
|
2974
|
+
if (this.PH != null && buffers[0] === this.aI && buffers[1] === this.gI && buffers[2] === this.ZH && buffers[3] === this._H && buffers[4] === this.bJ()) {
|
|
2975
|
+
return this.PH;
|
|
2976
|
+
}
|
|
2977
|
+
buffers[0] = this.aI;
|
|
2978
|
+
buffers[1] = this.gI;
|
|
2979
|
+
buffers[2] = this.ZH;
|
|
2980
|
+
buffers[3] = this._H;
|
|
2981
|
+
buffers[4] = this.bJ();
|
|
2982
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
2983
2983
|
const visibility = GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT;
|
|
2984
2984
|
const entries = [];
|
|
2985
2985
|
const layoutEntries = [];
|
|
2986
2986
|
let layoutKey = "";
|
|
2987
|
-
if (this.
|
|
2988
|
-
entries.push({ binding: 0, resource: { buffer: this.
|
|
2987
|
+
if (this.aI != null) {
|
|
2988
|
+
entries.push({ binding: 0, resource: { buffer: this.aI } });
|
|
2989
2989
|
layoutEntries.push({ binding: 0, buffer: { type: "read-only-storage" }, visibility });
|
|
2990
2990
|
layoutKey += "s";
|
|
2991
2991
|
}
|
|
2992
|
-
let blendShapeBuffer = this.
|
|
2992
|
+
let blendShapeBuffer = this.gI;
|
|
2993
2993
|
if (blendShapeBuffer == null) {
|
|
2994
|
-
(_b = this[_a = "
|
|
2994
|
+
(_b = this[_a = "fJ"]) != null ? _b : this[_a] = gpuDevice.createBuffer({
|
|
2995
2995
|
size: 16,
|
|
2996
2996
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE
|
|
2997
2997
|
});
|
|
2998
|
-
blendShapeBuffer = this.
|
|
2998
|
+
blendShapeBuffer = this.fJ;
|
|
2999
2999
|
}
|
|
3000
3000
|
entries.push({ binding: 1, resource: { buffer: blendShapeBuffer } });
|
|
3001
3001
|
layoutEntries.push({ binding: 1, buffer: { type: "read-only-storage" }, visibility });
|
|
3002
3002
|
layoutKey += "b";
|
|
3003
|
-
if (this.
|
|
3004
|
-
entries.push({ binding: 2, resource: { buffer: this.
|
|
3003
|
+
if (this.ZH != null) {
|
|
3004
|
+
entries.push({ binding: 2, resource: { buffer: this.ZH } });
|
|
3005
3005
|
layoutEntries.push({ binding: 2, buffer: { type: "uniform" }, visibility });
|
|
3006
3006
|
layoutKey += "o";
|
|
3007
3007
|
}
|
|
3008
|
-
if (this.
|
|
3009
|
-
entries.push({ binding: 3, resource: { buffer: this.
|
|
3008
|
+
if (this._H != null) {
|
|
3009
|
+
entries.push({ binding: 3, resource: { buffer: this._H } });
|
|
3010
3010
|
layoutEntries.push({ binding: 3, buffer: { type: "uniform" }, visibility });
|
|
3011
3011
|
layoutKey += "w";
|
|
3012
3012
|
}
|
|
@@ -3014,18 +3014,18 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3014
3014
|
layoutEntries.push({ binding: 4, buffer: { type: "read-only-storage" }, visibility: GPUShaderStage.VERTEX });
|
|
3015
3015
|
layoutKey += "d";
|
|
3016
3016
|
layoutKey = `storage:${layoutKey}`;
|
|
3017
|
-
const layout = this.
|
|
3018
|
-
this.
|
|
3019
|
-
this.
|
|
3020
|
-
this.
|
|
3021
|
-
this.
|
|
3022
|
-
return this.
|
|
3017
|
+
const layout = this.cJ(layoutKey, layoutEntries);
|
|
3018
|
+
this.PH = gpuDevice.createBindGroup({ layout, entries });
|
|
3019
|
+
this.dJ = layout;
|
|
3020
|
+
this.eJ = layoutKey;
|
|
3021
|
+
this.XH();
|
|
3022
|
+
return this.PH;
|
|
3023
3023
|
}
|
|
3024
3024
|
/**
|
|
3025
3025
|
* Appends a texture binding and its sampler to `__textureSamplerBindings`.
|
|
3026
3026
|
*/
|
|
3027
|
-
|
|
3028
|
-
const bindings = this.
|
|
3027
|
+
CI(slot, dimension, visibility, view, sampler) {
|
|
3028
|
+
const bindings = this.lI;
|
|
3029
3029
|
const i = bindings.count++;
|
|
3030
3030
|
bindings.slots[i] = slot;
|
|
3031
3031
|
bindings.dimensions[i] = dimension;
|
|
@@ -3037,9 +3037,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3037
3037
|
* Collects the textures and samplers bound by a material into `__textureSamplerBindings`.
|
|
3038
3038
|
* The IBL cube maps come from the mesh renderer component, not from the material.
|
|
3039
3039
|
*/
|
|
3040
|
-
|
|
3041
|
-
this.
|
|
3042
|
-
const resources = this.
|
|
3040
|
+
ZJ(engine, material, diffuseCubeMap, specularCubeMap, sheenCubeMap) {
|
|
3041
|
+
this.lI.count = 0;
|
|
3042
|
+
const resources = this.TH;
|
|
3043
3043
|
const visibility = GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT;
|
|
3044
3044
|
const dummyTextures = engine.dummyTextures;
|
|
3045
3045
|
for (const value of material._autoTextureFieldVariablesOnly.values()) {
|
|
@@ -3063,13 +3063,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3063
3063
|
if (gpuTextureView == null) {
|
|
3064
3064
|
const dummyTexture = dimension === "cube" ? dummyTextures.dummyBlackCubeTexture : dummyTextures.dummyWhiteTexture;
|
|
3065
3065
|
const gpuTexture = resources.get(dummyTexture._textureResourceUid);
|
|
3066
|
-
gpuTextureView = this.
|
|
3066
|
+
gpuTextureView = this.XJ(gpuTexture, dimension);
|
|
3067
3067
|
}
|
|
3068
3068
|
if (!sampler.created) {
|
|
3069
3069
|
sampler.create();
|
|
3070
3070
|
}
|
|
3071
3071
|
const gpuSampler = resources.get(sampler._samplerResourceUid);
|
|
3072
|
-
this.
|
|
3072
|
+
this.CI(slot, dimension, visibility, gpuTextureView, gpuSampler);
|
|
3073
3073
|
}
|
|
3074
3074
|
const dummyCubeTexture = dummyTextures.dummyBlackCubeTexture;
|
|
3075
3075
|
const dummyCubeTextureView = () => resources.get(dummyCubeTexture._textureViewResourceUid);
|
|
@@ -3078,7 +3078,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3078
3078
|
if (Is.exist(diffuseEnvValue)) {
|
|
3079
3079
|
const view = resources.get(Is.exist(diffuseCubeMap) ? diffuseCubeMap._textureViewResourceUid : -1);
|
|
3080
3080
|
const sampler = resources.get(Is.exist(diffuseCubeMap) ? diffuseCubeMap._samplerResourceUid : -1);
|
|
3081
|
-
this.
|
|
3081
|
+
this.CI(
|
|
3082
3082
|
diffuseEnvValue[0],
|
|
3083
3083
|
"cube",
|
|
3084
3084
|
visibility,
|
|
@@ -3090,7 +3090,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3090
3090
|
if (Is.exist(specularEnvValue)) {
|
|
3091
3091
|
const view = resources.get(Is.exist(specularCubeMap) ? specularCubeMap._textureViewResourceUid : -1);
|
|
3092
3092
|
const sampler = resources.get(Is.exist(specularCubeMap) ? specularCubeMap._samplerResourceUid : -1);
|
|
3093
|
-
this.
|
|
3093
|
+
this.CI(
|
|
3094
3094
|
specularEnvValue[0],
|
|
3095
3095
|
"cube",
|
|
3096
3096
|
visibility,
|
|
@@ -3103,7 +3103,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3103
3103
|
const sheenSource = Is.exist(sheenCubeMap) ? sheenCubeMap : specularCubeMap;
|
|
3104
3104
|
const view = Is.exist(sheenSource) ? resources.get(sheenSource._textureViewResourceUid) : void 0;
|
|
3105
3105
|
const sampler = Is.exist(sheenSource) ? resources.get(sheenSource._samplerResourceUid) : void 0;
|
|
3106
|
-
this.
|
|
3106
|
+
this.CI(
|
|
3107
3107
|
sheenEnvValue[0],
|
|
3108
3108
|
"cube",
|
|
3109
3109
|
GPUShaderStage.FRAGMENT,
|
|
@@ -3119,10 +3119,10 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3119
3119
|
* so materials binding the same textures and samplers share them. They do not depend on the render
|
|
3120
3120
|
* pipeline, so a pipeline can be recreated without recreating bind groups and vice versa.
|
|
3121
3121
|
*/
|
|
3122
|
-
|
|
3123
|
-
const storage = this.
|
|
3124
|
-
this.
|
|
3125
|
-
const bindings = this.
|
|
3122
|
+
RJ(engine, material, diffuseCubeMap, specularCubeMap, sheenCubeMap) {
|
|
3123
|
+
const storage = this.YJ();
|
|
3124
|
+
this.ZJ(engine, material, diffuseCubeMap, specularCubeMap, sheenCubeMap);
|
|
3125
|
+
const bindings = this.lI;
|
|
3126
3126
|
let textureLayoutKey = "texture:";
|
|
3127
3127
|
let samplerLayoutKey = "sampler:";
|
|
3128
3128
|
let textureResourceKey = "";
|
|
@@ -3130,48 +3130,48 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3130
3130
|
for (let i = 0; i < bindings.count; i++) {
|
|
3131
3131
|
textureLayoutKey += `${bindings.slots[i]}/${bindings.dimensions[i]}/${bindings.visibilities[i]},`;
|
|
3132
3132
|
samplerLayoutKey += `${bindings.slots[i]}/${bindings.visibilities[i]},`;
|
|
3133
|
-
textureResourceKey += `${this.
|
|
3134
|
-
samplerResourceKey += `${this.
|
|
3133
|
+
textureResourceKey += `${this.LJ(bindings.views[i])},`;
|
|
3134
|
+
samplerResourceKey += `${this.LJ(bindings.samplers[i])},`;
|
|
3135
3135
|
}
|
|
3136
3136
|
const textureBindGroupKey = `${textureLayoutKey}|${textureResourceKey}`;
|
|
3137
|
-
let texture = this.
|
|
3138
|
-
const textureLayout = this.
|
|
3137
|
+
let texture = this.GI.get(textureBindGroupKey);
|
|
3138
|
+
const textureLayout = this._J(textureLayoutKey);
|
|
3139
3139
|
if (texture == null) {
|
|
3140
3140
|
const entries = [];
|
|
3141
3141
|
for (let i = 0; i < bindings.count; i++) {
|
|
3142
3142
|
entries.push({ binding: bindings.slots[i], resource: bindings.views[i] });
|
|
3143
3143
|
}
|
|
3144
|
-
texture = this.
|
|
3145
|
-
this.
|
|
3144
|
+
texture = this.SH.gpuDevice.createBindGroup({ layout: textureLayout, entries });
|
|
3145
|
+
this.GI.set(textureBindGroupKey, texture);
|
|
3146
3146
|
}
|
|
3147
3147
|
const samplerBindGroupKey = `${samplerLayoutKey}|${samplerResourceKey}`;
|
|
3148
|
-
let sampler = this.
|
|
3149
|
-
const samplerLayout = this
|
|
3148
|
+
let sampler = this.HI.get(samplerBindGroupKey);
|
|
3149
|
+
const samplerLayout = this.$J(samplerLayoutKey);
|
|
3150
3150
|
if (sampler == null) {
|
|
3151
3151
|
const entries = [];
|
|
3152
3152
|
for (let i = 0; i < bindings.count; i++) {
|
|
3153
3153
|
entries.push({ binding: bindings.slots[i], resource: bindings.samplers[i] });
|
|
3154
3154
|
}
|
|
3155
|
-
sampler = this.
|
|
3156
|
-
this.
|
|
3155
|
+
sampler = this.SH.gpuDevice.createBindGroup({ layout: samplerLayout, entries });
|
|
3156
|
+
this.HI.set(samplerBindGroupKey, sampler);
|
|
3157
3157
|
}
|
|
3158
|
-
const pipelineLayoutKey = `${this.
|
|
3159
|
-
let pipelineLayout = this.
|
|
3158
|
+
const pipelineLayoutKey = `${this.eJ}#${textureLayoutKey}#${samplerLayoutKey}`;
|
|
3159
|
+
let pipelineLayout = this.hJ.get(pipelineLayoutKey);
|
|
3160
3160
|
if (pipelineLayout == null) {
|
|
3161
|
-
pipelineLayout = this.
|
|
3161
|
+
pipelineLayout = this.SH.gpuDevice.createPipelineLayout({
|
|
3162
3162
|
bindGroupLayouts: [
|
|
3163
|
-
this.
|
|
3163
|
+
this.dJ,
|
|
3164
3164
|
textureLayout,
|
|
3165
3165
|
samplerLayout,
|
|
3166
|
-
this.
|
|
3166
|
+
this.LI
|
|
3167
3167
|
]
|
|
3168
3168
|
});
|
|
3169
|
-
this.
|
|
3169
|
+
this.hJ.set(pipelineLayoutKey, pipelineLayout);
|
|
3170
3170
|
}
|
|
3171
|
-
let result = this.
|
|
3171
|
+
let result = this.nJ;
|
|
3172
3172
|
if (result == null) {
|
|
3173
3173
|
result = { storage, texture, sampler, pipelineLayout, pipelineLayoutKey };
|
|
3174
|
-
this.
|
|
3174
|
+
this.nJ = result;
|
|
3175
3175
|
} else {
|
|
3176
3176
|
result.storage = storage;
|
|
3177
3177
|
result.texture = texture;
|
|
@@ -3181,12 +3181,12 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3181
3181
|
}
|
|
3182
3182
|
return result;
|
|
3183
3183
|
}
|
|
3184
|
-
|
|
3185
|
-
const cached = this.
|
|
3184
|
+
_J(layoutKey) {
|
|
3185
|
+
const cached = this.tI.get(layoutKey);
|
|
3186
3186
|
if (cached != null) {
|
|
3187
3187
|
return cached;
|
|
3188
3188
|
}
|
|
3189
|
-
const bindings = this.
|
|
3189
|
+
const bindings = this.lI;
|
|
3190
3190
|
const entries = [];
|
|
3191
3191
|
for (let i = 0; i < bindings.count; i++) {
|
|
3192
3192
|
entries.push({
|
|
@@ -3195,14 +3195,14 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3195
3195
|
visibility: bindings.visibilities[i]
|
|
3196
3196
|
});
|
|
3197
3197
|
}
|
|
3198
|
-
return this.
|
|
3198
|
+
return this.cJ(layoutKey, entries);
|
|
3199
3199
|
}
|
|
3200
|
-
|
|
3201
|
-
const cached = this.
|
|
3200
|
+
$J(layoutKey) {
|
|
3201
|
+
const cached = this.tI.get(layoutKey);
|
|
3202
3202
|
if (cached != null) {
|
|
3203
3203
|
return cached;
|
|
3204
3204
|
}
|
|
3205
|
-
const bindings = this.
|
|
3205
|
+
const bindings = this.lI;
|
|
3206
3206
|
const entries = [];
|
|
3207
3207
|
for (let i = 0; i < bindings.count; i++) {
|
|
3208
3208
|
entries.push({
|
|
@@ -3211,7 +3211,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3211
3211
|
visibility: bindings.visibilities[i]
|
|
3212
3212
|
});
|
|
3213
3213
|
}
|
|
3214
|
-
return this.
|
|
3214
|
+
return this.cJ(layoutKey, entries);
|
|
3215
3215
|
}
|
|
3216
3216
|
/**
|
|
3217
3217
|
* create a Texture
|
|
@@ -3234,7 +3234,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3234
3234
|
}
|
|
3235
3235
|
await imageData.decode();
|
|
3236
3236
|
const imageBitmap = await createImageBitmap(imageData);
|
|
3237
|
-
const textureHandle = await this.
|
|
3237
|
+
const textureHandle = await this.BJ(width, height, internalFormat, generateMipmap, imageBitmap);
|
|
3238
3238
|
return textureHandle;
|
|
3239
3239
|
}
|
|
3240
3240
|
/**
|
|
@@ -3248,8 +3248,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3248
3248
|
const mipmapDepth = basisFile.getNumLevels(0);
|
|
3249
3249
|
const width = basisFile.getImageWidth(0, 0);
|
|
3250
3250
|
const height = basisFile.getImageHeight(0, 0);
|
|
3251
|
-
const gpuDevice = this.
|
|
3252
|
-
const gpuAdapter = this.
|
|
3251
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3252
|
+
const gpuAdapter = this.SH.gpuAdapter;
|
|
3253
3253
|
const s3tc = gpuAdapter.features.has("texture-compression-bc");
|
|
3254
3254
|
const etc2 = gpuAdapter.features.has("texture-compression-etc2");
|
|
3255
3255
|
const astc = gpuAdapter.features.has("texture-compression-astc");
|
|
@@ -3311,7 +3311,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3311
3311
|
} else {
|
|
3312
3312
|
compressedTextureData = textureSource;
|
|
3313
3313
|
}
|
|
3314
|
-
_WebGpuResourceRepository
|
|
3314
|
+
_WebGpuResourceRepository.$H(compressedTextureData);
|
|
3315
3315
|
gpuDevice.queue.writeTexture(
|
|
3316
3316
|
{
|
|
3317
3317
|
texture: gpuTexture,
|
|
@@ -3329,7 +3329,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3329
3329
|
}
|
|
3330
3330
|
);
|
|
3331
3331
|
}
|
|
3332
|
-
const textureHandle = this.
|
|
3332
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3333
3333
|
return textureHandle;
|
|
3334
3334
|
}
|
|
3335
3335
|
/**
|
|
@@ -3354,7 +3354,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3354
3354
|
* @param compressionTextureType
|
|
3355
3355
|
*/
|
|
3356
3356
|
async createCompressedTexture(textureDataArray, compressionTextureType) {
|
|
3357
|
-
const gpuDevice = this.
|
|
3357
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3358
3358
|
const blockInfo = compressionTextureType.blockInfo || { byteSize: 4, width: 1, height: 1 };
|
|
3359
3359
|
const textureDataLevel0 = textureDataArray[0];
|
|
3360
3360
|
const textureDescriptor = {
|
|
@@ -3396,7 +3396,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3396
3396
|
} else {
|
|
3397
3397
|
compressedTextureData = originalData;
|
|
3398
3398
|
}
|
|
3399
|
-
_WebGpuResourceRepository
|
|
3399
|
+
_WebGpuResourceRepository.$H(compressedTextureData);
|
|
3400
3400
|
gpuDevice.queue.writeTexture(
|
|
3401
3401
|
{
|
|
3402
3402
|
texture,
|
|
@@ -3415,7 +3415,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3415
3415
|
);
|
|
3416
3416
|
}
|
|
3417
3417
|
await gpuDevice.queue.onSubmittedWorkDone();
|
|
3418
|
-
const textureHandle = this.
|
|
3418
|
+
const textureHandle = this.DD(texture);
|
|
3419
3419
|
return textureHandle;
|
|
3420
3420
|
}
|
|
3421
3421
|
/**
|
|
@@ -3432,7 +3432,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3432
3432
|
height,
|
|
3433
3433
|
mipLevelCount
|
|
3434
3434
|
}) {
|
|
3435
|
-
const gpuDevice = this.
|
|
3435
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3436
3436
|
const textureDescriptor = {
|
|
3437
3437
|
size: [width, height, 1],
|
|
3438
3438
|
mipLevelCount,
|
|
@@ -3440,7 +3440,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3440
3440
|
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT
|
|
3441
3441
|
};
|
|
3442
3442
|
const gpuTexture = gpuDevice.createTexture(textureDescriptor);
|
|
3443
|
-
const textureHandle = this.
|
|
3443
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3444
3444
|
return textureHandle;
|
|
3445
3445
|
}
|
|
3446
3446
|
/**
|
|
@@ -3467,8 +3467,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3467
3467
|
rowSizeByPixel,
|
|
3468
3468
|
data
|
|
3469
3469
|
}) {
|
|
3470
|
-
const gpuDevice = this.
|
|
3471
|
-
const texture = this.
|
|
3470
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3471
|
+
const texture = this.TH.get(textureUid);
|
|
3472
3472
|
const pixelFormat = TextureFormat.getPixelFormatFromTextureFormat(format);
|
|
3473
3473
|
const compositionNum = PixelFormat.getCompositionNumFromPixelFormat(pixelFormat);
|
|
3474
3474
|
const bytesPerRow = rowSizeByPixel * compositionNum * type.getSizeInBytes();
|
|
@@ -3513,8 +3513,8 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3513
3513
|
Logger.default.error(e);
|
|
3514
3514
|
}
|
|
3515
3515
|
}
|
|
3516
|
-
async
|
|
3517
|
-
const gpuDevice = this.
|
|
3516
|
+
async BJ(width, height, internalFormat, generateMipmap, imageData) {
|
|
3517
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3518
3518
|
const textureDescriptor = {
|
|
3519
3519
|
size: [width, height, 1],
|
|
3520
3520
|
format: internalFormat.webgpu,
|
|
@@ -3529,7 +3529,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3529
3529
|
this.generateMipmaps(gpuTexture, textureDescriptor);
|
|
3530
3530
|
}
|
|
3531
3531
|
await gpuDevice.queue.onSubmittedWorkDone();
|
|
3532
|
-
const textureHandle = this.
|
|
3532
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3533
3533
|
return textureHandle;
|
|
3534
3534
|
}
|
|
3535
3535
|
/**
|
|
@@ -3549,7 +3549,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3549
3549
|
mipLevelCount,
|
|
3550
3550
|
format
|
|
3551
3551
|
}) {
|
|
3552
|
-
const gpuDevice = this.
|
|
3552
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3553
3553
|
const textureDescriptor = {
|
|
3554
3554
|
size: [width, height, 1],
|
|
3555
3555
|
format: format.webgpu,
|
|
@@ -3557,7 +3557,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3557
3557
|
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT
|
|
3558
3558
|
};
|
|
3559
3559
|
const gpuTexture = gpuDevice.createTexture(textureDescriptor);
|
|
3560
|
-
const textureHandle = this.
|
|
3560
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3561
3561
|
return textureHandle;
|
|
3562
3562
|
}
|
|
3563
3563
|
/**
|
|
@@ -3577,7 +3577,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3577
3577
|
internalFormat,
|
|
3578
3578
|
arrayLength
|
|
3579
3579
|
}) {
|
|
3580
|
-
const gpuDevice = this.
|
|
3580
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3581
3581
|
const textureDescriptor = {
|
|
3582
3582
|
dimension: "2d",
|
|
3583
3583
|
size: [width, height, arrayLength],
|
|
@@ -3586,7 +3586,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3586
3586
|
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT
|
|
3587
3587
|
};
|
|
3588
3588
|
const gpuTexture = gpuDevice.createTexture(textureDescriptor);
|
|
3589
|
-
const textureHandle = this.
|
|
3589
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3590
3590
|
return textureHandle;
|
|
3591
3591
|
}
|
|
3592
3592
|
/**
|
|
@@ -3606,7 +3606,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3606
3606
|
mipLevelCount,
|
|
3607
3607
|
format
|
|
3608
3608
|
}) {
|
|
3609
|
-
const gpuDevice = this.
|
|
3609
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3610
3610
|
const textureDescriptor = {
|
|
3611
3611
|
dimension: "2d",
|
|
3612
3612
|
size: [width, height, 6],
|
|
@@ -3615,7 +3615,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3615
3615
|
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT
|
|
3616
3616
|
};
|
|
3617
3617
|
const gpuTexture = gpuDevice.createTexture(textureDescriptor);
|
|
3618
|
-
const textureHandle = this.
|
|
3618
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3619
3619
|
return textureHandle;
|
|
3620
3620
|
}
|
|
3621
3621
|
/**
|
|
@@ -3630,7 +3630,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3630
3630
|
* @returns Handle to the created render buffer resource
|
|
3631
3631
|
*/
|
|
3632
3632
|
createRenderBuffer(width, height, internalFormat, isMSAA, sampleCountMSAA) {
|
|
3633
|
-
const gpuDevice = this.
|
|
3633
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3634
3634
|
const textureDescriptor = {
|
|
3635
3635
|
size: [width, height, 1],
|
|
3636
3636
|
format: internalFormat.webgpu,
|
|
@@ -3638,7 +3638,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3638
3638
|
usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT
|
|
3639
3639
|
};
|
|
3640
3640
|
const gpuTexture = gpuDevice.createTexture(textureDescriptor);
|
|
3641
|
-
const textureHandle = this.
|
|
3641
|
+
const textureHandle = this.DD(gpuTexture);
|
|
3642
3642
|
return textureHandle;
|
|
3643
3643
|
}
|
|
3644
3644
|
/**
|
|
@@ -3648,10 +3648,10 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3648
3648
|
deleteRenderBuffer(renderBufferUid) {
|
|
3649
3649
|
this.flush();
|
|
3650
3650
|
this.clearCache();
|
|
3651
|
-
const texture = this.
|
|
3651
|
+
const texture = this.TH.get(renderBufferUid);
|
|
3652
3652
|
if (texture != null) {
|
|
3653
3653
|
texture.destroy();
|
|
3654
|
-
this.
|
|
3654
|
+
this.TH.delete(renderBufferUid);
|
|
3655
3655
|
}
|
|
3656
3656
|
}
|
|
3657
3657
|
/**
|
|
@@ -3660,10 +3660,10 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3660
3660
|
* @param toTexture
|
|
3661
3661
|
*/
|
|
3662
3662
|
copyTextureData(fromTexture, toTexture) {
|
|
3663
|
-
const from = this.
|
|
3664
|
-
const to = this.
|
|
3665
|
-
this.
|
|
3666
|
-
this.
|
|
3663
|
+
const from = this.TH.get(fromTexture);
|
|
3664
|
+
const to = this.TH.get(toTexture);
|
|
3665
|
+
this.jI();
|
|
3666
|
+
this.YH.copyTextureToTexture(
|
|
3667
3667
|
{
|
|
3668
3668
|
texture: from
|
|
3669
3669
|
},
|
|
@@ -3674,15 +3674,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3674
3674
|
);
|
|
3675
3675
|
}
|
|
3676
3676
|
isMippmappedTexture(textureHandle) {
|
|
3677
|
-
const texture = this.
|
|
3677
|
+
const texture = this.TH.get(textureHandle);
|
|
3678
3678
|
if (texture.mipLevelCount > 1) {
|
|
3679
3679
|
return true;
|
|
3680
3680
|
}
|
|
3681
3681
|
return false;
|
|
3682
3682
|
}
|
|
3683
3683
|
duplicateTextureAsMipmapped(fromTexture) {
|
|
3684
|
-
const gpuDevice = this.
|
|
3685
|
-
const texture = this.
|
|
3684
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3685
|
+
const texture = this.TH.get(fromTexture);
|
|
3686
3686
|
const textureDescriptor = {
|
|
3687
3687
|
size: {
|
|
3688
3688
|
width: texture.width,
|
|
@@ -3694,14 +3694,14 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3694
3694
|
usage: texture.usage
|
|
3695
3695
|
};
|
|
3696
3696
|
const newTexture = gpuDevice.createTexture(textureDescriptor);
|
|
3697
|
-
this.
|
|
3698
|
-
this.
|
|
3697
|
+
this.jI();
|
|
3698
|
+
this.YH.copyTextureToTexture(
|
|
3699
3699
|
{ texture },
|
|
3700
3700
|
{ texture: newTexture },
|
|
3701
3701
|
{ width: texture.width, height: texture.height, depthOrArrayLayers: 1 }
|
|
3702
3702
|
);
|
|
3703
|
-
const textureHandle = this.
|
|
3704
|
-
const textureViewHandle = this.
|
|
3703
|
+
const textureHandle = this.DD(newTexture);
|
|
3704
|
+
const textureViewHandle = this.DD(newTexture.createView());
|
|
3705
3705
|
return [textureHandle, textureViewHandle];
|
|
3706
3706
|
}
|
|
3707
3707
|
/**
|
|
@@ -3776,9 +3776,9 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3776
3776
|
* @returns Handle to the created texture view
|
|
3777
3777
|
*/
|
|
3778
3778
|
createTextureView2d(textureHandle) {
|
|
3779
|
-
const texture = this.
|
|
3779
|
+
const texture = this.TH.get(textureHandle);
|
|
3780
3780
|
const textureView = texture.createView();
|
|
3781
|
-
const textureViewHandle = this.
|
|
3781
|
+
const textureViewHandle = this.DD(textureView);
|
|
3782
3782
|
return textureViewHandle;
|
|
3783
3783
|
}
|
|
3784
3784
|
/**
|
|
@@ -3789,13 +3789,13 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3789
3789
|
* @returns Handle to the created render target texture view
|
|
3790
3790
|
*/
|
|
3791
3791
|
createTextureViewAsRenderTarget(textureHandle) {
|
|
3792
|
-
const texture = this.
|
|
3792
|
+
const texture = this.TH.get(textureHandle);
|
|
3793
3793
|
const textureView = texture.createView({
|
|
3794
3794
|
baseMipLevel: 0,
|
|
3795
3795
|
mipLevelCount: 1,
|
|
3796
3796
|
arrayLayerCount: 1
|
|
3797
3797
|
});
|
|
3798
|
-
const textureViewHandle = this.
|
|
3798
|
+
const textureViewHandle = this.DD(textureView);
|
|
3799
3799
|
return textureViewHandle;
|
|
3800
3800
|
}
|
|
3801
3801
|
/**
|
|
@@ -3806,23 +3806,23 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3806
3806
|
* @returns Handle to the created cube texture view
|
|
3807
3807
|
*/
|
|
3808
3808
|
createTextureViewCube(textureHandle) {
|
|
3809
|
-
const texture = this.
|
|
3809
|
+
const texture = this.TH.get(textureHandle);
|
|
3810
3810
|
const textureView = texture.createView({ dimension: "cube" });
|
|
3811
|
-
const textureViewHandle = this.
|
|
3811
|
+
const textureViewHandle = this.DD(textureView);
|
|
3812
3812
|
return textureViewHandle;
|
|
3813
3813
|
}
|
|
3814
3814
|
createTextureView2dArray(textureHandle, arrayLayerCount) {
|
|
3815
|
-
const texture = this.
|
|
3815
|
+
const texture = this.TH.get(textureHandle);
|
|
3816
3816
|
const textureView = texture.createView({
|
|
3817
3817
|
dimension: "2d-array",
|
|
3818
3818
|
baseArrayLayer: 0,
|
|
3819
3819
|
arrayLayerCount
|
|
3820
3820
|
});
|
|
3821
|
-
const textureViewHandle = this.
|
|
3821
|
+
const textureViewHandle = this.DD(textureView);
|
|
3822
3822
|
return textureViewHandle;
|
|
3823
3823
|
}
|
|
3824
3824
|
createTextureView2dArrayAsRenderTarget(textureHandle, arrayIdx, mipLevel) {
|
|
3825
|
-
const texture = this.
|
|
3825
|
+
const texture = this.TH.get(textureHandle);
|
|
3826
3826
|
const textureView = texture.createView({
|
|
3827
3827
|
dimension: "2d",
|
|
3828
3828
|
arrayLayerCount: 1,
|
|
@@ -3831,11 +3831,11 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3831
3831
|
mipLevelCount: 1,
|
|
3832
3832
|
aspect: "all"
|
|
3833
3833
|
});
|
|
3834
|
-
const textureViewHandle = this.
|
|
3834
|
+
const textureViewHandle = this.DD(textureView);
|
|
3835
3835
|
return textureViewHandle;
|
|
3836
3836
|
}
|
|
3837
3837
|
createCubeTextureViewAsRenderTarget(textureHandle, faceIdx, mipLevel) {
|
|
3838
|
-
const texture = this.
|
|
3838
|
+
const texture = this.TH.get(textureHandle);
|
|
3839
3839
|
const textureView = texture.createView({
|
|
3840
3840
|
dimension: "2d",
|
|
3841
3841
|
arrayLayerCount: 1,
|
|
@@ -3844,43 +3844,43 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3844
3844
|
mipLevelCount: 1,
|
|
3845
3845
|
aspect: "all"
|
|
3846
3846
|
});
|
|
3847
|
-
const textureViewHandle = this.
|
|
3847
|
+
const textureViewHandle = this.DD(textureView);
|
|
3848
3848
|
return textureViewHandle;
|
|
3849
3849
|
}
|
|
3850
3850
|
deleteTexture(textureHandle) {
|
|
3851
3851
|
this.flush();
|
|
3852
3852
|
this.clearCache();
|
|
3853
|
-
const texture = this.
|
|
3853
|
+
const texture = this.TH.get(textureHandle);
|
|
3854
3854
|
if (texture == null) {
|
|
3855
3855
|
return;
|
|
3856
3856
|
}
|
|
3857
|
-
this.
|
|
3858
|
-
this.
|
|
3859
|
-
this.
|
|
3857
|
+
this.qI.delete(texture);
|
|
3858
|
+
this.eI.delete(texture);
|
|
3859
|
+
this.fI.delete(texture);
|
|
3860
3860
|
texture.destroy();
|
|
3861
|
-
this.
|
|
3861
|
+
this.TH.delete(textureHandle);
|
|
3862
3862
|
}
|
|
3863
3863
|
/**
|
|
3864
3864
|
* Recreates the system depth texture with the current canvas dimensions.
|
|
3865
3865
|
* This is called when the canvas is resized or initialized.
|
|
3866
3866
|
*/
|
|
3867
3867
|
recreateSystemDepthTexture() {
|
|
3868
|
-
const gpuDevice = this.
|
|
3869
|
-
const canvas = this.
|
|
3870
|
-
if (this.
|
|
3871
|
-
this.
|
|
3868
|
+
const gpuDevice = this.SH.gpuDevice;
|
|
3869
|
+
const canvas = this.SH.canvas;
|
|
3870
|
+
if (this.iI != null) {
|
|
3871
|
+
this.iI.destroy();
|
|
3872
3872
|
}
|
|
3873
|
-
this.
|
|
3873
|
+
this.wI = void 0;
|
|
3874
3874
|
if (canvas.width <= 0 || canvas.height <= 0) {
|
|
3875
3875
|
Logger.default.warn("Skip recreating system depth texture because the canvas size is zero.");
|
|
3876
3876
|
return;
|
|
3877
3877
|
}
|
|
3878
|
-
this.
|
|
3878
|
+
this.iI = gpuDevice.createTexture({
|
|
3879
3879
|
size: [canvas.width, canvas.height],
|
|
3880
3880
|
format: DEFAULT_DEPTH_FORMAT,
|
|
3881
3881
|
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
3882
3882
|
});
|
|
3883
|
-
this.
|
|
3883
|
+
this.bI = this.iI.createView();
|
|
3884
3884
|
}
|
|
3885
3885
|
/**
|
|
3886
3886
|
* Resizes the canvas and recreates the system depth texture.
|
|
@@ -3894,7 +3894,7 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3894
3894
|
Logger.default.warn("Skip resizing WebGPU canvas because width or height is zero.");
|
|
3895
3895
|
return;
|
|
3896
3896
|
}
|
|
3897
|
-
const canvas = this.
|
|
3897
|
+
const canvas = this.SH.canvas;
|
|
3898
3898
|
canvas.width = width;
|
|
3899
3899
|
canvas.height = height;
|
|
3900
3900
|
this.recreateSystemDepthTexture();
|
|
@@ -3915,15 +3915,15 @@ var _WebGpuResourceRepository = class _WebGpuResourceRepository extends CGAPIRes
|
|
|
3915
3915
|
return false;
|
|
3916
3916
|
}
|
|
3917
3917
|
};
|
|
3918
|
-
_WebGpuResourceRepository.
|
|
3918
|
+
_WebGpuResourceRepository.MJ = 1024;
|
|
3919
3919
|
/** The byte size of UniformDrawParameters (prerequisites.wgsl). */
|
|
3920
|
-
_WebGpuResourceRepository.
|
|
3921
|
-
_WebGpuResourceRepository.
|
|
3920
|
+
_WebGpuResourceRepository.KI = 32;
|
|
3921
|
+
_WebGpuResourceRepository.NJ = new Uint32Array(_WebGpuResourceRepository.KI / 4);
|
|
3922
3922
|
/**
|
|
3923
3923
|
* Vertex formats that normalize integer data to floats inside the GPU.
|
|
3924
3924
|
* WebGPU only provides these formats for two or four components.
|
|
3925
3925
|
*/
|
|
3926
|
-
_WebGpuResourceRepository.
|
|
3926
|
+
_WebGpuResourceRepository.PJ = /* @__PURE__ */ new Set([
|
|
3927
3927
|
"unorm8x2",
|
|
3928
3928
|
"unorm8x4",
|
|
3929
3929
|
"snorm8x2",
|