Added define to enable/disable uniform precision validation for shaders.
This feature was requested by developers to allow non-conformant shaders
to be used which contain mismatched precisions.
Change-Id: I57899efe064f7ffed1c0e43a508930ac70f6aa03
Reviewed-on: https://chromium-review.googlesource.com/277340
Tested-by: Cooper Partin <coopp@microsoft.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index dd5ec95..cb748c0 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -1533,7 +1533,13 @@
bool Program::linkValidateUniforms(InfoLog &infoLog, const std::string &uniformName, const sh::Uniform &vertexUniform, const sh::Uniform &fragmentUniform)
{
- if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
+#if ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION == ANGLE_ENABLED
+ const bool validatePrecision = true;
+#else
+ const bool validatePrecision = false;
+#endif
+
+ if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, validatePrecision))
{
return false;
}
diff --git a/src/libANGLE/features.h b/src/libANGLE/features.h
index fbe013f..64b6469 100644
--- a/src/libANGLE/features.h
+++ b/src/libANGLE/features.h
@@ -37,4 +37,13 @@
#define ANGLE_SHADER_DEBUG_INFO ANGLE_DISABLED
#endif
+// Program link validation of precisions for uniforms. This feature was
+// requested by developers to allow non-conformant shaders to be used which
+// contain mismatched precisions.
+// ENABLED validate that precision for uniforms match between vertex and fragment shaders
+// DISABLED allow precision for uniforms to differ between vertex and fragment shaders
+#if !defined(ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION)
+#define ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION ANGLE_ENABLED
+#endif
+
#endif // LIBANGLE_FEATURES_H_