Repository: google/filament
File: filament/backend/include/backend/DriverEnums.h (C/C++)

Code before:
  INT,
  FLOAT,
  BOOL
};

enum class Precision : uint8_t {
    LOW,
    MEDIUM,
    HIGH,
    DEFAULT
};

/**
 * Shader compiler priority queue
 *
 * On platforms which support parallel shader compilation, compilation requests will be processed in
 * order of priority, then insertion order. See Material::compile().
 */
enum class CompilerPriorityQueue : uint8_t {
    /** We need this program NOW.
     *
     * When passed as an argument to Material::compile(), if the platform doesn't support parallel
     * compilation, but does support amortized shader compilation, the given shader program will be
     * synchronously compiled.
     */
    IMMEDIATE,
    /** We will need this program soon. */
    HIGH,
    /** We will need this program eventually. */
    LOW
};

//! Texture sampler type
enum class SamplerType : uint8_t {
    SAMPLER_2D,             //!< 2D texture
    SAMPLER_2D_ARRAY,       //!< 2D array texture
    SAMPLER_CUBEMAP,        //!< Cube map texture
    SAMPLER_EXTERNAL,       //!< External texture
    SAMPLER_3D,             //!< 3D texture
    SAMPLER_CUBEMAP_ARRAY,  //!< Cube map array texture (feature level 2)
};

constexpr std::string_view to_string(SamplerType const type) noexcept {
    switch (type) {
        case SamplerType::SAMPLER_2D:
            return "SAMPLER_2D";
        case SamplerType::SAMPLER_2D_ARRAY:
            return "SAMPLER_2D_ARRAY";
        case SamplerType::SAMPLER_CUBEMAP:
            return "SAMPLER_CUBEMAP";
        case SamplerType::SAMPLER_EXTERNAL:

Review comment (bug):
This will cause a crash at `mCompilerThreadPool.queue(priorityQueue, token,` in the (new) `compileProgram` method for the `priorityQueue` being LOW, which becomes 2 now. Please see the `queue` method to see how the value is used. You may want to update the CompilerThreadPool accordingly.



Code after:
  INT,
  FLOAT,
  BOOL
};

enum class Precision : uint8_t {
    LOW,
    MEDIUM,
    HIGH,
    DEFAULT
};

/**
 * Shader compiler priority queue
 *
 * On platforms which support parallel shader compilation, compilation requests will be processed in
 * order of priority, then insertion order. See Material::compile().
 */
enum class CompilerPriorityQueue : uint8_t {
    /** We need this program NOW.
     *
     * When passed as an argument to Material::compile(), if the platform doesn't support parallel
     * compilation, but does support amortized shader compilation, the given shader program will be
     * synchronously compiled.
     */
    CRITICAL,
    /** We will need this program soon. */
    HIGH,
    /** We will need this program eventually. */
    LOW
};

//! Texture sampler type
enum class SamplerType : uint8_t {
    SAMPLER_2D,             //!< 2D texture
    SAMPLER_2D_ARRAY,       //!< 2D array texture
    SAMPLER_CUBEMAP,        //!< Cube map texture
    SAMPLER_EXTERNAL,       //!< External texture
    SAMPLER_3D,             //!< 3D texture
    SAMPLER_CUBEMAP_ARRAY,  //!< Cube map array texture (feature level 2)
};

constexpr std::string_view to_string(SamplerType const type) noexcept {
    switch (type) {
        case SamplerType::SAMPLER_2D:
            return "SAMPLER_2D";
        case SamplerType::SAMPLER_2D_ARRAY:
            return "SAMPLER_2D_ARRAY";
        case SamplerType::SAMPLER_CUBEMAP:
            return "SAMPLER_CUBEMAP";
        case SamplerType::SAMPLER_EXTERNAL: