Accept mismatching auxiliary interpolations.

The ES3.1 spec, and discussion on Khronos.org, confirm that dEQP is
correct in accepting mismatching centroid specifiers in shader
linkage. Mismatching flat/smooth is still a link error.

Fixes:
shaders.linkage.varying.rules.differing_interpolation_2

Change-Id: I3016f4147e7c1b16b02371ee95866c8daf826212
Reviewed-on: https://chromium-review.googlesource.com/251205
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2015-02-19 16:00:13 -05:00
Родитель a2643b647e
Коммит e9cc469fd6
3 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -28,6 +28,9 @@ enum InterpolationType
INTERPOLATION_FLAT
};
// Validate link & SSO consistency of interpolation qualifiers
COMPILER_EXPORT bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
enum BlockLayoutType
{

Просмотреть файл

@ -14,6 +14,23 @@
namespace sh
{
namespace
{
InterpolationType GetNonAuxiliaryInterpolationType(InterpolationType interpolation)
{
return (interpolation == INTERPOLATION_CENTROID ? INTERPOLATION_SMOOTH : interpolation);
}
}
// The ES 3.0 spec is not clear on this point, but the ES 3.1 spec, and discussion
// on Khronos.org, clarifies that a smooth/flat mismatch produces a link error,
// but auxiliary qualifier mismatch (centroid) does not.
bool InterpolationTypesMatch(InterpolationType a, InterpolationType b)
{
return (GetNonAuxiliaryInterpolationType(a) == GetNonAuxiliaryInterpolationType(b));
}
ShaderVariable::ShaderVariable()
: type(0),
precision(0),

Просмотреть файл

@ -1543,7 +1543,7 @@ bool Program::linkValidateVaryings(InfoLog &infoLog, const std::string &varyingN
return false;
}
if (vertexVarying.interpolation != fragmentVarying.interpolation)
if (!sh::InterpolationTypesMatch(vertexVarying.interpolation, fragmentVarying.interpolation))
{
infoLog.append("Interpolation types for %s differ between vertex and fragment shaders", varyingName.c_str());
return false;