Google Filament source code learning (2): summary of three-party library classification

foreword

I am at a loss when I get the Filament code. How to look at it, let’s start with the third-party library. The three-party library is classified and sorted out as follows.

注:刚刚开始学习,有很多库和基本概念都不是很清楚,有不当之处请大家随时指出,本人一定虚心接受。


1. Compression related

1.1 draco

Introduction: Draco is a library released by the Google Chrome team in January 2017. Draco is a library for compressing and decompressing 3D geometric grids and point clouds. It aims to improve the storage and transmission of 3D graphics, and greatly accelerate the encoding and transmission of 3D data. and decode.
Draco can be used to compress mesh and point cloud data. It also supports compressing points, connectivity information, texture coordination, color information, normals, and other common geometry-related attributes.
Reference URL: https://github.com/google/draco

1.2 lbs

Summary: zlib is a general-purpose data compression library. All code is thread safe. The data format used by the zlib library is described by the RFC (Request for Comments) documents from 1950 to 1952 http://tools.ietf.org/html/rfc1950 ( zlib format), rfc1951 (deflate format) and rfc1952 (gzip format) .
Reference URL: https://github.com/madler/zlib


2. Image and texture operations

2.1 basis

Introduction: Basis UniversalIt is an " ultra-compressed " GPU texture data exchange system that supports two highly compressed intermediate file formats (.Basis or Khronos Group's .KTX2 open standard), which can quickly transcode to various GPU compressed and uncompressed pixel formats : ASTC 4x4 L/LA/RGB/RGBA, PVRTC1 4bpp RGB/RGBA, PVRTC2 RGB/RGB, BC7 mode 6 RGB, BC1-5 RGB/RGBA/X/XY, ETC1 RGB, ETC2 RGBA, ATC RGB/RGBA, ETC2 EAC R11 and RG11, FXT1 RGB and uncompressed raster image formats 8888/565/4444.

Basis Universal is a “supercompressed” GPU texture data interchange system that supports two highly compressed intermediate file formats (.basis or the .KTX2 open standard from the Khronos Group) that can be quickly transcoded to a very wide variety of GPU compressed and uncompressed pixel formats: ASTC 4x4 L/LA/RGB/RGBA, PVRTC1 4bpp RGB/RGBA, PVRTC2 RGB/RGBA, BC7 mode 6 RGB, BC7 mode 5 RGB/RGBA, BC1-5 RGB/RGBA/X/XY, ETC1 RGB, ETC2 RGBA, ATC RGB/RGBA, ETC2 EAC R11 and RG11, FXT1 RGB, and uncompressed raster image formats 8888/565/4444.

Google partnered with Binomial to open source the Basis Universal texture codec in 2019, with the goal of achieving more efficient high-quality textures for network transmission and GPU use cases. Taking GPU as an example, the Basis Universal texture format is 6-8 times smaller than JPEG, but the storage size of the two is similar. The fact that current GPU compression methods are inefficient and do not support cross-platform operation makes it an excellent alternative. The format is suitable for various use cases, such as games, VR/AR, maps, photos, short videos and more.

Reference URL: https://github.com/BinomialLLC/basis_universal

2.2 libpng

Introduction: png image codec library
Reference URL: https://github.com/glennrp/libpng

2.3 stb

Introduction: An easy-to-use image library, main features:

  • Image reading: support JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC analysis
  • Image writing: support PNG, TGA, BMP
  • Image pixel adjustment
  • truetype font handling: parse, decode, and rasterize characters in truetype fonts
  • Audio waveform synthesizer.

Reference URL: https://github.com/nothings/stb

2.4 tinyxr

Summary: tinyexr is a tiny single-header library for loading and saving OpenEXR (.exr) images, a high dynamic range raster file format. tinyexr is written in portable C++ (no library dependencies other than STL), so tinyexr is well suited for embedding into applications. To use tinyexr, just copy tinyexr.h into your project.

tinyexr is a small, single header-only library to load and save OpenEXR (.exr) images. tinyexr is written in portable C++ (no library dependency except for STL), thus tinyexr is good to embed into your application. To use tinyexr, simply copy tinyexr.h into your project.

Reference URL: https://github.com/syoyo/tinyexr


3. Testing Framework

3.1 benchmark

Introduction: "The most successful application of Benchmark in the computer field is performance testing, which mainly tests load execution time, transmission speed, throughput, resource occupancy, etc. The two powerful tools for performance tuning are Benchmark and profile tools. Benchmark uses stress
testing Mining the performance status of the entire system, and the profile tool maximizes the display of the system's operating status and performance indicators, which is convenient for users to diagnose performance problems and perform tuning.
Refer to the official website: https://github.com/google/benchmark

3.2 libgtest

Introduction: Gtest is an open source framework from Google, which is mainly used for unit testing and can be used on multiple platforms (including Linux, Mac OS X, Windows, Cygwin and Symbian). It provides rich assertions, fatal and non-fatal failure judgments, and can perform value parameterized tests, type parameterized tests, and death tests.

Reference URL: https://github.com/google/googletest


4. 3D model operation

4.1 cgltf

Introduction: Single-file, STB-style glTF file reading and writing library.

  • Support gltf 2.0 specification, the extension can be gltf (JSON specification) and glb (binary specification).
  • At the same time, it also supports some extended attributes of glTF, such as EXT_mesh_gpu_instancing, EXT_meshopt_compression, KHR_draco_mesh_compression ...
    If you are not familiar with gltf, you can refer to the website: https://github.com/KhronosGroup/glTF
    It is used in: bgfx , Filament , gltfpack , raylib , Unigine , and more!

Reference URL: https://github.com/jkuhlmann/cgltf

4.2 libassimp

Introduction: Open Asset Importer Lib (assimp for short) is a library for loading and processing geometric scenes from various 3D data formats. It is primarily used to import assets once from various sources and store them in an engine-specific format for easy and fast loading. assimp is also able to apply various post operations on imported data: normal and tangent space generation, triangulation, vertex cache local optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging redundant materials, etc.

Additionally, assimp features various mesh post processing tools: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.

  • Supports loading of more than 50 specifications such as 3DS, BLEND, FBX, DXF, glTF2.0, OBJ, PLY, etc.
  • Support the export of more than a dozen specifications such as DAE, STL, OBJ, PLY, X, 3DS, GLTF2.0, FBX, etc.

Reference URL: https://github.com/assimp/assimp


5. UI interface and hardware interaction library

5.1 imgui

Description: Dear ImGuiis a free graphical user interface library for C++. It outputs optimized vertex buffers that you can render at any time in your 3D pipeline-enabled application. It's fast, portable, renderer-agnostic, and self-contained (no external dependencies).

Dear ImGui is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).

