Repository: google/filament
File: filament/src/details/Engine.h (C/C++)

Code before:
            struct {
                // TODO: clean-up the following flags (equivalent to setting them to true) when
                // clients have addressed their usages.
                bool assert_material_instance_in_use = CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_destroy_material_before_material_instance =
                        CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_vertex_buffer_count_exceeds_8 = CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_vertex_buffer_attribute_stride_mult_of_4 =
                        CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_material_instance_texture_descriptor_set_compatible =
                        CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_texture_can_generate_mipmap = CORRECTNESS_ASSERTION_DEFAULT;
            } debug;
            struct {
                bool disable_gpu_frame_complete_metric = true;
            } frame_info;
        } engine;
        struct {
            struct {
                bool assert_native_window_is_valid = false;
            } opengl;
            struct {
                // In certain GPU drivers, graphics pipelines are cached based on a subset of their
                // parameters. In those cases, we can create fake pipelines ahead of time to ensure
                // a cache hit when creating graphics pipelines at draw time, eliminating hitching.
                bool allow_pipeline_cache_prewarming = false;
                // On Unified Memory Architecture device, it is possible to bypass using the staging
                // buffer. This is an experimental feature that still needs to be implemented fully
                // before it can be fully enabled.
                bool enable_staging_buffer_bypass = false;
            } vulkan;
            bool disable_parallel_shader_compile = false;
            bool disable_amortized_shader_compile = true;
            bool disable_handle_use_after_free_check = false;
            bool disable_heap_handle_tags = true; // FIXME: this should be false
            bool enable_asynchronous_operation = false;
        } backend;
        struct {
            bool check_crc32_after_loading = false;
            bool enable_material_instance_uniform_batching = false;
        } material;
    } features;

    std::array<FeatureFlag, sizeof(features)> const mFeatures{{
            { "backend.disable_parallel_shader_compile",
              "Disable parallel shader compilation in GL and Metal backends.",
              &features.backend.disable_parallel_shader_compile },
            { "backend.disable_amortized_shader_compile",
              "Disable amortized shader compilation in GL backend.",
              &features.backend.disable_amortized_shader_compile },
            { "backend.disable_handle_use_after_free_check",

Review comment (suggestion):
Rename this to `enable_` since it should be seen as a feature flag enabling a feature. it's intended to be removed once the feature is functional and safe.
This can't be used as a "setting".

Code after:
            struct {
                // TODO: clean-up the following flags (equivalent to setting them to true) when
                // clients have addressed their usages.
                bool assert_material_instance_in_use = CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_destroy_material_before_material_instance =
                        CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_vertex_buffer_count_exceeds_8 = CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_vertex_buffer_attribute_stride_mult_of_4 =
                        CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_material_instance_texture_descriptor_set_compatible =
                        CORRECTNESS_ASSERTION_DEFAULT;
                bool assert_texture_can_generate_mipmap = CORRECTNESS_ASSERTION_DEFAULT;
            } debug;
            struct {
                bool disable_gpu_frame_complete_metric = true;
            } frame_info;
        } engine;
        struct {
            struct {
                bool assert_native_window_is_valid = false;
            } opengl;
            struct {
                // In certain GPU drivers, graphics pipelines are cached based on a subset of their
                // parameters. In those cases, we can create fake pipelines ahead of time to ensure
                // a cache hit when creating graphics pipelines at draw time, eliminating hitching.
                bool enable_pipeline_cache_prewarming = false;
                // On Unified Memory Architecture device, it is possible to bypass using the staging
                // buffer. This is an experimental feature that still needs to be implemented fully
                // before it can be fully enabled.
                bool enable_staging_buffer_bypass = false;
            } vulkan;
            bool disable_parallel_shader_compile = false;
            bool disable_amortized_shader_compile = true;
            bool disable_handle_use_after_free_check = false;
            bool disable_heap_handle_tags = true; // FIXME: this should be false
            bool enable_asynchronous_operation = false;
        } backend;
        struct {
            bool check_crc32_after_loading = false;
            bool enable_material_instance_uniform_batching = false;
        } material;
    } features;

    std::array<FeatureFlag, sizeof(features)> const mFeatures{{
            { "backend.disable_parallel_shader_compile",
              "Disable parallel shader compilation in GL and Metal backends.",
              &features.backend.disable_parallel_shader_compile },
            { "backend.disable_amortized_shader_compile",
              "Disable amortized shader compilation in GL backend.",
              &features.backend.disable_amortized_shader_compile },
            { "backend.disable_handle_use_after_free_check",