Commit 8033165b by Jamie Madill Committed by Commit Bot

Don't use constexpr pair constructor in translator.

Although this seems to compile and pass on our bots, the std::pair constructor with arguments is not constexpr until c++14. Instead use a helper struct which achieves the same goal. BUG=chromium:697758 Change-Id: I0f9873729485a5059f79af969cb56f84706e6c98 Reviewed-on: https://chromium-review.googlesource.com/545796Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c6a34b03
......@@ -16,7 +16,18 @@ namespace sh
namespace
{
constexpr std::pair<MiniFunctionId, const char *> g_hlslFunctions[] = {
struct FunctionPair
{
constexpr FunctionPair(const MiniFunctionId &idIn, const char *bodyIn) : id(idIn), body(bodyIn)
{
}
MiniFunctionId id;
const char *body;
};
constexpr FunctionPair g_hlslFunctions[] = {
{{EOpMod, ParamType::Float1, ParamType::Float1},
"float webgl_mod_emu(float x, float y)\n"
"{\n"
......@@ -837,9 +848,9 @@ const char *FindHLSLFunction(const FunctionId &functionID)
for (size_t index = 0; index < ArraySize(g_hlslFunctions); ++index)
{
const auto &function = g_hlslFunctions[index];
if (function.first == functionID)
if (function.id == functionID)
{
return function.second;
return function.body;
}
}
......
......@@ -27,7 +27,18 @@ namespace sh
namespace
{{
constexpr std::pair<MiniFunctionId, const char *> g_hlslFunctions[] = {{
struct FunctionPair
{{
constexpr FunctionPair(const MiniFunctionId &idIn, const char *bodyIn) : id(idIn), body(bodyIn)
{{
}}
MiniFunctionId id;
const char *body;
}};
constexpr FunctionPair g_hlslFunctions[] = {{
{emulated_functions}}};
}} // anonymous namespace
......@@ -36,9 +47,9 @@ const char *FindHLSLFunction(const FunctionId &functionID)
for (size_t index = 0; index < ArraySize(g_hlslFunctions); ++index)
{{
const auto &function = g_hlslFunctions[index];
if (function.first == functionID)
if (function.id == functionID)
{{
return function.second;
return function.body;
}}
}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment