Consolidate varying packing sort order methods.
We were using the same list in the shader varying sorting
as well as in the varying packing validation in the
translator.
BUG=angle:466
Change-Id: Ic11758288e7a522d7c18a293de9e137e487e3978
Reviewed-on: https://chromium-review.googlesource.com/205595
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/VariablePacker.cpp b/src/compiler/translator/VariablePacker.cpp
index 7186cb9..c687677 100644
--- a/src/compiler/translator/VariablePacker.cpp
+++ b/src/compiler/translator/VariablePacker.cpp
@@ -9,52 +9,6 @@
#include <algorithm>
-namespace
-{
-
-int GetSortOrder(sh::GLenum type)
-{
- switch (type) {
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT3x4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT4x3:
- return 0;
- case GL_FLOAT_MAT2:
- return 1;
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_BOOL_VEC4:
- return 2;
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT3x2:
- return 3;
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- case GL_BOOL_VEC3:
- return 4;
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_BOOL_VEC2:
- return 5;
- case GL_FLOAT:
- case GL_INT:
- case GL_BOOL:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_2D_RECT_ARB:
- return 6;
- default:
- ASSERT(false);
- return 7;
- }
-}
-
-} // namespace
-
int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
{
switch (type)
@@ -111,11 +65,12 @@
}
}
-struct TVariableInfoComparer {
+struct TVariableInfoComparer
+{
bool operator()(const TVariableInfo& lhs, const TVariableInfo& rhs) const
{
- int lhsSortOrder = GetSortOrder(lhs.type);
- int rhsSortOrder = GetSortOrder(rhs.type);
+ int lhsSortOrder = gl::VariableSortOrder(lhs.type);
+ int rhsSortOrder = gl::VariableSortOrder(rhs.type);
if (lhsSortOrder != rhsSortOrder) {
return lhsSortOrder < rhsSortOrder;
}