@@ -732,24 +732,28 @@ struct block_size_descriptor
732732 *
733733 * The @c data_[rgba] fields store the image data in an encoded SoA float form designed for easy
734734 * vectorization. Input data is converted to float and stored as values between 0 and 65535. LDR
735- * data is stored as direct UNORM data, HDR data is stored as LNS data.
735+ * data is stored as direct UNORM data, HDR data is stored as LNS data. They are allocated SIMD
736+ * elements over-size to allow vectorized stores of unaligned and partial SIMD lanes (e.g. in a
737+ * 6x6x6 block the final row write will read elements 210-217 (vec8) or 214-217 (vec4), which is
738+ * two elements above the last real data element). The overspill values are never written to memory,
739+ * and would be benign, but the padding avoids hitting undefined behavior.
736740 *
737741 * The @c rgb_lns and @c alpha_lns fields that assigned a per-texel use of HDR are only used during
738742 * decompression. The current compressor will always use HDR endpoint formats when in HDR mode.
739743 */
740744struct image_block
741745{
742746 /* * @brief The input (compress) or output (decompress) data for the red color component. */
743- ASTCENC_ALIGNAS float data_r[BLOCK_MAX_TEXELS];
747+ ASTCENC_ALIGNAS float data_r[BLOCK_MAX_TEXELS + ASTCENC_SIMD_WIDTH - 1 ];
744748
745749 /* * @brief The input (compress) or output (decompress) data for the green color component. */
746- ASTCENC_ALIGNAS float data_g[BLOCK_MAX_TEXELS];
750+ ASTCENC_ALIGNAS float data_g[BLOCK_MAX_TEXELS + ASTCENC_SIMD_WIDTH - 1 ];
747751
748752 /* * @brief The input (compress) or output (decompress) data for the blue color component. */
749- ASTCENC_ALIGNAS float data_b[BLOCK_MAX_TEXELS];
753+ ASTCENC_ALIGNAS float data_b[BLOCK_MAX_TEXELS + ASTCENC_SIMD_WIDTH - 1 ];
750754
751755 /* * @brief The input (compress) or output (decompress) data for the alpha color component. */
752- ASTCENC_ALIGNAS float data_a[BLOCK_MAX_TEXELS];
756+ ASTCENC_ALIGNAS float data_a[BLOCK_MAX_TEXELS + ASTCENC_SIMD_WIDTH - 1 ];
753757
754758 /* * @brief The number of texels in the block. */
755759 uint8_t texel_count;
0 commit comments