GPUTexture: upload rejects a valid ETC2 RGBA block as needing four times its size
Summary
In Rive CLI 1.9.2, uploading a tightly packed 4×4 etc2-rgba8unorm texture fails buffer-size validation. The texture is one 16-byte compressed block. With the correct 16-byte block-row pitch, Rive reports that it needs 64 bytes. Explicitly setting the block-row count to 1 also fails because it is compared with the pixel height of 4.
The attached project reproduces this with one embedded block and an uncompressed control. It uses no external assets, image decoding, shaders, fetch calls, npm packages, or authentication.
The issue was found while investigating mobile scene memory use.
Environment
Reproduced November 16, 2026.
Rive CLI: rive 1.9.2, bundled native runtime, default renderer.
macOS 27.2.1 (26B131), Apple Silicon (arm64), Metal available.
The runtime source commit bundled with the CLI is not known. The separately inspected upstream source is pinned below.
This minimal project was tested in the native CLI. It has not been tested on iOS or in the web runtime.
Steps to reproduce
Unzip the attachment, then run these commands from the directory containing this README.
rive --version
rive repro --verify
rive repro --screenshot=repro/build/repro.png --advance=1
Read the terminal output or repro/build/rive.log. The screenshot is intentionally blank; the upload checks run in init. The script catches each upload error to run all cases, so a zero process exit code does not mean the uploads succeeded. --verify alone does not exercise the runtime failure.
The complete project consists of repro/rive.yaml and repro/main.luau. The failing call in case B is:
local texture = GPUTexture.new({
width = 4, height = 4, format = 'etc2-rgba8unorm',
})
-- data contains one valid, 16-byte ETC2 RGBA block.
texture:upload({data = data, bytesPerRow = 16})
Expected behavior
On a backend supporting ETC2 RGBA, case B should accept the 16-byte payload. A 4×4 image contains one 4×4 block, with 16 bytes per block. Its storage requirement is ceil(4 / 4) × ceil(4 / 4) × 16 = 16 bytes.
If rowsPerImage is intended to count block rows, case C should accept 1. If it counts pixel rows instead, buffer-size validation still needs to account for the compressed block height, and the units should be documented.
Actual behavior
A: default layout: main:26: upload: bytesPerRow is required for block compressed formats
B: block row pitch, default rows: main:29: upload: data is 16 bytes but the region needs 64
C: block row pitch and block row count: main:32: upload: rowsPerImage 1 is less than height 4
D: uncompressed control: OK
Case A establishes that compressed uploads require an explicit pitch. Cases B and C show the inconsistent compressed layout validation. Case D uploads a 4×4 rgba8unorm texture with 64 bytes successfully. These are upload API results, not a texture-rendering comparison. See observed-output.txt for the captured run.
Suspected cause
In Texture::upload at upstream commit b36f5c8, compressed formats require an explicit bytesPerRow, but the subsequent row validation and size calculation use pixel height:
An omitted rowsPerImage becomes height.
An explicit value below height is rejected.
Required bytes are calculated as bytesPerRow × rowsPerImage × depth.
This matches the observed errors: 16 × 4 × 1 = 64 instead of 16 bytes. It appears to happen in shared validation before uploadImpl. Please check block-aware row and buffer-size validation, including mip levels and partial blocks, and add compressed-format regression coverage alongside the existing upload-range tests.
Fixture and impact
The embedded block was generated from a solid opaque red 4×4 RGBA PNG using Khronos KTX-Software 4.4.2: ktx create --format R8G8B8A8_UNORM --assign-tf linear --encode uastc --uastc-quality 2 --threads 4, followed by ktx transcode --target etc-rgba. Only the 16-byte level-zero payload is embedded, without the KTX2 container.
This blocks tightly packed ETC2 uploads through the Luau GPU API. The same validation errors occurred with a 2048×2048 texture: 4,194,304 bytes of blocks and an 8,192-byte block-row pitch were reported as requiring 16,777,216 bytes.