Hash :
c4a9d416
Author :
Date :
2022-01-05T15:28:11
Metal: Refactor to build without SPIR-V Refactor ShaderInterfaceInfoMap and constant names to thier own files, allowing Webkit to build without needing to compile SPIRV code via mtl_glslang_utils.cpp. Bug: angleproject:6782 Change-Id: I7a9c7e387145c95807f780e24bd2764e0efb5709 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3364970 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Header for the shared ShaderInterfaceVariableInfoMap class, used by both the
// Direct-to-Metal and Metal-SPIRV backends
#ifndef LIBANGLE_RENDERER_SHADERINTERFACEVARIABLEINFOMAP_H_
#define LIBANGLE_RENDERER_SHADERINTERFACEVARIABLEINFOMAP_H_
#include <functional>
#include <stdio.h>
#include "libANGLE/renderer/ProgramImpl.h"
#include "libANGLE/renderer/glslang_wrapper_utils.h"
#include "libANGLE/renderer/renderer_utils.h"
namespace rx
{
// TODO: http://anglebug.com/4524: Need a different hash key than a string, since that's slow to
// calculate.
class ShaderInterfaceVariableInfoMap final : angle::NonCopyable
{
public:
ShaderInterfaceVariableInfoMap();
~ShaderInterfaceVariableInfoMap();
void clear();
bool contains(gl::ShaderType shaderType, const std::string &variableName) const;
const ShaderInterfaceVariableInfo &get(gl::ShaderType shaderType,
const std::string &variableName) const;
ShaderInterfaceVariableInfo &get(gl::ShaderType shaderType, const std::string &variableName);
ShaderInterfaceVariableInfo &add(gl::ShaderType shaderType, const std::string &variableName);
void markAsDuplicate(gl::ShaderType shaderType, const std::string &variableName);
ShaderInterfaceVariableInfo &addOrGet(gl::ShaderType shaderType,
const std::string &variableName);
size_t variableCount(gl::ShaderType shaderType) const { return mData[shaderType].size(); }
using VariableNameToInfoMap = angle::HashMap<std::string, ShaderInterfaceVariableInfo>;
class Iterator final
{
public:
Iterator(VariableNameToInfoMap::const_iterator beginIt,
VariableNameToInfoMap::const_iterator endIt)
: mBeginIt(beginIt), mEndIt(endIt)
{}
VariableNameToInfoMap::const_iterator begin() { return mBeginIt; }
VariableNameToInfoMap::const_iterator end() { return mEndIt; }
private:
VariableNameToInfoMap::const_iterator mBeginIt;
VariableNameToInfoMap::const_iterator mEndIt;
};
Iterator getIterator(gl::ShaderType shaderType) const;
private:
gl::ShaderMap<VariableNameToInfoMap> mData;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_SHADERINTERFACEVARIABLEINFOMAP_H_