@woosh/meep-engine 3.78.4 → 3.80.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/CHANGELOG.md +93 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/engine/asset/GameAssetType.d.ts +2 -0
- package/src/engine/asset/GameAssetType.js +10 -0
- package/src/engine/asset/guessAssetType.d.ts.map +1 -1
- package/src/engine/asset/guessAssetType.js +4 -0
- package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
- package/src/engine/asset/load_model_scene_bundle.js +2 -2
- package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
- package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
- package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
- package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
- package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
- package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts +45 -0
- package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts.map +1 -0
- package/src/format/image/webp/vp8/VP8BoolDecoder.js +137 -0
- package/src/format/image/webp/vp8/vp8_decode.d.ts +21 -0
- package/src/format/image/webp/vp8/vp8_decode.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_decode.js +756 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.d.ts +31 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.js +189 -0
- package/src/format/image/webp/vp8/vp8_predict.d.ts +48 -0
- package/src/format/image/webp/vp8/vp8_predict.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_predict.js +290 -0
- package/src/format/image/webp/vp8/vp8_tables.d.ts +34 -0
- package/src/format/image/webp/vp8/vp8_tables.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_tables.js +350 -0
- package/src/format/image/webp/vp8/vp8_transform.d.ts +22 -0
- package/src/format/image/webp/vp8/vp8_transform.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_transform.js +114 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts +23 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.js +133 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.d.ts +47 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.js +84 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts +27 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.js +184 -0
- package/src/format/image/webp/vp8l/vp8l_decode.d.ts +28 -0
- package/src/format/image/webp/vp8l/vp8l_decode.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_decode.js +261 -0
- package/src/format/image/webp/vp8l/vp8l_distance.d.ts +22 -0
- package/src/format/image/webp/vp8l/vp8l_distance.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_distance.js +62 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts +50 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.js +267 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts +14 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.js +99 -0
- package/src/format/image/webp/webp_decode.d.ts +23 -0
- package/src/format/image/webp/webp_decode.d.ts.map +1 -0
- package/src/format/image/webp/webp_decode.js +179 -0
- package/src/format/image/webp/webp_decode_alpha.d.ts +18 -0
- package/src/format/image/webp/webp_decode_alpha.d.ts.map +1 -0
- package/src/format/image/webp/webp_decode_alpha.js +84 -0
- package/src/format/texture/{basis → astc}/astc_block.d.ts +41 -0
- package/src/format/texture/astc/astc_block.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_block.js +284 -164
- package/src/format/texture/astc/astc_decode_block.d.ts +68 -0
- package/src/format/texture/astc/astc_decode_block.d.ts.map +1 -0
- package/src/format/texture/astc/astc_decode_block.js +1119 -0
- package/src/format/texture/astc/astc_encode_block_4x4.d.ts +32 -0
- package/src/format/texture/astc/astc_encode_block_4x4.d.ts.map +1 -0
- package/src/format/texture/astc/astc_encode_block_4x4.js +181 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts +32 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts.map +1 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.js +337 -0
- package/src/format/texture/astc/astc_integer_sequence.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_integer_sequence.js +251 -251
- package/src/format/texture/astc/astc_partition.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_partition.js +199 -199
- package/src/format/texture/basis/transcode/etc1s_to_astc.js +329 -329
- package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/etc1s_to_etc2.js +305 -332
- package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/fit_endpoints.js +14 -27
- package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts +66 -0
- package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts.map +1 -0
- package/src/format/texture/basis/uastc/uastc_bc7_tables.js +148 -0
- package/src/format/texture/basis/uastc/uastc_decode_block.js +463 -463
- package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -421
- package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +1 -6
- package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -1
- package/src/format/texture/basis/uastc/uastc_to_bc5.js +48 -115
- package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -1
- package/src/format/texture/basis/uastc/uastc_to_bc7.js +604 -602
- package/src/format/texture/bc/bc1_decode_block.d.ts +19 -0
- package/src/format/texture/bc/bc1_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc1_decode_block.js +22 -0
- package/src/format/texture/bc/bc1_decode_colors.d.ts +27 -0
- package/src/format/texture/bc/bc1_decode_colors.d.ts.map +1 -0
- package/src/format/texture/bc/bc1_decode_colors.js +100 -0
- package/src/format/texture/bc/bc2_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc2_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc2_decode_block.js +28 -0
- package/src/format/texture/bc/bc3_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc3_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc3_decode_block.js +23 -0
- package/src/format/texture/bc/bc4_decode_channel.d.ts +56 -0
- package/src/format/texture/bc/bc4_decode_channel.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_decode_channel.js +138 -0
- package/src/format/texture/bc/bc4_encode_block.d.ts +43 -0
- package/src/format/texture/bc/bc4_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_encode_block.js +324 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.js +27 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.d.ts +17 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.js +26 -0
- package/src/format/texture/bc/bc5_encode_block.d.ts +25 -0
- package/src/format/texture/bc/bc5_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_encode_block.js +34 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.js +27 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.d.ts +17 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.js +26 -0
- package/src/format/texture/bc/bc6h_decode_texels.d.ts +30 -0
- package/src/format/texture/bc/bc6h_decode_texels.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_decode_texels.js +430 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts +20 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.js +23 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.js +21 -0
- package/src/format/texture/bc/bc7_decode_block.d.ts +30 -0
- package/src/format/texture/bc/bc7_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc7_decode_block.js +232 -0
- package/src/format/texture/bc/bc7_encode_block.d.ts +39 -0
- package/src/format/texture/bc/bc7_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc7_encode_block.js +423 -0
- package/src/format/texture/bc/bc7_tables.d.ts +126 -0
- package/src/format/texture/bc/bc7_tables.d.ts.map +1 -0
- package/src/format/texture/{basis/uastc → bc}/bc7_tables.js +225 -276
- package/src/format/texture/bc/bc7_write_block.d.ts +65 -0
- package/src/format/texture/bc/bc7_write_block.d.ts.map +1 -0
- package/src/format/texture/{basis/uastc → bc}/bc7_write_block.js +185 -227
- package/src/format/texture/etc/eac_decode_channel.d.ts +50 -0
- package/src/format/texture/etc/eac_decode_channel.d.ts.map +1 -0
- package/src/format/texture/etc/eac_decode_channel.js +142 -0
- package/src/format/texture/etc/eac_modifiers.d.ts +15 -0
- package/src/format/texture/etc/eac_modifiers.d.ts.map +1 -0
- package/src/format/texture/etc/eac_modifiers.js +31 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts +21 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.js +30 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts +20 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.js +29 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts +19 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.js +28 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts +19 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.js +28 -0
- package/src/format/texture/etc/etc2_decode_color.d.ts +25 -0
- package/src/format/texture/etc/etc2_decode_color.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_decode_color.js +370 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts +18 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.js +21 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts +21 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.js +24 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts +18 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.js +24 -0
- package/src/format/texture/fit/fit_line.d.ts +23 -0
- package/src/format/texture/fit/fit_line.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line.js +123 -0
- package/src/format/texture/fit/fit_line_refine.d.ts +21 -0
- package/src/format/texture/fit/fit_line_refine.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line_refine.js +69 -0
- package/src/format/texture/fit/fit_line_solve.d.ts +23 -0
- package/src/format/texture/fit/fit_line_solve.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line_solve.js +71 -0
- package/src/format/texture/texel_decode_image.d.ts +44 -0
- package/src/format/texture/texel_decode_image.d.ts.map +1 -0
- package/src/format/texture/texel_decode_image.js +251 -0
- package/src/format/texture/texel_encode_image.d.ts +77 -0
- package/src/format/texture/texel_encode_image.d.ts.map +1 -0
- package/src/format/texture/texel_encode_image.js +187 -0
- package/src/shade/renderer/ShadeIndirectLightingMode.js +2 -0
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
- package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
- package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
- package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
- package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
- package/src/shade/renderer/hair/HAIR.d.ts +5 -3
- package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
- package/src/shade/renderer/hair/HAIR.js +6 -4
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
- package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
- package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
- package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
- package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
- package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
- package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
- package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
- package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
- package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
- package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
- package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
- package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
- package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
- package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +10 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +152 -0
- package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
- package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
- package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
- package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
- package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
- package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
- package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
- package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts +19 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.js +60 -0
- package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts +21 -0
- package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_write.js +137 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts +23 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.js +36 -0
- package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
- package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
- package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
- package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
- package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
- package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
- package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
- package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
- package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts +13 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.js +39 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +3 -2
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +6 -21
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts +42 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.js +612 -0
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +5 -4
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +8 -25
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +3 -19
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +14 -4
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +65 -54
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +2 -2
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +5 -22
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +1 -1
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts +27 -0
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js +147 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +3 -4
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +6 -13
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts +13 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js +66 -0
- package/src/shade/renderer/texture/encode/texture_encode.d.ts +28 -1
- package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/texture_encode.js +202 -168
- package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +13 -1
- package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/texture_encode_shader.js +146 -108
- package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts +11 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts +20 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.js +98 -0
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +4 -23
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts +53 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js +76 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts +40 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.js +43 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts +17 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.js +29 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.js +91 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts +32 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.js +216 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts +30 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.js +134 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.js +33 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js +71 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts +20 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js +57 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js +111 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js +33 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js +128 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js +169 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js +119 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js +19 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts +24 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js +41 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts +24 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js +140 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js +35 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts +19 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js +27 -0
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_catmull_rom.js +4 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts +13 -0
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js +54 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mitchell.js +4 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js +9 -13
- package/src/shade/renderer/texture/texture_block_encodings.d.ts +33 -0
- package/src/shade/renderer/texture/texture_block_encodings.d.ts.map +1 -0
- package/src/shade/renderer/texture/texture_block_encodings.js +89 -0
- package/src/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
- package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
- package/src/shade/renderer/texture/texture_role_image_quality.js +29 -0
- package/src/format/texture/basis/astc_block.d.ts.map +0 -1
- package/src/format/texture/basis/astc_integer_sequence.d.ts.map +0 -1
- package/src/format/texture/basis/astc_partition.d.ts.map +0 -1
- package/src/format/texture/basis/uastc/bc7_tables.d.ts +0 -111
- package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +0 -1
- package/src/format/texture/basis/uastc/bc7_write_block.d.ts +0 -124
- package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +0 -1
- /package/src/format/texture/{basis → astc}/astc_integer_sequence.d.ts +0 -0
- /package/src/format/texture/{basis → astc}/astc_partition.d.ts +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { chunk_grid3d_to_index } from "../../shader/chunk/grid/chunk_grid3d_to_index.js";
|
|
2
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
3
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
4
|
+
import { chunk_bc7_encode_block } from "./chunk_bc7_encode_block.js";
|
|
5
|
+
import { chunk_texture_encode_load_block } from "./chunk_texture_encode_load_block.js";
|
|
6
|
+
import { TEXTURE_ENCODE_WORKGROUP_SIZE } from "./shader_texture_encode_bc4.js";
|
|
7
|
+
import { texture_encode_resources } from "./texture_encode_resources.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Every level of a texture whose alpha nobody reads to `bc7-rgba-unorm` or its sRGB twin, one
|
|
11
|
+
* invocation per block.
|
|
12
|
+
*
|
|
13
|
+
* {@link shader_texture_encode_bc7} with the colour-only entry, `bc7_encode_block_rgb`: the source's
|
|
14
|
+
* alpha is not read, mode 6's parity bits serve the colour, and the blocks decode to alpha 254 or
|
|
15
|
+
* 255. The dispatch shape is {@link shader_texture_encode_bc4}'s; a block is four words.
|
|
16
|
+
*
|
|
17
|
+
* @type {ComputeShader}
|
|
18
|
+
*/
|
|
19
|
+
export const shader_texture_encode_bc7_rgb = ComputeShader.from({
|
|
20
|
+
label: 'texture_encode/bc7-rgba-unorm/alpha-unread',
|
|
21
|
+
resources: texture_encode_resources(),
|
|
22
|
+
body: CodeChunk.from(
|
|
23
|
+
//language=WGSL
|
|
24
|
+
`
|
|
25
|
+
@compute @workgroup_size(${TEXTURE_ENCODE_WORKGROUP_SIZE}, 1, 1)
|
|
26
|
+
fn main(
|
|
27
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
28
|
+
@builtin(num_workgroups) groups: vec3<u32>,
|
|
29
|
+
@builtin(local_invocation_index) local_index: u32,
|
|
30
|
+
) {
|
|
31
|
+
let block = grid3d_to_index(workgroup_id, groups.xy) * ${TEXTURE_ENCODE_WORKGROUP_SIZE}u + local_index;
|
|
32
|
+
|
|
33
|
+
if (block >= texture_encode_block_count()) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let level = texture_encode_level_of_block(block);
|
|
38
|
+
|
|
39
|
+
let local = block - level.first_block;
|
|
40
|
+
|
|
41
|
+
let block_x = local % level.blocks_x;
|
|
42
|
+
let block_y = local / level.blocks_x;
|
|
43
|
+
|
|
44
|
+
let texels = texture_encode_load_block(level, block_x, block_y);
|
|
45
|
+
|
|
46
|
+
var colour: array<vec3<f32>, 16>;
|
|
47
|
+
|
|
48
|
+
for (var i = 0u; i < 16u; i++) {
|
|
49
|
+
colour[i] = texels[i].xyz;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let packed = bc7_encode_block_rgb(colour);
|
|
53
|
+
|
|
54
|
+
let word = level.word_offset + block_y * level.row_stride_words + block_x * 4u;
|
|
55
|
+
|
|
56
|
+
encode_output[word] = packed.x;
|
|
57
|
+
encode_output[word + 1u] = packed.y;
|
|
58
|
+
encode_output[word + 2u] = packed.z;
|
|
59
|
+
encode_output[word + 3u] = packed.w;
|
|
60
|
+
}
|
|
61
|
+
`, [
|
|
62
|
+
chunk_grid3d_to_index,
|
|
63
|
+
chunk_texture_encode_load_block,
|
|
64
|
+
chunk_bc7_encode_block,
|
|
65
|
+
]),
|
|
66
|
+
});
|
|
@@ -54,7 +54,34 @@
|
|
|
54
54
|
* @author Alex Goldring
|
|
55
55
|
* @copyright Company Named Limited (c) 2026
|
|
56
56
|
*/
|
|
57
|
-
export function texture_encode(cmd: ShadeGPUCommandContext,
|
|
57
|
+
export function texture_encode(cmd: ShadeGPUCommandContext, options: {
|
|
58
|
+
source: GPUTexture;
|
|
59
|
+
format: GPUTextureFormat;
|
|
60
|
+
level_count: number;
|
|
61
|
+
usage: GPUTextureUsageFlags;
|
|
62
|
+
label?: string;
|
|
63
|
+
}): TextureEncodeResult;
|
|
64
|
+
/**
|
|
65
|
+
* {@link texture_encode} for a texture whose alpha nobody reads: the source's alpha is not read, and
|
|
66
|
+
* the blocks decode to whatever alpha served the colour. In BC7 that frees the low bit each end's
|
|
67
|
+
* channels share with alpha, which an opaque alpha kept exactly would take, and alpha decodes 254
|
|
68
|
+
* or 255 ({@link texture_encode_shader_rgb}). Every other target is encoded as {@link texture_encode}
|
|
69
|
+
* encodes it, since none of its encoders reads alpha.
|
|
70
|
+
*
|
|
71
|
+
* @param {ShadeGPUCommandContext} cmd
|
|
72
|
+
* @param {Object} options as {@link texture_encode}'s
|
|
73
|
+
* @param {GPUTexture} options.source
|
|
74
|
+
* @param {GPUTextureFormat} options.format
|
|
75
|
+
* @param {number} options.level_count
|
|
76
|
+
* @param {GPUTextureUsageFlags} options.usage
|
|
77
|
+
* @param {string} [options.label]
|
|
78
|
+
* @returns {TextureEncodeResult}
|
|
79
|
+
* @throws {Error} as {@link texture_encode}
|
|
80
|
+
*
|
|
81
|
+
* @author Alex Goldring
|
|
82
|
+
* @copyright Company Named Limited (c) 2026
|
|
83
|
+
*/
|
|
84
|
+
export function texture_encode_rgb(cmd: ShadeGPUCommandContext, options: {
|
|
58
85
|
source: GPUTexture;
|
|
59
86
|
format: GPUTextureFormat;
|
|
60
87
|
level_count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture_encode.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/texture_encode.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH;IAf+B,MAAM;IAEA,MAAM;IAEhB,WAAW,EAA3B,MAAM;IACwB,KAAK;IAElB,KAAK,GAAtB,MAAM;IACJ,mBAAmB,
|
|
1
|
+
{"version":3,"file":"texture_encode.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/texture_encode.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH;IAf+B,MAAM;IAEA,MAAM;IAEhB,WAAW,EAA3B,MAAM;IACwB,KAAK;IAElB,KAAK,GAAtB,MAAM;IACJ,mBAAmB,CAS/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAX+B,MAAM;IACA,MAAM;IAChB,WAAW,EAA3B,MAAM;IACwB,KAAK;IAClB,KAAK,GAAtB,MAAM;IACJ,mBAAmB,CAQ/B"}
|
|
@@ -1,168 +1,202 @@
|
|
|
1
|
-
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import { gpu_texture_format_srg_to_linear } from "../format/gpu_texture_format_srg_to_linear.js";
|
|
3
|
-
import { texture_encode_layout, texture_encode_level_table } from "./texture_encode_layout.js";
|
|
4
|
-
import { texture_encode_shader } from "./texture_encode_shader.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* What {@link texture_encode} produced.
|
|
8
|
-
*
|
|
9
|
-
* @typedef {Object} TextureEncodeResult
|
|
10
|
-
* @property {GPUTexture} texture the block-compressed texture, every requested level written once
|
|
11
|
-
* the context is submitted. The caller's, to keep and to destroy
|
|
12
|
-
* @property {GPUBuffer} blocks the block buffer the encoder wrote and the copies read, laid out as
|
|
13
|
-
* `layout` says. **Transient**: released back to the context's pool when the context finishes, so
|
|
14
|
-
* anything wanting the raw blocks — a container writer, a cross-check — copies them out before then
|
|
15
|
-
* @property {TextureEncodeLayout} layout where each level's blocks sit in `blocks`
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Encode a sampleable texture into a block-compressed one, on the device.
|
|
20
|
-
*
|
|
21
|
-
* **A texture in, a texture out, and nothing about who wants it.** The caller names the target
|
|
22
|
-
* format outright — `bc4-r-unorm`, `bc7-rgba-unorm-srgb` — and gets a texture in that format with
|
|
23
|
-
* `level_count` levels, each encoded from the same level of the source. No role, no preference list,
|
|
24
|
-
* no material: a subsystem that can encode anything to a named format is what the texture manager, a
|
|
25
|
-
* container writer, a procedural generator and a test can all stand on, and none of those want it to
|
|
26
|
-
* have opinions about content.
|
|
27
|
-
*
|
|
28
|
-
* WebGPU has no writable block-compressed storage texture, so the shape is the plan's §4.4: one
|
|
29
|
-
* compute dispatch writes every level's blocks into one storage buffer, and one `copyBufferToTexture`
|
|
30
|
-
* per level moves them into the texture. The buffer is laid out by {@link texture_encode_layout}
|
|
31
|
-
* with its rows padded to the copy's 256-byte stride before anything runs — the encoder writes to
|
|
32
|
-
* the stride the copy will read, and each copy is a whole level, sized in whole blocks as the copy
|
|
33
|
-
* commands count them.
|
|
34
|
-
*
|
|
35
|
-
* **The source is read as stored, not as decoded.** An `-srgb` source would arrive through
|
|
36
|
-
* `textureLoad` already converted to linear, and an encoder fitting those values into bytes that the
|
|
37
|
-
* sampler will then decode as sRGB again would encode the wrong picture. So an sRGB source is bound
|
|
38
|
-
* through a view in its linear twin format, which needs the texture to have been created with that
|
|
39
|
-
* format in its `viewFormats`; the device refuses the view otherwise, by validation error. The
|
|
40
|
-
* `-srgb`-ness of the *target* is likewise nothing but the tag the texture is created with: the
|
|
41
|
-
* encoded bytes are identical for both spellings.
|
|
42
|
-
*
|
|
43
|
-
* Everything is recorded into `cmd` and nothing runs until it is submitted. The transient buffers
|
|
44
|
-
* are the context's and go back to its pool when it finishes.
|
|
45
|
-
*
|
|
46
|
-
* @param {ShadeGPUCommandContext} cmd
|
|
47
|
-
* @param {Object} options
|
|
48
|
-
* @param {GPUTexture} options.source a 2D, single-layer texture with `TEXTURE_BINDING`, holding at
|
|
49
|
-
* least `level_count` levels
|
|
50
|
-
* @param {GPUTextureFormat} options.format the target block format, exactly as the texture is to be
|
|
51
|
-
* created
|
|
52
|
-
* @param {number} options.level_count how many levels to encode, from level 0 down
|
|
53
|
-
* @param {GPUTextureUsageFlags} options.usage the target texture's usage; must include `COPY_DST`,
|
|
54
|
-
* which is how the blocks get in
|
|
55
|
-
* @param {string} [options.label] for the target texture
|
|
56
|
-
* @returns {TextureEncodeResult}
|
|
57
|
-
* @throws {Error} naming the format, for a target this cannot write; naming the source, for one the
|
|
58
|
-
* encoder cannot read
|
|
59
|
-
*
|
|
60
|
-
* @author Alex Goldring
|
|
61
|
-
* @copyright Company Named Limited (c) 2026
|
|
62
|
-
*/
|
|
63
|
-
export function texture_encode(cmd,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { gpu_texture_format_srg_to_linear } from "../format/gpu_texture_format_srg_to_linear.js";
|
|
3
|
+
import { texture_encode_layout, texture_encode_level_table } from "./texture_encode_layout.js";
|
|
4
|
+
import { texture_encode_shader, texture_encode_shader_rgb } from "./texture_encode_shader.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What {@link texture_encode} produced.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {Object} TextureEncodeResult
|
|
10
|
+
* @property {GPUTexture} texture the block-compressed texture, every requested level written once
|
|
11
|
+
* the context is submitted. The caller's, to keep and to destroy
|
|
12
|
+
* @property {GPUBuffer} blocks the block buffer the encoder wrote and the copies read, laid out as
|
|
13
|
+
* `layout` says. **Transient**: released back to the context's pool when the context finishes, so
|
|
14
|
+
* anything wanting the raw blocks — a container writer, a cross-check — copies them out before then
|
|
15
|
+
* @property {TextureEncodeLayout} layout where each level's blocks sit in `blocks`
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Encode a sampleable texture into a block-compressed one, on the device.
|
|
20
|
+
*
|
|
21
|
+
* **A texture in, a texture out, and nothing about who wants it.** The caller names the target
|
|
22
|
+
* format outright — `bc4-r-unorm`, `bc7-rgba-unorm-srgb` — and gets a texture in that format with
|
|
23
|
+
* `level_count` levels, each encoded from the same level of the source. No role, no preference list,
|
|
24
|
+
* no material: a subsystem that can encode anything to a named format is what the texture manager, a
|
|
25
|
+
* container writer, a procedural generator and a test can all stand on, and none of those want it to
|
|
26
|
+
* have opinions about content.
|
|
27
|
+
*
|
|
28
|
+
* WebGPU has no writable block-compressed storage texture, so the shape is the plan's §4.4: one
|
|
29
|
+
* compute dispatch writes every level's blocks into one storage buffer, and one `copyBufferToTexture`
|
|
30
|
+
* per level moves them into the texture. The buffer is laid out by {@link texture_encode_layout}
|
|
31
|
+
* with its rows padded to the copy's 256-byte stride before anything runs — the encoder writes to
|
|
32
|
+
* the stride the copy will read, and each copy is a whole level, sized in whole blocks as the copy
|
|
33
|
+
* commands count them.
|
|
34
|
+
*
|
|
35
|
+
* **The source is read as stored, not as decoded.** An `-srgb` source would arrive through
|
|
36
|
+
* `textureLoad` already converted to linear, and an encoder fitting those values into bytes that the
|
|
37
|
+
* sampler will then decode as sRGB again would encode the wrong picture. So an sRGB source is bound
|
|
38
|
+
* through a view in its linear twin format, which needs the texture to have been created with that
|
|
39
|
+
* format in its `viewFormats`; the device refuses the view otherwise, by validation error. The
|
|
40
|
+
* `-srgb`-ness of the *target* is likewise nothing but the tag the texture is created with: the
|
|
41
|
+
* encoded bytes are identical for both spellings.
|
|
42
|
+
*
|
|
43
|
+
* Everything is recorded into `cmd` and nothing runs until it is submitted. The transient buffers
|
|
44
|
+
* are the context's and go back to its pool when it finishes.
|
|
45
|
+
*
|
|
46
|
+
* @param {ShadeGPUCommandContext} cmd
|
|
47
|
+
* @param {Object} options
|
|
48
|
+
* @param {GPUTexture} options.source a 2D, single-layer texture with `TEXTURE_BINDING`, holding at
|
|
49
|
+
* least `level_count` levels
|
|
50
|
+
* @param {GPUTextureFormat} options.format the target block format, exactly as the texture is to be
|
|
51
|
+
* created
|
|
52
|
+
* @param {number} options.level_count how many levels to encode, from level 0 down
|
|
53
|
+
* @param {GPUTextureUsageFlags} options.usage the target texture's usage; must include `COPY_DST`,
|
|
54
|
+
* which is how the blocks get in
|
|
55
|
+
* @param {string} [options.label] for the target texture
|
|
56
|
+
* @returns {TextureEncodeResult}
|
|
57
|
+
* @throws {Error} naming the format, for a target this cannot write; naming the source, for one the
|
|
58
|
+
* encoder cannot read
|
|
59
|
+
*
|
|
60
|
+
* @author Alex Goldring
|
|
61
|
+
* @copyright Company Named Limited (c) 2026
|
|
62
|
+
*/
|
|
63
|
+
export function texture_encode(cmd, options) {
|
|
64
|
+
return texture_encode_with(cmd, options, texture_encode_shader);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* {@link texture_encode} for a texture whose alpha nobody reads: the source's alpha is not read, and
|
|
69
|
+
* the blocks decode to whatever alpha served the colour. In BC7 that frees the low bit each end's
|
|
70
|
+
* channels share with alpha, which an opaque alpha kept exactly would take, and alpha decodes 254
|
|
71
|
+
* or 255 ({@link texture_encode_shader_rgb}). Every other target is encoded as {@link texture_encode}
|
|
72
|
+
* encodes it, since none of its encoders reads alpha.
|
|
73
|
+
*
|
|
74
|
+
* @param {ShadeGPUCommandContext} cmd
|
|
75
|
+
* @param {Object} options as {@link texture_encode}'s
|
|
76
|
+
* @param {GPUTexture} options.source
|
|
77
|
+
* @param {GPUTextureFormat} options.format
|
|
78
|
+
* @param {number} options.level_count
|
|
79
|
+
* @param {GPUTextureUsageFlags} options.usage
|
|
80
|
+
* @param {string} [options.label]
|
|
81
|
+
* @returns {TextureEncodeResult}
|
|
82
|
+
* @throws {Error} as {@link texture_encode}
|
|
83
|
+
*
|
|
84
|
+
* @author Alex Goldring
|
|
85
|
+
* @copyright Company Named Limited (c) 2026
|
|
86
|
+
*/
|
|
87
|
+
export function texture_encode_rgb(cmd, options) {
|
|
88
|
+
return texture_encode_with(cmd, options, texture_encode_shader_rgb);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {ShadeGPUCommandContext} cmd
|
|
93
|
+
* @param {Object} options as {@link texture_encode}'s
|
|
94
|
+
* @param {function(GPUTextureFormat):ComputeShader} shader_for the encoder for a target
|
|
95
|
+
* @returns {TextureEncodeResult}
|
|
96
|
+
*/
|
|
97
|
+
function texture_encode_with(cmd, { source, format, level_count, usage, label = `encoded ${format}` }, shader_for) {
|
|
98
|
+
assert.defined(cmd, 'cmd');
|
|
99
|
+
assert.defined(source, 'source');
|
|
100
|
+
assert.isString(format, 'format');
|
|
101
|
+
assert.isPositiveInteger(level_count, 'level_count');
|
|
102
|
+
assert.isNonNegativeInteger(usage, 'usage');
|
|
103
|
+
assert.isString(label, 'label');
|
|
104
|
+
|
|
105
|
+
const shader = shader_for(format);
|
|
106
|
+
|
|
107
|
+
if (source.dimension !== "2d" || source.depthOrArrayLayers !== 1) {
|
|
108
|
+
throw new Error(
|
|
109
|
+
`texture_encode: source '${source.label}' is ${source.dimension} with ${source.depthOrArrayLayers} layers;`
|
|
110
|
+
+ ` only a single-layer 2D texture can be encoded`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if ((source.usage & GPUTextureUsage.TEXTURE_BINDING) === 0) {
|
|
115
|
+
throw new Error(`texture_encode: source '${source.label}' was not created with TEXTURE_BINDING, so it cannot be read`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (level_count > source.mipLevelCount) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`texture_encode: source '${source.label}' holds ${source.mipLevelCount} levels, and ${level_count} were asked for`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if ((usage & GPUTextureUsage.COPY_DST) === 0) {
|
|
125
|
+
throw new Error(`texture_encode: the target's usage must include COPY_DST, which is how the blocks reach it`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const device = cmd.device;
|
|
129
|
+
|
|
130
|
+
const layout = texture_encode_layout(format, source.width, source.height, level_count);
|
|
131
|
+
|
|
132
|
+
const binding_limit = device.limits.maxStorageBufferBindingSize;
|
|
133
|
+
|
|
134
|
+
if (layout.byte_length > binding_limit) {
|
|
135
|
+
throw new Error(
|
|
136
|
+
`texture_encode: the ${layout.levels.length}-level block buffer of a ${source.width}x${source.height} '${format}'`
|
|
137
|
+
+ ` texture is ${layout.byte_length} bytes, over this device's maxStorageBufferBindingSize of ${binding_limit}`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const texture = device.createTexture({
|
|
142
|
+
label,
|
|
143
|
+
size: [source.width, source.height, 1],
|
|
144
|
+
format,
|
|
145
|
+
mipLevelCount: level_count,
|
|
146
|
+
usage,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const table = texture_encode_level_table(layout);
|
|
150
|
+
|
|
151
|
+
const levels = cmd.allocateTransientBufferAndLoad(table.buffer, GPUBufferUsage.STORAGE);
|
|
152
|
+
|
|
153
|
+
const blocks = cmd.allocateTransientBuffer(
|
|
154
|
+
GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
|
|
155
|
+
layout.byte_length
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const view = source.createView({
|
|
159
|
+
label: `${source.label} for encoding`,
|
|
160
|
+
format: source.format.endsWith("-srgb") ? gpu_texture_format_srg_to_linear(source.format) : source.format,
|
|
161
|
+
dimension: "2d",
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const group_count = Math.ceil(layout.block_count / shader.group_size_x);
|
|
165
|
+
|
|
166
|
+
// one dimension is capped, so a large chain wraps onto a second grid row; the shader reads the
|
|
167
|
+
// row length from num_workgroups
|
|
168
|
+
const groups_per_row = Math.min(group_count, device.limits.maxComputeWorkgroupsPerDimension);
|
|
169
|
+
|
|
170
|
+
shader.dispatch({
|
|
171
|
+
encoder: cmd,
|
|
172
|
+
bindings: {
|
|
173
|
+
encode_source: view,
|
|
174
|
+
encode_levels: levels,
|
|
175
|
+
encode_output: blocks,
|
|
176
|
+
},
|
|
177
|
+
group_count_x: groups_per_row,
|
|
178
|
+
group_count_y: Math.ceil(group_count / groups_per_row),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const encoder = cmd.gpu_encoder;
|
|
182
|
+
|
|
183
|
+
for (const level of layout.levels) {
|
|
184
|
+
encoder.copyBufferToTexture(
|
|
185
|
+
{
|
|
186
|
+
buffer: blocks,
|
|
187
|
+
offset: level.byte_offset,
|
|
188
|
+
bytesPerRow: level.bytes_per_row,
|
|
189
|
+
rowsPerImage: level.blocks_y,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
texture,
|
|
193
|
+
mipLevel: level.level,
|
|
194
|
+
origin: [0, 0, 0],
|
|
195
|
+
},
|
|
196
|
+
// sized in whole blocks, as the copy commands count: the 1x1 tail is one 4x4 block
|
|
197
|
+
[level.copy_width, level.copy_height, 1]
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return { texture, blocks, layout };
|
|
202
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The compute shader that encodes into `format`.
|
|
2
|
+
* The compute shader that encodes into `format`. For a texture whose alpha nobody reads,
|
|
3
|
+
* {@link texture_encode_shader_rgb}.
|
|
3
4
|
*
|
|
4
5
|
* Refuses by name rather than approximating: a target this cannot write yet is named as such, and a
|
|
5
6
|
* format that was never a target is named as that. Nothing is encoded as a neighbour of what was
|
|
@@ -10,6 +11,17 @@
|
|
|
10
11
|
* @throws {Error} naming the format, for one that is not implemented or not a target
|
|
11
12
|
*/
|
|
12
13
|
export function texture_encode_shader(format: GPUTextureFormat): ComputeShader;
|
|
14
|
+
/**
|
|
15
|
+
* The compute shader that encodes into `format` a texture whose alpha nobody reads: the source's alpha
|
|
16
|
+
* is not read, and the blocks decode to whatever alpha served the colour. For BC7 that frees the low
|
|
17
|
+
* bit each end's channels share with alpha ({@link shader_texture_encode_bc7_rgb}); every other
|
|
18
|
+
* target is the shader {@link texture_encode_shader} gives, as none of them reads alpha.
|
|
19
|
+
*
|
|
20
|
+
* @param {GPUTextureFormat} format
|
|
21
|
+
* @returns {ComputeShader}
|
|
22
|
+
* @throws {Error} naming the format, for one that is not implemented or not a target
|
|
23
|
+
*/
|
|
24
|
+
export function texture_encode_shader_rgb(format: GPUTextureFormat): ComputeShader;
|
|
13
25
|
/**
|
|
14
26
|
* Whether the block encoder can write `format` today.
|
|
15
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture_encode_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/texture_encode_shader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"texture_encode_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/texture_encode_shader.js"],"names":[],"mappings":"AA+EA;;;;;;;;;;;GAWG;AACH,+EAEC;AAED;;;;;;;;;GASG;AACH,mFAEC;AA8BD;;;;;GAKG;AACH,qEAFa,OAAO,CAInB;AArID;;;;;;;;GAQG;AACH,qCAFU,kBAAkB,CAkB1B"}
|