Dear ImGuiDesigned to enable rapid iteration and enable programmers to create content creation tools and visualization/debugging tools (as opposed to normal end-user UIs). It favors simplicity and productivity for this purpose, but lacks certain features typically found in more advanced libraries.

Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and lacks certain features normally found in more high-level libraries.

Dear ImGuiEspecially suitable for integration in game engines (for tools), real-time 3D applications, full-screen applications, embedded applications or any application on console platforms where the operating system capabilities are not standard.

Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.

Reference URL: https://github.com/ocornut/imgui

5.2 gltumble

Description: Provides a math class called Trackball that allows users to flip objects by dragging with a mouse, trackpad, or touchscreen. It can optionally apply inertia so that the object continues to rotate when flicked.

This library provides a math class called Trackball that allows users to tumble an object by dragging with a mouse, trackpad, or touch screen. It optionally applies inertia such that the object continues to spin if you flick it.

Reference URL: https://github.com/prideout/gltumble

5.3 libsdl2

Introduction: Simple DirectMedia Layer is a cross-platform development library designed to provide low-level access to audio, keyboard, mouse, joystick, and graphics hardware through OpenGL and Direct3D. It is used by video playback software, emulators, and popular games, including Valve's award-winning catalog and many Humble Bundle games.
Reference URL: github: https://github.com/libsdl-org/
Blog post: Introduction to SDL (Simple DirectMedia Layer)


