Пример #1
0
void
util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
{
   unsigned x, y, i, j;
   int block_size = 16;
   for(y = 0; y < height; y += 4) {
      const int8_t *src = (int8_t *)src_row;
      for(x = 0; x < width; x += 4) {
         for(j = 0; j < 4; ++j) {
            for(i = 0; i < 4; ++i) {
               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
               int8_t tmp_r, tmp_g;
               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
               util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
               dst[0] = byte_to_float_tex(tmp_r);
               dst[1] = byte_to_float_tex(tmp_g);
               dst[2] = 0.0;
               dst[3] = 1.0;
            }
         }
         src += block_size;
      }
      src_row += src_stride;
   }
}
Пример #2
0
void
util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
   int8_t tmp_r, tmp_g;
   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
   dst[0] = byte_to_float_tex(tmp_r);
   dst[1] = byte_to_float_tex(tmp_g);
   dst[2] = 0.0;
   dst[3] = 1.0;
}
Пример #3
0
static void
fetch_signed_la_latc2(const GLubyte *map,
                      GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
   GLbyte red, green;
   util_format_signed_fetch_texel_rgtc(rowStride,
                           (GLbyte *) map,
                           i, j, &red, 2);
   util_format_signed_fetch_texel_rgtc(rowStride,
                           (GLbyte *) map + 8,
                           i, j, &green, 2);
   texel[RCOMP] =
   texel[GCOMP] =
   texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
   texel[ACOMP] = BYTE_TO_FLOAT_TEX(green);
}
Пример #4
0
static void
fetch_signed_l_latc1(const GLubyte *map,
                     GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
   GLbyte red;
   util_format_signed_fetch_texel_rgtc(rowStride, (GLbyte *) map,
                           i, j, &red, 1);
   texel[RCOMP] =
   texel[GCOMP] =
   texel[BCOMP] = BYTE_TO_FLOAT(red);
   texel[ACOMP] = 1.0;
}