Commit 84954988 by Corentin Wallez

ShaderVars: add isSameInterfaceBlockFieldAtLinkTime

This will be used by Chromium to check for interface blocks mismatches. BUG=621031 Change-Id: Ia6cc19e5d7b2a5c33af558d65b87885a6b72cea3 Reviewed-on: https://chromium-review.googlesource.com/359607Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 3fdaf6f2
......@@ -48,7 +48,7 @@ typedef unsigned int GLenum;
// Version number for shader translation API.
// It is incremented every time the API changes.
#define ANGLE_SH_VERSION 146
#define ANGLE_SH_VERSION 147
typedef enum {
SH_GLES2_SPEC = 0x8B40,
......
......@@ -203,6 +203,9 @@ struct COMPILER_EXPORT InterfaceBlock
// Fields from blocks with non-empty instance names are prefixed with the block name.
std::string fieldPrefix() const;
// Decide whether two interface blocks are the same at shader link time.
bool isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const;
std::string name;
std::string mappedName;
std::string instanceName;
......
......@@ -355,7 +355,7 @@ bool Varying::isSameVaryingAtLinkTime(const Varying &other) const
bool Varying::isSameVaryingAtLinkTime(const Varying &other, int shaderVersion) const
{
return (ShaderVariable::isSameVariableAtLinkTime(other, false) &&
interpolation == other.interpolation &&
InterpolationTypesMatch(interpolation, other.interpolation) &&
(shaderVersion >= 300 || isInvariant == other.isInvariant));
}
......@@ -398,4 +398,24 @@ std::string InterfaceBlock::fieldPrefix() const
return instanceName.empty() ? "" : name;
}
bool InterfaceBlock::isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const
{
if (name != other.name || mappedName != other.mappedName || arraySize != other.arraySize ||
layout != other.layout || isRowMajorLayout != other.isRowMajorLayout ||
fields.size() != other.fields.size())
{
return false;
}
for (size_t fieldIndex = 0; fieldIndex < fields.size(); ++fieldIndex)
{
if (!fields[fieldIndex].isSameInterfaceBlockFieldAtLinkTime(other.fields[fieldIndex]))
{
return false;
}
}
return true;
}
} // namespace sh
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