Program Listing for File shader-info.h

Return to documentation for file (include\playback\resource-info\shader-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 <string>
#include <vector>

namespace gpa {
namespace playback {

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

    api_types::ShaderLanguage language{api_types::GPA_SHADER_LANGUAGE_UNKNOWN};
    api_types::ShaderStageFlagBits stage{api_types::GPA_SHADER_STAGE_UNKNOWN};
    size_t entryPointCount{};
    api_types::EntryPoint const* pEntryPoints{nullptr};
    char const* pSourceCode{nullptr};
    size_t byteCodeSize{0};
    uint8_t const* pByteCode{nullptr};
    void* shaderData{nullptr};
    uint32_t compilationFlags{0};


protected:
    void OnRegister() override final;

private:
    class Storage final
    {
    public:
        std::vector<api_types::EntryPoint> entryPoints;
        std::vector<std::string> entryPointNames;
        std::string sourceCode;
        std::vector<uint8_t> byteCode;
    } mStorage;
};

namespace detail {

template<>
inline auto MakeTuple<ShaderInfo>(const ShaderInfo& shaderInfo)
{
    return std::make_tuple(
        shaderInfo.language,
        shaderInfo.stage,
        MakeSpan(shaderInfo.pEntryPoints, shaderInfo.entryPointCount),
        MakeSpan(shaderInfo.pSourceCode),
        MakeSpan(shaderInfo.pByteCode, shaderInfo.byteCodeSize));
}

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