int main() { static_assert(sizeof(gli::detail::dxt1_block) == 8, "DXT1-compressed block must be of size 8."); static_assert(sizeof(gli::detail::dxt3_block) == 16, "DXT3-compressed block must be of size 16."); static_assert(sizeof(gli::detail::dxt5_block) == 16, "DXT5-compressed block must be of size 16."); int Error(0); gli::texture2d::extent_type const TextureSize(32); gli::size_t const Levels = gli::levels(TextureSize); Error += test_texture( gli::texture2d(gli::FORMAT_R8_UNORM_PACK8, TextureSize, Levels), glm::uint8(255), glm::uint8(0)); Error += test_texture( gli::texture2d(gli::FORMAT_RGB8_UNORM_PACK8, TextureSize, Levels), glm::u8vec3(255, 128, 0), glm::u8vec3(0, 128, 255)); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA8_UNORM_PACK8, TextureSize, Levels), glm::u8vec4(255, 128, 0, 255), glm::u8vec4(0, 128, 255, 255)); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA32_SFLOAT_PACK32, TextureSize, Levels), glm::f32vec4(1.0, 0.5, 0.0, 1.0), glm::f32vec4(0.0, 0.5, 1.0, 1.0)); Error += test_texture( gli::texture2d_array(gli::FORMAT_RGBA8_UNORM_PACK8, TextureSize, 4, Levels), glm::u8vec4(255, 128, 0, 255), glm::u8vec4(0, 128, 255, 255)); Error += test_texture( gli::texture2d_array(gli::FORMAT_RGBA32_SFLOAT_PACK32, TextureSize, 4, Levels), glm::f32vec4(1.0, 0.5, 0.0, 1.0), glm::f32vec4(0.0, 0.5, 1.0, 1.0)); Error += test_texture( gli::texture2d(gli::FORMAT_RGB_DXT1_UNORM_BLOCK8, TextureSize, Levels), gli::detail::dxt1_block{63721, 255, 228, 144, 64, 0}, gli::detail::dxt1_block{2516, 215, 152, 173, 215, 106}); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA_DXT1_UNORM_BLOCK8, TextureSize, Levels), gli::detail::dxt1_block{63721, 255, 228, 144, 64, 0}, gli::detail::dxt1_block{2516, 215, 152, 173, 215, 106}); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA_DXT3_UNORM_BLOCK16, TextureSize, Levels), gli::detail::dxt3_block{12514, 1512, 12624, 16614, 63712, 255, 228, 144, 64, 0}, gli::detail::dxt3_block{36125, 2416, 46314, 10515, 2516, 215, 152, 173, 215, 106}); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA_DXT5_UNORM_BLOCK16, TextureSize, Levels), gli::detail::dxt5_block{255, 0, 0b01000000, 0b00011110, 0b00110010, 0b00101101, 0b11110010, 0b01000100, 63712, 255, 228, 144, 64, 0}, gli::detail::dxt5_block{0, 255, 0b00111110, 0b10010000, 0b11100100, 0b11010110, 0b00111011, 0b11001000, 2516, 215, 152, 173, 215, 106}); return Error; }
int main() { int Error(0); gli::texture2d::extent_type const TextureSize(32); gli::size_t const Levels = gli::levels(TextureSize); Error += test_texture( gli::texture2d(gli::FORMAT_R8_UNORM_PACK8, TextureSize, Levels), glm::uint8(255), glm::uint8(0)); Error += test_texture( gli::texture2d(gli::FORMAT_RGB8_UNORM_PACK8, TextureSize, Levels), glm::u8vec3(255, 128, 0), glm::u8vec3(0, 128, 255)); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA8_UNORM_PACK8, TextureSize, Levels), glm::u8vec4(255, 128, 0, 255), glm::u8vec4(0, 128, 255, 255)); Error += test_texture( gli::texture2d(gli::FORMAT_RGBA32_SFLOAT_PACK32, TextureSize, Levels), glm::f32vec4(1.0, 0.5, 0.0, 1.0), glm::f32vec4(0.0, 0.5, 1.0, 1.0)); Error += test_texture( gli::texture2d_array(gli::FORMAT_RGBA8_UNORM_PACK8, TextureSize, 4, Levels), glm::u8vec4(255, 128, 0, 255), glm::u8vec4(0, 128, 255, 255)); Error += test_texture( gli::texture2d_array(gli::FORMAT_RGBA32_SFLOAT_PACK32, TextureSize, 4, Levels), glm::f32vec4(1.0, 0.5, 0.0, 1.0), glm::f32vec4(0.0, 0.5, 1.0, 1.0)); return Error; }
int main() { int Error(0); gli::texture2D::dim_type const TextureSize(32); std::size_t const Levels = gli::levels(TextureSize); Error += test_texture( gli::texture2D(Levels, gli::R8_UNORM, TextureSize), glm::uint8(255), glm::uint8(0)); Error += test_texture( gli::texture2D(Levels, gli::RGB8_UNORM, TextureSize), glm::u8vec3(255, 128, 0), glm::u8vec3(0, 128, 255)); Error += test_texture( gli::texture2D(Levels, gli::RGBA8_UNORM, TextureSize), glm::u8vec4(255, 128, 0, 255), glm::u8vec4(0, 128, 255, 255)); Error += test_texture( gli::texture2D(Levels, gli::RGBA32F, TextureSize), glm::f32vec4(1.0, 0.5, 0.0, 1.0), glm::f32vec4(0.0, 0.5, 1.0, 1.0)); Error += test_texture( gli::texture2DArray(4, Levels, gli::RGBA8_UNORM, TextureSize), glm::u8vec4(255, 128, 0, 255), glm::u8vec4(0, 128, 255, 255)); Error += test_texture( gli::texture2DArray(4, Levels, gli::RGBA32F, TextureSize), glm::f32vec4(1.0, 0.5, 0.0, 1.0), glm::f32vec4(0.0, 0.5, 1.0, 1.0)); return Error; }
int main(int argc, char *argv[]) { test_texture(argv[1]); return 0; }