Lines Matching defs:hdr
947 ktx_header hdr;
948 size_t header_bytes_read = fread(&hdr, 1, sizeof(hdr), f);
950 if (header_bytes_read != sizeof(hdr))
957 if (memcmp(hdr.magic, ktx_magic, 12) != 0 || (hdr.endianness != 0x04030201 && hdr.endianness != 0x01020304))
965 if (hdr.endianness == 0x01020304)
967 ktx_header_switch_endianness(&hdr);
971 if (hdr.gl_type == 0 || hdr.gl_format == 0)
983 switch (hdr.gl_format)
1020 switch (hdr.gl_type)
1026 switch (hdr.gl_format)
1059 switch (hdr.gl_format)
1092 switch (hdr.gl_format)
1125 switch (hdr.gl_format)
1160 if (hdr.number_of_mipmap_levels > 1)
1162 printf("WARNING: KTX file %s has %d mipmap levels; only the first one will be encoded.\n", filename, hdr.number_of_mipmap_levels);
1165 if (hdr.number_of_array_elements > 1)
1167 printf("WARNING: KTX file %s contains a texture array with %d layers; only the first one will be encoded.\n", filename, hdr.number_of_array_elements);
1170 if (hdr.number_of_faces > 1)
1176 unsigned int dim_x = hdr.pixel_width;
1177 unsigned int dim_y = astc::max(hdr.pixel_height, 1u);
1178 unsigned int dim_z = astc::max(hdr.pixel_depth, 1u);
1181 fseek(f, hdr.bytes_of_key_value_data, SEEK_CUR);
1221 if (hdr.gl_type_size == 2)
1226 if (hdr.gl_type_size == 4)
1287 ktx_header hdr;
1288 size_t actual = fread(&hdr, 1, sizeof(hdr), f);
1289 if (actual != sizeof(hdr))
1296 if (memcmp(hdr.magic, ktx_magic, 12) != 0 ||
1297 (hdr.endianness != 0x04030201 && hdr.endianness != 0x01020304))
1305 if (hdr.endianness == 0x01020304)
1308 ktx_header_switch_endianness(&hdr);
1311 if (hdr.gl_type != 0 || hdr.gl_format != 0 || hdr.gl_type_size != 1 ||
1312 hdr.gl_base_internal_format != GL_RGBA)
1319 const format_entry* fmt = get_format(hdr.gl_internal_format);
1329 seekerr = fseek(f, hdr.bytes_of_key_value_data, SEEK_CUR);
1367 img.dim_x = hdr.pixel_width;
1368 img.dim_y = hdr.pixel_height;
1369 img.dim_z = hdr.pixel_depth == 0 ? 1 : hdr.pixel_depth;
1396 ktx_header hdr;
1397 memcpy(hdr.magic, ktx_magic, 12);
1398 hdr.endianness = 0x04030201;
1399 hdr.gl_type = 0;
1400 hdr.gl_type_size = 1;
1401 hdr.gl_format = 0;
1402 hdr.gl_internal_format = fmt;
1403 hdr.gl_base_internal_format = GL_RGBA;
1404 hdr.pixel_width = img.dim_x;
1405 hdr.pixel_height = img.dim_y;
1406 hdr.pixel_depth = (img.dim_z == 1) ? 0 : img.dim_z;
1407 hdr.number_of_array_elements = 0;
1408 hdr.number_of_faces = 1;
1409 hdr.number_of_mipmap_levels = 1;
1410 hdr.bytes_of_key_value_data = 0;
1421 actual += fwrite(&hdr, 1, sizeof(ktx_header), wf);
1455 ktx_header hdr;
1469 memcpy(hdr.magic, ktx_magic, 12);
1470 hdr.endianness = 0x04030201;
1471 hdr.gl_type = (bitness == 16) ? GL_HALF_FLOAT : GL_UNSIGNED_BYTE;
1472 hdr.gl_type_size = bitness / 8;
1473 hdr.gl_format = gl_format_of_components[image_components - 1];
1476 hdr.gl_internal_format = gl_sized_format_of_components_hdr[image_components - 1];
1480 hdr.gl_internal_format = gl_sized_format_of_components_ldr[image_components - 1];
1482 hdr.gl_base_internal_format = hdr.gl_format;
1483 hdr.pixel_width = dim_x;
1484 hdr.pixel_height = dim_y;
1485 hdr.pixel_depth = (dim_z == 1) ? 0 : dim_z;
1486 hdr.number_of_array_elements = 0;
1487 hdr.number_of_faces = 1;
1488 hdr.number_of_mipmap_levels = 1;
1489 hdr.bytes_of_key_value_data = 0;
1631 size_t hdr_bytes_written = fwrite(&hdr, 1, sizeof(ktx_header), wf);
1774 dds_header hdr;
1776 size_t header_bytes_read = fread(&hdr, 1, sizeof(hdr), f);
1777 if (magic_bytes_read != 4 || header_bytes_read != sizeof(hdr))
1786 if (magicx != DDS_MAGIC || hdr.size != 124)
1794 if (hdr.ddspf.flags & 4)
1796 if (hdr.ddspf.fourcc == DX10_MAGIC)
1820 unsigned int dim_x = hdr.width;
1821 unsigned int dim_y = hdr.height;
1822 unsigned int dim_z = (hdr.flags & 0x800000) ? hdr.depth : 1;
1905 uint32_t flags = hdr.ddspf.flags;
1906 uint32_t bitcount = hdr.ddspf.rgbbitcount;
1907 uint32_t rmask = hdr.ddspf.rbitmask;
1908 uint32_t gmask = hdr.ddspf.gbitmask;
1909 uint32_t bmask = hdr.ddspf.bbitmask;
1910 uint32_t amask = hdr.ddspf.abitmask;
2084 dds_header hdr;
2085 hdr.size = 124;
2086 hdr.flags = 0x100F | (dim_z > 1 ? 0x800000 : 0);
2087 hdr.height = dim_y;
2088 hdr.width = dim_x;
2089 hdr.pitch_or_linear_size = image_components * (bitness / 8) * dim_x;
2090 hdr.depth = dim_z;
2091 hdr.mipmapcount = 1;
2094 hdr.reserved1[i] = 0;
2096 hdr.caps = 0x1000;
2097 hdr.caps2 = (dim_z > 1) ? 0x200000 : 0;
2098 hdr.caps3 = 0;
2099 hdr.caps4 = 0;
2104 hdr.ddspf = format_of_image_components[image_components - 1];
2108 hdr.ddspf = dxt10_diverter;
2265 size_t hdr_bytes_written = fwrite(&hdr, 1, sizeof(dds_header), wf);
2345 {".hdr", ".HDR", 16, store_hdr_image_with_stb},
2470 astc_header hdr;
2471 file.read(reinterpret_cast<char*>(&hdr), sizeof(astc_header));
2478 unsigned int magicval = unpack_bytes(hdr.magic[0], hdr.magic[1], hdr.magic[2], hdr.magic[3]);
2486 unsigned int block_x = astc::max(static_cast<unsigned int>(hdr.block_x), 1u);
2487 unsigned int block_y = astc::max(static_cast<unsigned int>(hdr.block_y), 1u);
2488 unsigned int block_z = astc::max(static_cast<unsigned int>(hdr.block_z), 1u);
2490 unsigned int dim_x = unpack_bytes(hdr.dim_x[0], hdr.dim_x[1], hdr.dim_x[2], 0);
2491 unsigned int dim_y = unpack_bytes(hdr.dim_y[0], hdr.dim_y[1], hdr.dim_y[2], 0);
2492 unsigned int dim_z = unpack_bytes(hdr.dim_z[0], hdr.dim_z[1], hdr.dim_z[2], 0);
2531 astc_header hdr;
2532 hdr.magic[0] = ASTC_MAGIC_ID & 0xFF;
2533 hdr.magic[1] = (ASTC_MAGIC_ID >> 8) & 0xFF;
2534 hdr.magic[2] = (ASTC_MAGIC_ID >> 16) & 0xFF;
2535 hdr.magic[3] = (ASTC_MAGIC_ID >> 24) & 0xFF;
2537 hdr.block_x = static_cast<uint8_t>(img.block_x);
2538 hdr.block_y = static_cast<uint8_t>(img.block_y);
2539 hdr.block_z = static_cast<uint8_t>(img.block_z);
2541 hdr.dim_x[0] = img.dim_x & 0xFF;
2542 hdr.dim_x[1] = (img.dim_x >> 8) & 0xFF;
2543 hdr.dim_x[2] = (img.dim_x >> 16) & 0xFF;
2545 hdr.dim_y[0] = img.dim_y & 0xFF;
2546 hdr.dim_y[1] = (img.dim_y >> 8) & 0xFF;
2547 hdr.dim_y[2] = (img.dim_y >> 16) & 0xFF;
2549 hdr.dim_z[0] = img.dim_z & 0xFF;
2550 hdr.dim_z[1] = (img.dim_z >> 8) & 0xFF;
2551 hdr.dim_z[2] = (img.dim_z >> 16) & 0xFF;
2560 file.write(reinterpret_cast<char*>(&hdr), sizeof(astc_header));