Program Listing for File resource-transfer-info.h

Return to documentation for file (include\playback\resource-info\resource-info-ex\resource-transfer-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-ex.h"

#include <vector>

namespace gpa {
namespace playback {

class ResourceTransferInfo final
    : public ResourceInfo::Ex
{
public:
    enum class Type {
        UNKNOWN,
        CLEAR,
        COPY,
        FILL,
        LOAD,
        RESOLVE,
        UPDATE,
        COUNT,
    };

    struct Region
    {
        struct Info
        {
            api_types::BufferRegion buffer{};

            api_types::TextureType textureType{api_types::GPA_TEXTURE_TYPE_UNKNOWN};

            api_types::TextureRegion texture{};
        } src, dst;
    };

    TypeId GetTypeId() const override final;

    Type type{Type::UNKNOWN};
    ResourceInfo const* pSrc{nullptr};
    ResourceInfo const* pDst{nullptr};
    size_t regionCount{0};
    Region const* pRegions{nullptr};
    size_t srcDataSize{0};

    uint8_t const* pSrcData{nullptr};

protected:
    void OnRegister() override final;

private:
    class Storage final
    {
    public:
        std::vector<Region> regions;
        std::vector<uint8_t> srcData;
    } mStorage;
};

bool operator==(ResourceTransferInfo::Region const& lhs, ResourceTransferInfo::Region const& rhs);

bool operator!=(ResourceTransferInfo::Region const& lhs, ResourceTransferInfo::Region const& rhs);

bool operator<(ResourceTransferInfo::Region const& lhs, ResourceTransferInfo::Region const& rhs);

namespace detail {

template<>
inline auto MakeTuple<ResourceTransferInfo>(const ResourceTransferInfo& resourceTransferInfo)
{
    return std::make_tuple(
        resourceTransferInfo.type,
        resourceTransferInfo.pSrc,
        resourceTransferInfo.pDst,
        MakeSpan(resourceTransferInfo.pRegions, resourceTransferInfo.regionCount),
        MakeSpan(resourceTransferInfo.pSrcData, resourceTransferInfo.srcDataSize));
}

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