37 lines
837 B
C++
37 lines
837 B
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string_view>
|
|
#include <map>
|
|
#include <cinttypes>
|
|
|
|
namespace OpenVulkano
|
|
{
|
|
struct ShaderTableEntry final
|
|
{
|
|
const char *entryName;
|
|
const unsigned char *data;
|
|
long int size;
|
|
};
|
|
|
|
class ShaderRegistry final
|
|
{
|
|
std::map<std::string_view, std::pair<const uint8_t*, size_t>> m_shaderMap;
|
|
|
|
ShaderRegistry();
|
|
|
|
public:
|
|
static ShaderRegistry& GetInstance();
|
|
|
|
void RegisterShaderTable(const ShaderTableEntry* table, uint32_t size);
|
|
|
|
void RegisterShader(std::string_view name, std::pair<const uint8_t*, size_t>);
|
|
|
|
std::pair<const uint8_t*, size_t> GetShader(std::string_view shaderName);
|
|
};
|
|
} |