Add ASTC and ETC2 compression modes (#12518) 0ed7a0a13d
* Add files

* Update files

* Clang format

* Update image_asset.dart

* remove old rtex references

* Add block size stuff

* Update render_context.cpp

* Update premake5_pls_renderer.lua

* Clang format

* Fix build break after merge

* Fix break due to conflict

* Fix build break

* Fix break

* Fix conflict

* Update export_rive_test.dart

* Update export_rive_test.dart

* Update premake5_pls_renderer.lua

* Update theme_rename_audit_test.dart

* Update Texture_compressor.cpp

* Update encode_etc2.cpp

* Update image_asset.json

* Update image_asset.dart

* Update comment

* Potential fix for pull request finding

* Potential fix for pull request finding

* Fix astcBlockSize field-id collision with master's dragMultiplier

master added ScrollConstraint.dragMultiplier at field key 1029, colliding
with ImageAsset.astcBlockSize. Bump astcBlockSize to the next free key 1030
in both def trees and the generated Dart constant (rive_core_context.dart
references it symbolically). Minimal change — no full regen / dart-fix churn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: John White <aliasbinman@gmail.com>
diff --git a/.rive_head b/.rive_head
index 722fac7..fecddeb 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-4bf87f97a62dc5a27aa868264b0289be81ee87ae
+0ed7a0a13d696f11d9a430c22a1edda12c4cc61c
diff --git a/decoders/src/decode_ktx2.cpp b/decoders/src/decode_ktx2.cpp
index 135595e..e0bfb7a 100644
--- a/decoders/src/decode_ktx2.cpp
+++ b/decoders/src/decode_ktx2.cpp
@@ -41,20 +41,11 @@
 
 constexpr uint32_t VK_FORMAT_BC7_UNORM_BLOCK = 145;
 constexpr uint32_t VK_FORMAT_BC7_SRGB_BLOCK = 146;
-
-// We only ship ETC2 RGBA8 (151 UNORM / 152 SRGB). The RGB8 (147/148) and
-// RGB-with-1-bit-alpha (149/150) variants are valid vkFormats but the rive
-// runtime always wants a 4-channel image; encoders should produce RGBA8.
 constexpr uint32_t VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151;
 constexpr uint32_t VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152;
-
-// ASTC LDR (VK_FORMAT_ASTC_<X>x<Y>_UNORM_BLOCK = 157,159,... and the SRGB
-// variant is the next value).
+// ASTC block range endpoints; the body maps the family by index between them.
 constexpr uint32_t VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157;
 constexpr uint32_t VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184;
-
-// ASTC block footprints come from <rive/decoders/astc_footprints.hpp>.
-
 constexpr uint32_t SupercompressionNone = 0;
 
 #pragma pack(push, 1)
@@ -87,11 +78,9 @@
 static_assert(sizeof(Ktx2LevelIndex) == 24,
               "KTX2 level index entry must be 24 bytes");
 
-// Defensive caps.
 constexpr uint32_t MaxDimension = 16384;
 constexpr uint32_t MaxLevels = 16;
 
-// BC7 and ASTC LDR are 16 bytes/block. ETC2 RGB8 is 8.
 inline uint64_t expectedBlockBytes(uint32_t pixelWidth,
                                    uint32_t pixelHeight,
                                    uint32_t blockWidth,
@@ -164,6 +153,7 @@
                      header.vkFormat);
         return false;
     }
+
     if (header.supercompressionScheme != SupercompressionNone)
     {
         std::fprintf(stderr,
diff --git a/dev/defs/assets/image_asset.json b/dev/defs/assets/image_asset.json
index eddbea9..45309a9 100644
--- a/dev/defs/assets/image_asset.json
+++ b/dev/defs/assets/image_asset.json
@@ -33,7 +33,17 @@
         "int": 1013,
         "string": "mips"
       },
-      "description": "Whether to generate a full mip chain. Only applies to BC7.",
+      "description": "Whether to generate a full mip chain. Applies to GPU-compressed formats (BC7/ASTC/ETC2).",
+      "runtime": false
+    },
+    "astcBlockSize": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 1030,
+        "string": "astcblocksize"
+      },
+      "description": "ASTC block-size index when format == astc. 0=4x4, 1=6x6, 2=8x8, 3=12x12. Ignored for non-ASTC formats.",
       "runtime": false
     }
   }