- if (!is_nop(util_format_dxtn_pack)) {
- unsigned x, y, i, j, k;
- for(y = 0; y < height; y += 4) {
- const float *src = src_row;
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += 4) {
- uint8_t tmp[4][4][3];
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- for(k = 0; k < 3; ++k) {
- tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]);
+ util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
+ width, height, UTIL_FORMAT_DXT5_RGBA,
+ 16, FALSE);
+}
+
+static INLINE void
+util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src, unsigned src_stride,
+ unsigned width, unsigned height,
+ enum util_format_dxtn format,
+ unsigned block_size, boolean srgb)
+{
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ float src_tmp;
+ for(k = 0; k < 3; ++k) {
+ src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
+ if (srgb) {
+ tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
+ }
+ else {
+ tmp[j][i][k] = float_to_ubyte(src_tmp);