6. Rendering related

6.1 glass hose

Introduction: glslang provides the following components/functions

  • Reference Validator and GLSL/ESSL -> AST Front End
    An OpenGL GLSL and OpenGL|ES GLSL (ESSL) front-end for reference validation and translation of GLSL/ESSL into an internal abstract syntax tree (AST).

  • HLSL -> AST Front End
    An HLSL front-end for translation of an approximation of HLSL to glslang’s AST form.

  • AST -> SPIR-V Back End
    Translates glslang’s AST to the Khronos-specified SPIR-V intermediate language.

  • Reflector
    An API for getting reflection information from the AST, reflection types/variables/etc. from the HLL source (not the SPIR-V).

  • Standalone Wrapper
    glslangValidator is command-line tool for accessing the functionality above.

Reference: glslangValidator is a GLSL reference compiler customized by the official Khronos Group of the OpenGL standard. The command-line compilation mode facilitates users to directly test the glsl syntax without compiling C/C++-related dependencies, and does not need to write a large number of initialization codes in the main file. .

Reference URL: https://github.com/KhronosGroup/glslang

6.2 meshoptimizer

Summary: When a GPU renders a triangle mesh, various stages of the GPU pipeline must process vertex and index data. The efficiency of these stages depends on the data you feed them; the library provides algorithms to help optimize meshes for these stages, as well as algorithms to reduce mesh complexity and storage overhead.

When a GPU renders triangle meshes, various stages of the GPU pipeline have to process vertex and index data. The efficiency of these stages depends on the data you feed to them; this library provides algorithms to help optimize meshes for these stages, as well as algorithms to reduce the mesh complexity and storage overhead.

It also provides a gltfpack tool to optimize glTF files.

The mesh data will be optimized through the following "pipeline":

  1. Indexing
  2. (optional, discussed last) Simplification
  3. Vertex cache optimization
  4. Overdraw optimization
  5. Vertex fetch optimization
  6. Vertex quantization
  7. (optional) Vertex/index buffer compression

Reference URL: https://github.com/zeux/meshoptimizer

6.3 smol-v

Introduction: SMOL-V implements the Vulkan/Khronos SPIR-V specification to be smaller and more compressed.

SMOL-V encodes Vulkan/Khronos SPIR-V format programs into a form that is smoller, and is more compressible.

Reference URL: https://github.com/aras-p/smol-v

6.4 spirv-cross

Introduction: SPIRV-Cross realizes the parsing and conversion of SRIR-V specifications into other shader languages.

SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.

Key features include:

  • Convert SPIR-V to readable, usable and efficient GLSL
  • Convert SPIR-V to readable, usable and efficient Metal Shading Language (MSL)
  • Convert SPIR-V to readable, usable and efficient HLSL
  • Convert SPIR-V to debuggable C++ [DEPRECATED]
  • Convert SPIR-V to a JSON reflection format [EXPERIMENTAL]
  • Reflection API to simplify the creation of Vulkan pipeline layouts
  • Reflection API to modify and tweak OpDecorations
  • Supports “all” of vertex, fragment, tessellation, geometry and compute shaders.

Reference URL: https://github.com/KhronosGroup/SPIRV-Cross

6.5 spirv-tools

Introduction: SPIR-V Tools provides APIs and instructions for processing SPIR-V models.
The project includes an assembler, binary module parser, disassembler, verifier and optimizer for SPIR-V. All are based on a common static library, except the optimizer. The library contains all implementation details and is used in standalone tools, while also being directly integrated into other codebases. The optimizer implementation resides in its own library, which depends on the core library.

