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

Code before:

    uint64_t getCacheId() const noexcept { return mCacheId; }

    bool isMultiview() const noexcept { return mMultiview; }

    CompilerPriorityQueue getPriorityQueue() const noexcept { return mPriorityQueue; }

    SpecializationConstantsInfo const& getSpecializationConstants() const noexcept {
        return mSpecializationConstants;
    }

    SpecializationConstantsInfo& getSpecializationConstants() noexcept {
        return mSpecializationConstants;
    }

    DescriptorSetInfo& getDescriptorBindings() noexcept {
        return mDescriptorBindings;
    }

    inline Program& descriptorLayout(backend::descriptor_set_t set,
            DescriptorSetLayout descriptorLayout) noexcept {
        mDescriptorLayouts[set] = std::move(descriptorLayout);
        return *this;
    }

    const std::array<DescriptorSetLayout, MAX_DESCRIPTOR_SET_COUNT>& getDescriptorSetLayouts() const noexcept {
        return mDescriptorLayouts;
    }

    utils::FixedCapacityVector<PushConstant> const& getPushConstants(
            ShaderStage stage) const noexcept {
        return mPushConstants[static_cast<uint8_t>(stage)];
    }

    utils::FixedCapacityVector<PushConstant>& getPushConstants(ShaderStage stage) noexcept {
        return mPushConstants[static_cast<uint8_t>(stage)];
    }

    auto const& getBindingUniformInfo() const { return mBindingUniformsInfo; }
    auto& getBindingUniformInfo() { return mBindingUniformsInfo; }

    auto const& getAttributes() const { return mAttributes; }
    auto& getAttributes() { return mAttributes; }

private:
    friend utils::io::ostream& operator<<(utils::io::ostream& out, const Program& builder);

    ShaderSource mShadersSource;
    ShaderLanguage mShaderLanguage = ShaderLanguage::ESSL3;
    utils::CString mName;
    uint64_t mCacheId{};

Review comment (suggestion):
nit: prefer a `using DescriptorSetLayoutArray = std::array<DescriptorSetLayout, MAX_DESCRIPTOR_SET_COUNT>` 

Code after:
    auto const& getShaderLanguage() const { return mShaderLanguage; }

    uint64_t getCacheId() const noexcept { return mCacheId; }

    bool isMultiview() const noexcept { return mMultiview; }

    CompilerPriorityQueue getPriorityQueue() const noexcept { return mPriorityQueue; }

    SpecializationConstantsInfo const& getSpecializationConstants() const noexcept {
        return mSpecializationConstants;
    }

    SpecializationConstantsInfo& getSpecializationConstants() noexcept {
        return mSpecializationConstants;
    }

    DescriptorSetInfo& getDescriptorBindings() noexcept {
        return mDescriptorBindings;
    }

    inline Program& descriptorLayout(backend::descriptor_set_t set,
            DescriptorSetLayout descriptorLayout) noexcept {
        mDescriptorLayouts[set] = std::move(descriptorLayout);
        return *this;
    }

    const DescriptorSetLayoutArray& getDescriptorSetLayouts() const noexcept {
        return mDescriptorLayouts;
    }

    utils::FixedCapacityVector<PushConstant> const& getPushConstants(
            ShaderStage stage) const noexcept {
        return mPushConstants[static_cast<uint8_t>(stage)];
    }

    utils::FixedCapacityVector<PushConstant>& getPushConstants(ShaderStage stage) noexcept {
        return mPushConstants[static_cast<uint8_t>(stage)];
    }

    auto const& getBindingUniformInfo() const { return mBindingUniformsInfo; }
    auto& getBindingUniformInfo() { return mBindingUniformsInfo; }

    auto const& getAttributes() const { return mAttributes; }
    auto& getAttributes() { return mAttributes; }

private:
    friend utils::io::ostream& operator<<(utils::io::ostream& out, const Program& builder);

    ShaderSource mShadersSource;
    ShaderLanguage mShaderLanguage = ShaderLanguage::ESSL3;
    utils::CString mName;