Program Listing for File pipeline-descriptor-set-info.h

Return to documentation for file (include\playback\resource-info\pipeline-descriptor-set-info.h)

/******************************************************************************

© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.

 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once

#include "playback/resource-info/detail/span.h"
#include "playback/resource-info/resource-info.h"
#include "api-types/api-types.h"

#include <vector>

namespace gpa {
namespace playback {

enum class DescriptorType {
    BUFFER,
    TEXTURE,
    SAMPLER,
    COMBINED_IMAGE_SAMPLER,
    ACCELERATION_STRUCTURE
};

struct PipelineDescriptorBinding
{
    api_types::ShaderStageFlags shaderStageVisibility{api_types::GPA_SHADER_STAGE_UNKNOWN};

    uint32_t descriptorCount{0};

    uint32_t shaderBinding{0};

    uint32_t shaderSpace{0};

    DescriptorType type{DescriptorType::BUFFER};
};

bool operator==(PipelineDescriptorBinding const& lhs, PipelineDescriptorBinding const& rhs);

bool operator!=(PipelineDescriptorBinding const& lhs, PipelineDescriptorBinding const& rhs);

bool operator<(PipelineDescriptorBinding const& lhs, PipelineDescriptorBinding const& rhs);

class PipelineDescriptorSet final
    : public ResourceInfo
{
public:
    TypeId GetTypeId() const override final;

    uint64_t bindingCount{0};
    PipelineDescriptorBinding const* pBindings{nullptr};
    api_types::ShaderStageFlags shaderStageVisibility{api_types::GPA_SHADER_STAGE_UNKNOWN};

protected:
    void OnRegister() override final;

private:
    class Storage final
    {
    public:
        std::vector<PipelineDescriptorBinding> bindings;
    } mStorage;
};

namespace detail {

template<>
inline auto MakeTuple<PipelineDescriptorSet>(const PipelineDescriptorSet& pipelineDescriptorSet)
{
    return std::make_tuple(
        pipelineDescriptorSet.bindingCount,
        MakeSpan(pipelineDescriptorSet.pBindings, pipelineDescriptorSet.bindingCount));
}

}  // namespace detail
}  // namespace playback
}  // namespace gpa