The project includes an assembler, binary module parser, disassembler, validator, and optimizer for SPIR-V. Except for the optimizer, all are based on a common static library. The library contains all of the implementation details, and is used in the standalone tools whilst also enabling integration into other code bases directly. The optimizer implementation resides in its own library, which depends on the core library.

Reference URL: https://github.com/KhronosGroup/SPIRV-Tools

6.6 vkmemalloc

Introduction: An easy-to-integrate Vulkan memory management library. This library helps game developers better manage memory allocation and resource creation by providing higher-level functionalities.

  • Features to help select the correct and optimal memory type based on the expected usage of the memory
  • Functions that allocate a memory block, reserve part of it, and return it to the user (VkDeviceMemory + offset + size).
  • Functions that can create images/buffers, allocate memory for them, and bind them together - all in one call.
  • Functions that help to choose correct and optimal memory type based on intended usage of the memory.
  • Functions that allocate memory blocks, reserve and return parts of them (VkDeviceMemory + offset + size) to the user.
  • Functions that can create an image/buffer, allocate memory for it and bind them together - all in one call.

Reference URL: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator


7. Tool library

7.1 civetweb

Introduction: The project task is to provide an easy-to-use, powerful C (C/C++) embedded web server with optional CGI, SSL and Lua support. CivetWeb has an MIT license, so you can innovate without limits.

Project mission is to provide easy to use, powerful, C (C/C++) embeddable web server with optional CGI, SSL and Lua support. CivetWeb has a MIT license so you can innovate without restrictions.

It can be used as a class library and added to existing programs to increase web service functions, and it can also be used as a web server running independently on Windows, Mac, Linux, UNIX, IOS, Android, Buildroot and other platforms.
The features described on the official website that I am more concerned about are as follows:

  • Works on Windows, Mac, Linux, UNIX, IOS, Android, Buildroot, and many other platforms.
  • Scripting and database support (CGI, Lua Server Pages, Server side Lua scripts, Lua SQLite database, Server side JavaScript). This provides a ready to go, powerful web development platform in a one single-click executable with no dependencies. 0
  • Support for CGI, SSI, HTTP digest (MD5) authorization, WebSocket, WebDAV.
  • HTTPS (SSL/TLS) support using OpenSSL.
  • Resumed download, URL rewrite, file blacklist, IP-based ACL.

Reference URL: https://github.com/civetweb/civetweb

7.2 topped

Introduction: Function description getopt() is used to analyze command line parameters.

  1. The parameters argc and argv respectively represent the number and content of parameters, which are the same as the command line parameters of the main() function.
  2. The parameter optstring is an option string, which tells getopt() which option can be processed and which option requires parameters. If the letter in the option string is followed by a colon ":", it means that there are related parameters, and the global variable optarg will point to this extra parameters.
  3. If other options that do not conform to optstring are encountered during processing, getopt() will display an error message and set the global variable optopt to "?" character. If you do not want getopt() to print an error message, just set the global variable opterr Just set it to 0.

Reference URL: I did not find the source of the code. The instructions for use can be found on Baidu Encyclopedia. The instructions and examples are very clear https://baike.baidu.com/item/getopt/4705064

7.3 hat-trie

Introduction: Based on the "HAT-trie: A Trie Implementation for ACache-consciousTrie-based Data Structures" (Askitis Nikolas and Sinha Ranjan, 2007) paper. Currently, only the pure HAT-trie has been implemented, and a hybrid version may arrive later. About HAT Details of the -trie data structure can be found here.

Trie implementation based on the “HAT-trie: A Cache-conscious Trie-based Data Structure for Strings.” (Askitis Nikolas and Sinha Ranjan, 2007) paper. For now, only the pure HAT-trie has been implemented, the hybrid version may arrive later. Details regarding the HAT-trie data structure can be found here.

