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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
//
// 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.
//
// ShaderInterfaceVariableInfoMap.cpp:
// Implements helper class for shader compilers
//
#include "libANGLE/renderer/ShaderInterfaceVariableInfoMap.h"
namespace rx
{
ShaderInterfaceVariableInfo::ShaderInterfaceVariableInfo() {}
// ShaderInterfaceVariableInfoMap implementation.
ShaderInterfaceVariableInfoMap::ShaderInterfaceVariableInfoMap() = default;
ShaderInterfaceVariableInfoMap::~ShaderInterfaceVariableInfoMap() = default;
void ShaderInterfaceVariableInfoMap::clear()
{
for (VariableNameToInfoMap &shaderMap : mData)
{
shaderMap.clear();
}
}
bool ShaderInterfaceVariableInfoMap::contains(gl::ShaderType shaderType,
const std::string &variableName) const
{
return mData[shaderType].find(variableName) != mData[shaderType].end();
}
const ShaderInterfaceVariableInfo &ShaderInterfaceVariableInfoMap::get(
gl::ShaderType shaderType,
const std::string &variableName) const
{
auto it = mData[shaderType].find(variableName);
ASSERT(it != mData[shaderType].end());
return it->second;
}
ShaderInterfaceVariableInfo &ShaderInterfaceVariableInfoMap::get(gl::ShaderType shaderType,
const std::string &variableName)
{
auto it = mData[shaderType].find(variableName);
ASSERT(it != mData[shaderType].end());
return it->second;
}
void ShaderInterfaceVariableInfoMap::markAsDuplicate(gl::ShaderType shaderType,
const std::string &variableName)
{
ASSERT(contains(shaderType, variableName));
mData[shaderType][variableName].isDuplicate = true;
}
ShaderInterfaceVariableInfo &ShaderInterfaceVariableInfoMap::add(gl::ShaderType shaderType,
const std::string &variableName)
{
ASSERT(!contains(shaderType, variableName));
return mData[shaderType][variableName];
}
ShaderInterfaceVariableInfo &ShaderInterfaceVariableInfoMap::addOrGet(
gl::ShaderType shaderType,
const std::string &variableName)
{
return mData[shaderType][variableName];
}
ShaderInterfaceVariableInfoMap::Iterator ShaderInterfaceVariableInfoMap::getIterator(
gl::ShaderType shaderType) const
{
return Iterator(mData[shaderType].begin(), mData[shaderType].end());
}
} // namespace rx