This library provides an efficient and compact way to store sets or maps of strings by compressing common prefixes. It also allows searching for keys matching a prefix. Note that although the default parameters of the structure are optimized for exact searches, if you do a lot of prefix searches, you may need to lower the burst threshold via the burst_threshold method.
Reference URL: https://www.5axxw.com/wiki/content/kk9uuf

7.4 jsmn

Introduction: jsmn is a simple C language JSON parser. It can be easily integrated into resource limited or embedded projects.
jsmn is designed to be robust (it should work fine even with bad data), fast (it should parse data on the fly), and portable (no redundant dependencies or non-standard C extensions). Of course, simplicity is a key feature - simple coding style, simple algorithms, easy integration with other projects.

jsmn is designed to be robust (it should work fine even with erroneous data), fast (it should parse data on the fly), portable (no superfluous dependencies or non-standard C extensions). And of course, simplicity is a key feature - simple code style, simple algorithm, simple integration into other projects.

Reference URL: https://github.com/zserge/jsmn

7.5 robin-map

Introduction: C++ Implementation of Fast Hash Maps and Hash Sets Using Cyclic Hashing

A C++ implementation of a fast hash map and hash set using robin hood hashing

The CircularMap library is a C++ implementation of fast hashmaps and hashsets, using open addressing and linear circular hashing with shift-behind-delete to resolve collisions.

The robin-map library is a C++ implementation of a fast hash map and hash set using open-addressing and linear robin hood hashing with backward shift deletion to resolve collisions.

Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map and tsl::robin_pg_set. The first two are faster and use a power-of-two growth strategy, the latter two use a primary growth strategy and are better able to cope with poor hash functions. Use the prime version if there is a chance of repeating the pattern in the low bits of the hash (e.g. you store pointers with an identity hash function). See Growth Strategies for details.

Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map and tsl::robin_pg_set. The first two are faster and use a power of two growth policy, the last two use a prime growth policy instead and are able to cope better with a poor hash function. Use the prime version if there is a chance of repeating patterns in the lower bits of your hash (e.g. you are storing pointers with an identity hash function). See GrowthPolicy for details.

It is reported on the Internet that "the performance of tsl::robin_map can basically reach 5-10 times that of std::unordered_map", but I haven't tested it myself.

Reference official website: https://github.com/Tessil/robin-map
Reference URL:


8. Some JS library

8.1 gl-matrix

Summary: Javascript has evolved into a language capable of handling real-time 3D graphics and computationally intensive tasks such as physics simulations via WebGL. These types of applications require high-performance vector and matrix math, which Javascript does not provide by default. glMatrix to the rescue!

Javascript has evolved into a language capable of handling realtime 3D graphics, via WebGL, and computationally intensive tasks such as physics simulations. These types of applications demand high performance vector and matrix math, which is something that Javascript doesn’t provide by default. glMatrix to the rescue!

glMatrix is ​​designed to perform vector and matrix operations quickly! By manually tuning each function for optimal performance, and encouraging efficient usage patterns through API conventions, glMatrix will help you get the most out of your browser's Javascript engine.

glMatrix is designed to perform vector and matrix operations stupidly fast! By hand-tuning each function for maximum performance and encouraging efficient usage patterns through API conventions, glMatrix will help you get the most out of your browsers Javascript engine.

Reference URL: https://glmatrix.net/

8.2 market depth

Summary: Markdeep is a technology for writing plain text documents, whether local or remote, that look good in any web browser. It supports charts, calendars, formulas, and other features as extensions to Markdown syntax.

Markdeep is a technology for writing plain text documents that will look good in any web browser, whether local or remote. It supports diagrams, calendars, equations, and other features as extensions of Markdown syntax.

Reference URL: https://casual-effects.com/markdeep/


9. Auxiliary resources

9.1 environments

Introduction: Some HDR (High-Dynamic Range) image resources

9.2 models

Introduction: Some glTF, glb files

9.3 textures

Introduction: some png texture image resources

Guess you like

Origin blog.csdn.net/bluebird888/article/details/127592098